Next: , Previous: C++ Parser Interface, Up: C++ Parsers


10.1.5 C++ Scanner Interface

The parser invokes the scanner by calling yylex. Contrary to C parsers, C++ parsers are always pure: there is no point in using the %define api.pure full directive. Therefore the interface is as follows.

— Method on parser: int yylex (semantic_type* yylval, location_type* yylloc, type1 arg1, ...)

Return the next token. Its type is the return value, its semantic value and location being yylval and yylloc. Invocations of ‘%lex-param {type1 arg1}’ yield additional arguments.