|
ylmm::basic_scanner< Token, Location, id, Lock > Class Template Reference |
Token | the type of the tokens used in the grammar. | |
Location | the location type used, if applicable for the backend parser generator (Normal Yacc does not support that, but Bison does). | |
id | is an integer that uniquely identifies the class. | |
lock | The type of thread syncronisation locks used in the application. Per default a single threaded locking mechanism (that is - no locks) is used. The application should pass the appropiate type here to make the use of this class thread safe. |
simple_parser.hh, toycalc_parser.hh, and toycalc_scanner.hh.
Definition at line 380 of file basic_scanner.hh.
Public Types | |
typedef Token | token_type |
typedef Location | location_type |
enum | { scanner_id = id } |
Public Member Functions | |
basic_scanner (basic_buffer *buf=0) | |
template<> | |
int | start_condition () const |
template<> | |
int | scan () |
template<> | |
const char * | text () const |
template<> | |
int | length () const |
basic_scanner (std::istream &stream) | |
virtual int | start_condition () const |
virtual const char * | text () const |
virtual int | length () const |
virtual int | scan () |
int | type () const |
void | token (token_type &t) |
void | where (location_type &l, bool f=true) |
virtual int | next (token_type &t, location_type &l, bool f=true) |
virtual int | next (token_type &t) |
Protected Types | |
typedef scanner_base< Lock > | base_type |
Protected Attributes | |
int | _type |
token_type | _token |
|
Definition at line 390 of file basic_scanner.hh. |
|
Type of locationss.
Definition at line 386 of file basic_scanner.hh. |
|
Type of tokens.
Definition at line 384 of file basic_scanner.hh. |
|
Scanner id.
Definition at line 388 of file basic_scanner.hh. |
|
Constructor.
Definition at line 398 of file basic_scanner.hh. |
|
Constructor.
Definition at line 401 of file basic_scanner.hh. |
|
Get the length of the text.
Implements ylmm::scanner_base< Lock >. Definition at line 112 of file lexmm.hh. References yyleng. |
|
Get the length of the current input text. This member function is implemented in lexmm.hh
Implements ylmm::scanner_base< Lock >. |
|
Like above, but without the location argument.
Definition at line 495 of file basic_scanner.hh. References ylmm::basic_scanner< Token, Location, id, Lock >::scan(), ylmm::basic_scanner< Token, Location, id, Lock >::token(), and ylmm::basic_scanner< Token, Location, id, Lock >::type(). Here is the call graph for this function: |
|
A more generic interface to the scanner. The parser may call this member function from it scan method to pop the next token. The point is, that often one need to do a look-up on identifiers and similar before returning the current token type to the LALR(1) parser (think typedefs in C, classes and templates in C++), so this function can be overloaded by a derived class to do that translation. The default implementation just reads a token from the input and returns the value to the caller.
Definition at line 484 of file basic_scanner.hh. References ylmm::basic_scanner< Token, Location, id, Lock >::scan(), ylmm::basic_scanner< Token, Location, id, Lock >::token(), ylmm::basic_scanner< Token, Location, id, Lock >::type(), and ylmm::basic_scanner< Token, Location, id, Lock >::where(). Here is the call graph for this function: |
|
Start scanning.
Implements ylmm::scanner_base< Lock >. Definition at line 87 of file lexmm.hh. References _scanner, and yylex(). Here is the call graph for this function: |
|
The main method of this class. The member _type is set to the token type, and it's value is returned to the caller. Also, the internal members, _token and _location are should be set by the handlers defined in the input file to Lex. The parser may use this member function directly from ylmm::basic_parser::scan, but then it's up to the handlers to set the appropiate value of the token (and possibly the location) in the parser. See also general comments in the documentation.
Implements ylmm::scanner_base< Lock >. Referenced by ylmm::basic_scanner< Token, Location, id, Lock >::next(). |
|
Get the start condition.
Implements ylmm::scanner_base< Lock >. |
|
Get the current start condition. This member function is implemented in lexmm.hh
Implements ylmm::scanner_base< Lock >. |
|
Get the text.
Implements ylmm::scanner_base< Lock >. Definition at line 100 of file lexmm.hh. References yytext. |
|
Get the current input text. This member function is implemented in lexmm.hh
Implements ylmm::scanner_base< Lock >. |
|
Get the last read token.
Updates the token information in place. That is, the token passed is updated to the last read token value. The
Definition at line 439 of file basic_scanner.hh. References ylmm::basic_scanner< Token, Location, id, Lock >::_token. Referenced by ylmm::basic_scanner< Token, Location, id, Lock >::next(). |
|
Get the last read token type.
Implements ylmm::scanner_base< Lock >. Definition at line 433 of file basic_scanner.hh. References ylmm::basic_scanner< Token, Location, id, Lock >::_type. Referenced by ylmm::basic_scanner< Token, Location, id, Lock >::next(). |
|
Get the last read position.
Updates the location information in-place in the passed argument
Definition at line 471 of file basic_scanner.hh. References ylmm::scanner_base< Lock >::_current. Referenced by ylmm::basic_scanner< Token, Location, id, Lock >::next(). |
|
The last token type read via yylex.
Definition at line 393 of file basic_scanner.hh. Referenced by ylmm::basic_scanner< Token, Location, id, Lock >::token(). |
|
Definition at line 391 of file basic_scanner.hh. Referenced by ylmm::basic_scanner< Token, Location, id, Lock >::type(). |