Token queue management for parser 더 자세히 ...
#include <tokenDispatcher.hpp>
Public 멤버 함수 | |
| void | add (nint newToken) |
| void | addFront (nint newToken) |
| nbool | pop (nint &output) |
| Removes a token from the front of the queue. | |
| ncnt | len () const |
| void | rel () |
Token queue management for parser
Manages a queue of tokens for lookahead and token reordering during parsing. Provides FIFO token dispatch with front insertion capability.
if you don't return a token in flex file, dispatcher won't work. it's by implementation of flex. for example,
you may confuse that this class is just like unput(), but it's totally different. unput() affects stream itself. however, tokenDispatchers skips lexer and returns determined token forcely, not a single character. for example,
you may think that above codes exactly same to ‘unput('e’); unput('m'); ....‘. but that's not true. if you use unput(), lexer will judge the token as STRVAL which contains string value, "name". however, above codes, returns 'n’ token individually to parser which makes it fail to continue.
Removes a token from the front of the queue.
| output | Reference to store the popped token ID. |