OpenMD  2.5
Molecular Dynamics in the Open
antlr::LLkParser Class Reference

#include <LLkParser.hpp>

Inheritance diagram for antlr::LLkParser:
antlr::Parser

Public Member Functions

 LLkParser (const ParserSharedInputState &lexer, int k_)
 
 LLkParser (TokenBuffer &tokenBuf, int k_)
 
 LLkParser (TokenStream &lexer, int k_)
 
virtual void consume ()
 
virtual int LA (unsigned int i)
 
virtual RefToken LT (unsigned int i)
 Return the i-th token of lookahead. More...
 
virtual void traceIn (const char *rname)
 
virtual void traceOut (const char *rname)
 
- Public Member Functions inherited from antlr::Parser
virtual ~Parser ()
 
virtual void setASTNodeFactory (ASTFactory *factory)
 
virtual void setASTFactory (ASTFactory *factory)
 
virtual ASTFactorygetASTFactory ()
 
virtual RefAST getAST ()=0
 
virtual std ::string getFilename () const
 Return the filename of the input file. More...
 
virtual void setFilename (const std ::string &f)
 Set the filename of the input file (used for error reporting). More...
 
virtual void setInputState (ParserSharedInputState state)
 
virtual ParserSharedInputState getInputState () const
 
virtual void consumeUntil (int tokenType)
 Consume tokens until one matches the given token. More...
 
virtual void consumeUntil (const BitSet &set)
 Consume tokens until one matches the given token set. More...
 
virtual void match (int t)
 
virtual void matchNot (int t)
 
virtual void match (const BitSet &b)
 
virtual unsigned int mark ()
 
virtual void rewind (unsigned int pos)
 rewind to a previously marked position More...
 
virtual void recover (const RecognitionException &ex, const BitSet &tokenSet)
 
virtual void reportError (const RecognitionException &ex)
 Parser error-reporting function can be overridden in subclass. More...
 
virtual void reportError (const std ::string &s)
 Parser error-reporting function can be overridden in subclass. More...
 
virtual void reportWarning (const std ::string &s)
 Parser warning-reporting function can be overridden in subclass. More...
 
virtual const char * getTokenName (int num) const =0
 get the token name for the token number 'num' More...
 
virtual const char *const * getTokenNames () const =0
 get a vector with all token names More...
 
virtual int getNumTokens (void) const =0
 
virtual void traceIndent ()
 

Protected Attributes

int k
 the lookahead this LL(k) parser is using. More...
 
- Protected Attributes inherited from antlr::Parser
ParserSharedInputState inputState
 
ASTFactoryastFactory
 AST support code; parser and treeparser delegate to this object. More...
 
int traceDepth
 

Private Member Functions

void trace (const char *ee, const char *rname)
 

Additional Inherited Members

- Protected Member Functions inherited from antlr::Parser
 Parser (TokenBuffer &input)
 
 Parser (TokenBuffer *input)
 
 Parser (const ParserSharedInputState &state)
 

Detailed Description

An LL(k) parser.

See also
antlr.Token
antlr.TokenBuffer
antlr.LL1Parser

Definition at line 24 of file LLkParser.hpp.

Constructor & Destructor Documentation

◆ LLkParser() [1/3]

antlr::LLkParser::LLkParser ( const ParserSharedInputState state,
int  k_ 
)

An LL(k) parser.

See also
antlr.Token
antlr.TokenBuffer
antlr.LL1Parser

Definition at line 26 of file LLkParser.cpp.

◆ LLkParser() [2/3]

antlr::LLkParser::LLkParser ( TokenBuffer tokenBuf,
int  k_ 
)

Definition at line 31 of file LLkParser.cpp.

◆ LLkParser() [3/3]

antlr::LLkParser::LLkParser ( TokenStream lexer,
int  k_ 
)

Definition at line 36 of file LLkParser.cpp.

Member Function Documentation

◆ consume()

virtual void antlr::LLkParser::consume ( )
inlinevirtual

Consume another token from the input stream. Can only write sequentially! If you need 3 tokens ahead, you must consume() 3 times.

Note that it is possible to overwrite tokens that have not been matched. For example, calling consume() 3 times when k=2, means that the first token consumed will be overwritten with the 3rd.

Implements antlr::Parser.

Definition at line 39 of file LLkParser.hpp.

◆ LA()

virtual int antlr::LLkParser::LA ( unsigned int  i)
inlinevirtual

Return the token type of the ith token of lookahead where i=1 is the current token being examined by the parser (i.e., it has not been matched yet).

Implements antlr::Parser.

Definition at line 44 of file LLkParser.hpp.

◆ LT()

virtual RefToken antlr::LLkParser::LT ( unsigned int  i)
inlinevirtual

Return the i-th token of lookahead.

Implements antlr::Parser.

Definition at line 49 of file LLkParser.hpp.

Referenced by trace().

◆ trace()

void antlr::LLkParser::trace ( const char *  ee,
const char *  rname 
)
private

◆ traceIn()

void antlr::LLkParser::traceIn ( const char *  rname)
virtual

Reimplemented from antlr::Parser.

Definition at line 71 of file LLkParser.cpp.

References trace(), and antlr::Parser::traceDepth.

◆ traceOut()

void antlr::LLkParser::traceOut ( const char *  rname)
virtual

Reimplemented from antlr::Parser.

Definition at line 77 of file LLkParser.cpp.

References trace(), and antlr::Parser::traceDepth.

Member Data Documentation

◆ k

int antlr::LLkParser::k
protected

the lookahead this LL(k) parser is using.

Definition at line 55 of file LLkParser.hpp.

Referenced by trace().


The documentation for this class was generated from the following files: