OpenMD 3.1
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
antlr::LLkParser Class Reference

An LL(k) parser. More...

#include <LLkParser.hpp>

+ Inheritance diagram for antlr::LLkParser:

Public Member Functions

 LLkParser (const ParserSharedInputState &lexer, int k_)
 An LL(k) parser.
 
 LLkParser (TokenBuffer &tokenBuf, int k_)
 
 LLkParser (TokenStream &lexer, int k_)
 
virtual void consume ()
 Consume another token from the input stream.
 
virtual int LA (unsigned int i)
 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).
 
virtual RefToken LT (unsigned int i)
 Return the i-th token of lookahead.
 
virtual void traceIn (const char *rname)
 
virtual void traceOut (const char *rname)
 
- Public Member Functions inherited from antlr::Parser
virtual void setASTNodeFactory (ASTFactory *factory)
 DEPRECATED! Specify the factory to be used during tree building.
 
virtual void setASTFactory (ASTFactory *factory)
 Specify the factory to be used during tree building.
 
virtual ASTFactorygetASTFactory ()
 Return a pointer to the ASTFactory used.
 
virtual RefAST getAST ()=0
 Get the root AST node of the generated AST.
 
virtual std::string getFilename () const
 Return the filename of the input file.
 
virtual void setFilename (const std ::string &f)
 Set the filename of the input file (used for error reporting).
 
virtual void setInputState (ParserSharedInputState state)
 
virtual ParserSharedInputState getInputState () const
 
virtual void consumeUntil (int tokenType)
 Consume tokens until one matches the given token.
 
virtual void consumeUntil (const BitSet &set)
 Consume tokens until one matches the given token set.
 
virtual void match (int t)
 Make sure current lookahead symbol matches token type t.
 
virtual void matchNot (int t)
 
virtual void match (const BitSet &b)
 Make sure current lookahead symbol matches the given set Throw an exception upon mismatch, which is catch by either the error handler or by the syntactic predicate.
 
virtual unsigned int mark ()
 Mark a spot in the input and return the position.
 
virtual void rewind (unsigned int pos)
 rewind to a previously marked position
 
virtual void recover (const RecognitionException &, const BitSet &tokenSet)
 called by the generated parser to do error recovery, override to customize the behaviour.
 
virtual void reportError (const RecognitionException &ex)
 Parser error-reporting function can be overridden in subclass.
 
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 const char * getTokenName (int num) const =0
 get the token name for the token number 'num'
 
virtual const char *const * getTokenNames () const =0
 get a vector with all token names
 
virtual int getNumTokens (void) const =0
 Get the number of tokens defined.
 
virtual void traceIndent ()
 Set or change the input token buffer.
 

Protected Attributes

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

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.

◆ traceIn()

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

Reimplemented from antlr::Parser.

Definition at line 71 of file LLkParser.cpp.

◆ traceOut()

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

Reimplemented from antlr::Parser.

Definition at line 77 of file LLkParser.cpp.

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.


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