OpenMD 3.1
Molecular Dynamics in the Open
|
Superclass of generated lexers. More...
#include <CharScanner.hpp>
Classes | |
class | Tracer |
Tracer class, used when -traceLexer is passed to antlr. More... | |
Public Member Functions | |
CharScanner (InputBuffer &cb, bool case_sensitive) | |
CharScanner (InputBuffer *cb, bool case_sensitive) | |
CharScanner (const LexerSharedInputState &state, bool case_sensitive) | |
virtual int | LA (unsigned int i) |
virtual void | append (char c) |
virtual void | append (const std ::string &s) |
virtual void | commit () |
virtual void | recover (const RecognitionException &, const BitSet &tokenSet) |
called by the generated lexer to do error recovery, override to customize the behaviour. | |
virtual void | consume () |
virtual void | consumeUntil (int c) |
Consume chars until one matches the given char. | |
virtual void | consumeUntil (const BitSet &set) |
Consume chars until one matches the given set. | |
virtual unsigned int | mark () |
Mark the current position and return a id for it. | |
virtual void | rewind (unsigned int pos) |
Rewind the scanner to a previously marked position. | |
virtual void | match (int c) |
See if input contains character 'c' throw MismatchedCharException if not. | |
virtual void | match (const BitSet &b) |
See if input contains element from bitset b throw MismatchedCharException if not. | |
virtual void | match (const char *s) |
See if input contains string 's' throw MismatchedCharException if not. | |
virtual void | match (const std ::string &s) |
See if input contains string 's' throw MismatchedCharException if not. | |
virtual void | matchNot (int c) |
See if input does not contain character 'c' throw MismatchedCharException if not. | |
virtual void | matchRange (int c1, int c2) |
See if input contains character in range c1-c2 throw MismatchedCharException if not. | |
virtual bool | getCaseSensitive () const |
virtual void | setCaseSensitive (bool t) |
virtual bool | getCaseSensitiveLiterals () const =0 |
virtual int | getLine () const |
Get the line the scanner currently is in (starts at 1) | |
virtual void | setLine (int l) |
set the line number | |
virtual int | getColumn () const |
Get the column the scanner currently is in (starts at 1) | |
virtual void | setColumn (int c) |
set the column number | |
virtual const std::string & | getFilename () const |
get the filename for the file currently used | |
virtual void | setFilename (const std ::string &f) |
Set the filename the scanner is using (used in error messages) | |
virtual bool | getCommitToPath () const |
virtual void | setCommitToPath (bool commit) |
virtual const std::string & | getText () const |
return a copy of the current text buffer | |
virtual void | setText (const std ::string &s) |
virtual void | resetText () |
virtual RefToken | getTokenObject () const |
virtual void | newline () |
Used to keep track of line breaks, needs to be called from within generated lexers when a \r is encountered. | |
virtual void | tab () |
Advance the current column number by an appropriate amount according to the tabsize. | |
int | setTabsize (int size) |
set the tabsize. Returns the old tabsize | |
int | getTabSize () const |
Return the tabsize used by the scanner. | |
virtual void | reportError (const RecognitionException &e) |
Report exception errors caught in nextToken() | |
virtual void | reportError (const std ::string &s) |
Parser error-reporting function can be overridden in subclass. | |
virtual void | reportWarning (const std ::string &s) |
Parser warning-reporting function can be overridden in subclass. | |
virtual InputBuffer & | getInputBuffer () |
virtual LexerSharedInputState | getInputState () |
virtual void | setInputState (LexerSharedInputState state) |
set the input state for the lexer. | |
virtual void | setTokenObjectFactory (factory_type factory) |
Set the factory for created tokens. | |
virtual int | testLiteralsTable (int ttype) const |
Test the token text against the literals table Override this method to perform a different literals test. | |
virtual int | testLiteralsTable (const std ::string &txt, int ttype) const |
Test the text passed in against the literals table Override this method to perform a different literals test This is used primarily when you want to test a portion of a token. | |
virtual int | toLower (int c) const |
Override this method to get more specific case handling. | |
virtual void | uponEOF () |
This method is called by YourLexer::nextToken() when the lexer has hit EOF condition. | |
virtual void | traceIndent () |
Methods used to change tracing behavior. | |
virtual void | traceIn (const char *rname) |
virtual void | traceOut (const char *rname) |
Public Member Functions inherited from antlr::TokenStream | |
virtual RefToken | nextToken ()=0 |
Static Public Attributes | |
static const int | EOF_CHAR = EOF |
Protected Types | |
typedef RefToken(* | factory_type) () |
Protected Member Functions | |
virtual RefToken | makeToken (int t) |
Create a new RefToken of type t. | |
Protected Attributes | |
std::string | text |
Text of current token flag indicating wether consume saves characters. | |
bool | saveConsumedInput |
factory_type | tokenFactory |
Factory for tokens. | |
bool | caseSensitive |
Is this lexer case sensitive. | |
std ::map< std ::string, int, CharScannerLiteralsLess > | literals |
RefToken | _returnToken |
used to return tokens w/o using return val | |
LexerSharedInputState | inputState |
Input state, gives access to input stream, shared among different lexers. | |
bool | commitToPath |
Used during filter mode to indicate that path is desired. | |
int | tabsize |
tab size the scanner uses. | |
int | traceDepth |
Superclass of generated lexers.
Definition at line 93 of file CharScanner.hpp.
|
protected |
Definition at line 95 of file CharScanner.hpp.
antlr::CharScanner::CharScanner | ( | InputBuffer & | cb, |
bool | case_sensitive ) |
Definition at line 18 of file CharScanner.cpp.
antlr::CharScanner::CharScanner | ( | InputBuffer * | cb, |
bool | case_sensitive ) |
Definition at line 30 of file CharScanner.cpp.
antlr::CharScanner::CharScanner | ( | const LexerSharedInputState & | state, |
bool | case_sensitive ) |
Definition at line 42 of file CharScanner.cpp.
|
inlinevirtual |
Definition at line 101 of file CharScanner.hpp.
|
inlinevirtual |
Definition at line 107 of file CharScanner.hpp.
|
inlinevirtual |
Definition at line 120 of file CharScanner.hpp.
|
inlinevirtual |
Definition at line 126 of file CharScanner.hpp.
|
inlinevirtual |
Definition at line 140 of file CharScanner.hpp.
|
inlinevirtual |
Consume chars until one matches the given set.
Definition at line 178 of file CharScanner.hpp.
|
inlinevirtual |
Consume chars until one matches the given char.
Definition at line 166 of file CharScanner.hpp.
|
inlinevirtual |
Definition at line 280 of file CharScanner.hpp.
|
inlinevirtual |
Get the column the scanner currently is in (starts at 1)
Definition at line 305 of file CharScanner.hpp.
|
inlinevirtual |
Definition at line 326 of file CharScanner.hpp.
|
inlinevirtual |
get the filename for the file currently used
Definition at line 316 of file CharScanner.hpp.
|
inlinevirtual |
Definition at line 400 of file CharScanner.hpp.
|
inlinevirtual |
Definition at line 405 of file CharScanner.hpp.
|
inlinevirtual |
Get the line the scanner currently is in (starts at 1)
Definition at line 293 of file CharScanner.hpp.
|
inline |
Return the tabsize used by the scanner.
Definition at line 386 of file CharScanner.hpp.
|
inlinevirtual |
return a copy of the current text buffer
Definition at line 337 of file CharScanner.hpp.
|
inlinevirtual |
Definition at line 354 of file CharScanner.hpp.
|
inlinevirtual |
Definition at line 553 of file CharScanner.hpp.
|
inlineprotectedvirtual |
Create a new RefToken of type t.
Definition at line 509 of file CharScanner.hpp.
|
inlinevirtual |
Mark the current position and return a id for it.
Definition at line 190 of file CharScanner.hpp.
|
inlinevirtual |
See if input contains element from bitset b throw MismatchedCharException if not.
Definition at line 212 of file CharScanner.hpp.
|
inlinevirtual |
See if input contains string 's' throw MismatchedCharException if not.
Definition at line 224 of file CharScanner.hpp.
|
inlinevirtual |
See if input contains string 's' throw MismatchedCharException if not.
Definition at line 240 of file CharScanner.hpp.
|
inlinevirtual |
See if input contains character 'c' throw MismatchedCharException if not.
Definition at line 201 of file CharScanner.hpp.
|
inlinevirtual |
See if input does not contain character 'c' throw MismatchedCharException if not.
Definition at line 258 of file CharScanner.hpp.
|
inlinevirtual |
See if input contains character in range c1-c2 throw MismatchedCharException if not.
Definition at line 270 of file CharScanner.hpp.
|
inlinevirtual |
Used to keep track of line breaks, needs to be called from within generated lexers when a
\r is encountered.
Definition at line 362 of file CharScanner.hpp.
|
inlinevirtual |
called by the generated lexer to do error recovery, override to customize the behaviour.
Definition at line 134 of file CharScanner.hpp.
|
virtual |
Report exception errors caught in nextToken()
Definition at line 55 of file CharScanner.cpp.
References antlr::RecognitionException::toString().
|
virtual |
Parser error-reporting function can be overridden in subclass.
Definition at line 61 of file CharScanner.cpp.
|
virtual |
Parser warning-reporting function can be overridden in subclass.
Definition at line 70 of file CharScanner.cpp.
|
inlinevirtual |
Definition at line 347 of file CharScanner.hpp.
|
inlinevirtual |
Rewind the scanner to a previously marked position.
Definition at line 195 of file CharScanner.hpp.
|
inlinevirtual |
Definition at line 285 of file CharScanner.hpp.
|
inlinevirtual |
set the column number
Definition at line 310 of file CharScanner.hpp.
|
inlinevirtual |
Definition at line 331 of file CharScanner.hpp.
|
inlinevirtual |
Set the filename the scanner is using (used in error messages)
Definition at line 321 of file CharScanner.hpp.
|
inlinevirtual |
set the input state for the lexer.
Definition at line 412 of file CharScanner.hpp.
|
inlinevirtual |
set the line number
Definition at line 299 of file CharScanner.hpp.
|
inline |
set the tabsize. Returns the old tabsize
Definition at line 379 of file CharScanner.hpp.
|
inlinevirtual |
Definition at line 342 of file CharScanner.hpp.
|
inlinevirtual |
Set the factory for created tokens.
Definition at line 418 of file CharScanner.hpp.
|
inlinevirtual |
Advance the current column number by an appropriate amount according to the tabsize.
This method needs to be explicitly called from the lexer rules encountering tabs.
Definition at line 372 of file CharScanner.hpp.
|
inlinevirtual |
Test the text passed in against the literals table Override this method to perform a different literals test This is used primarily when you want to test a portion of a token.
Definition at line 439 of file CharScanner.hpp.
|
inlinevirtual |
Test the token text against the literals table Override this method to perform a different literals test.
Definition at line 426 of file CharScanner.hpp.
|
inlinevirtual |
Override this method to get more specific case handling.
Definition at line 448 of file CharScanner.hpp.
|
virtual |
Definition at line 84 of file CharScanner.cpp.
|
virtual |
Methods used to change tracing behavior.
Definition at line 78 of file CharScanner.cpp.
|
virtual |
Definition at line 92 of file CharScanner.cpp.
|
inlinevirtual |
This method is called by YourLexer::nextToken() when the lexer has hit EOF condition.
EOF is NOT a character. This method is not called if EOF is reached during syntactic predicate evaluation or during evaluation of normal lexical rules, which presumably would be an IOException. This traps the "normal" EOF condition.
uponEOF() is called after the complete evaluation of the previous token and only if your parser asks for another token beyond that last non-EOF token.
You might want to throw token or char stream exceptions like: "Heh, premature eof" or a retry stream exception ("I found the end of this file, go back to referencing file").
Definition at line 471 of file CharScanner.hpp.
|
protected |
used to return tokens w/o using return val
Definition at line 495 of file CharScanner.hpp.
|
protected |
Is this lexer case sensitive.
Definition at line 492 of file CharScanner.hpp.
|
protected |
Used during filter mode to indicate that path is desired.
A subsequent scan error will report an error as usual if acceptPath=true;
Definition at line 504 of file CharScanner.hpp.
|
static |
Definition at line 481 of file CharScanner.hpp.
|
protected |
Input state, gives access to input stream, shared among different lexers.
Definition at line 498 of file CharScanner.hpp.
|
protected |
Definition at line 493 of file CharScanner.hpp.
|
protected |
Definition at line 490 of file CharScanner.hpp.
|
protected |
tab size the scanner uses.
Definition at line 506 of file CharScanner.hpp.
|
protected |
Text of current token flag indicating wether consume saves characters.
Definition at line 488 of file CharScanner.hpp.
|
protected |
Factory for tokens.
Definition at line 491 of file CharScanner.hpp.
|
protected |
Definition at line 539 of file CharScanner.hpp.