antlr Namespace Reference

Classes

class  InputBuffer
class  IOException
class  LexerInputState
class  LLkParser
class  MismatchedCharException
class  MismatchedTokenException
class  NoViableAltException
class  NoViableAltForCharException
class  Parser
class  ParserInputState
class  RecognitionException
class  RefCount
class  SemanticException
class  Token
class  TokenBuffer
struct  TokenRef
class  TokenRefCount
class  TokenStream
class  TokenStreamBasicFilter
class  TokenStreamException
class  TokenStreamHiddenTokenFilter
class  TokenStreamIOException
class  TokenStreamRecognitionException
class  TokenStreamRetryException
class  TokenStreamRewriteEngine
class  TokenStreamSelector
class  TokenWithIndex
class  TreeParser
class  TreeParserInputState

Typedefs

typedef RefCount< LexerInputStateLexerSharedInputState
 A reference counted LexerInputState object.
typedef RefCount
< ParserInputState
ParserSharedInputState
 A reference counted ParserInputState.
typedef TokenRefCount< TokenRefToken
typedef TokenRefCount
< TokenWithIndex
RefTokenWithIndex
typedef RefCount
< TreeParserInputState
TreeParserSharedInputState

Functions

std::string operator+ (const std::string &lhs, const int rhs)
std::string operator+ (const std::string &lhs, size_t rhs)
std::string charName (int ch)
std::istream & eatwhite (std::istream &is)
std::string read_string (std::istream &in)
std::string read_identifier (std::istream &in)
void read_AttributeNValue (std::istream &in, std::string &attribute, std::string &value)
std::string emptyString ("")

Variables

bool DEBUG_PARSER = false
RefToken nullToken
RefAST nullAST
AST *const nullASTptr = 0

Typedef Documentation

A reference counted LexerInputState object.

A reference counted ParserInputState.


Function Documentation

std::string antlr::charName ( int  ch  ) 

Convert character to readable string

std ::istream& antlr::eatwhite ( std::istream &  is  ) 

Eat whitespace from the input stream

Parameters:
is the stream to read from
std ::string antlr::emptyString ( ""   ) 
std::string antlr::operator+ ( const std::string &  lhs,
size_t  rhs 
)
std::string antlr::operator+ ( const std::string &  lhs,
const int  rhs 
)
void antlr::read_AttributeNValue ( std::istream &  in,
std::string &  attribute,
std::string &  value 
)

Read a attribute="value" thing. Leading whitespace is skipped. Between attribute and '=' no whitespace is allowed. After the '=' it is permitted.

Parameters:
in the istream to read from.
attribute string the attribute name is put in
value string the value of the attribute is put in
Exceptions:
IOException if something is fishy. E.g. malformed quoting or missing '='
std ::string antlr::read_identifier ( std::istream &  in  ) 
std ::string antlr::read_string ( std::istream &  in  ) 

Read a string enclosed by '"' from a stream. Also handles escaping of \". Skips leading whitespace.

Parameters:
in the istream to read from.
Returns:
the string read from file exclusive the ''
Exceptions:
IOException if string is badly formatted

Variable Documentation

bool antlr::DEBUG_PARSER = false

A generic ANTLR parser (LL(k) for k>=1) containing a bunch of utility routines useful at any lookahead depth. We distinguish between the LL(1) and LL(k) parsers because of efficiency. This may not be necessary in the near future.

Each parser object contains the state of the parse including a lookahead cache (the form of which is determined by the subclass), whether or not the parser is in guess mode, where tokens come from, etc...

During guess mode, the current lookahead token(s) and token type(s) cache must be saved because the token stream may not have been informed to save the token (via mark) before the try block. Guessing is started by:

  1. saving the lookahead cache.
  2. marking the current position in the TokenBuffer.
  3. increasing the guessing level.

After guessing, the parser state is restored by:

  1. restoring the lookahead cache.
  2. rewinding the TokenBuffer.
  3. decreasing the guessing level.
See also:
antlr.Token
antlr.TokenBuffer
antlr.TokenStream
antlr.LL1Parser
antlr.LLkParser
AST* const antlr::nullASTptr = 0
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines

Generated on 16 Nov 2015 for ANTLR Support Libraries 2.7.1+ by  doxygen 1.6.1