![]() |
User Guide
|
Represent Lexer/Scanner class for C (11) language parsing. More...
Represent Lexer/Scanner class for C (11) language parsing.
Lexer defined to add some extra function to the scanner class from flex. Flex itself creates yyFlexLexer class, which we renamed using macros to NmodlFlexLexer. But we change the context of the generated yylex() function because the yylex() defined in NmodlFlexLexer has no parameters. Also, note that implementation of the member functions are in nmodl.l file due to use of macros.
Definition at line 50 of file c11_lexer.hpp.
#include <c11_lexer.hpp>
Public Member Functions | |
virtual CParser::symbol_type | next_token () |
Function for lexer to scan token (replacement for yylex() ) More... | |
CParser::symbol_type | get_token_type () |
Get the type of token just parsed. More... | |
Ctor & dtor | |
CLexer (CDriver &driver, std::istream *in=nullptr, std::ostream *out=nullptr) | |
CLexer constructor. More... | |
~CLexer () override=default | |
Public Attributes | |
CDriver & | driver |
Reference to driver object which contains this lexer instance. More... | |
location | loc |
location of the parsed token More... | |
|
inlineexplicit |
CLexer constructor.
driver | CDriver where this lexer resides |
in | Input stream from where tokens will be read |
out | Output stream where output will be sent |
Definition at line 77 of file c11_lexer.hpp.
|
overridedefault |
CParser::symbol_type nmodl::parser::CLexer::get_token_type | ( | ) |
Get the type of token just parsed.
Check if parsed token is either enum
, typedef
or identifier
.
|
virtual |
Function for lexer to scan token (replacement for yylex()
)
This is main lexing function generated by flex
according to the macro declaration YY_DECL
. The generated bison parser then calls this virtual function to fetch new tokens. Note that yylex()
has different declaration and hence can't be used for new lexer.
CDriver& nmodl::parser::CLexer::driver |
Reference to driver object which contains this lexer instance.
This is used for error reporting and checking macro definitions.
Reference to driver object where this lexer resides
The driver object can be used from lexer to store/retrieve some global information. Currently this is used for storing all token encountered during lexing.
Definition at line 62 of file c11_lexer.hpp.
location nmodl::parser::CLexer::loc |
location of the parsed token
Definition at line 65 of file c11_lexer.hpp.