|
Grammatica 1.4 Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
System.Object
|
+--Parser
in Parser.csA base parser class. This class provides the standard parser interface, as well as token handling.
Constructor Summary | |
internal Parser( Tokenizer tokenizer )
Creates a new parser. |
|
internal Parser( Tokenizer tokenizer, Analyzer analyzer )
Creates a new parser. |
Method Summary | |
internal void |
AddError( ParseException e, bool recovery )
Adds an error to the error log. |
internal void |
AddNode( Production node, Node child )
Handles the parser adding a child node to a production. |
virtual void |
AddPattern( ProductionPattern pattern )
Adds a new production pattern to the parser. |
internal void |
EnterNode( Node node )
Handles the parser entering a production. |
internal Node |
ExitNode( Node node )
Handles the parser leaving a production. |
Analyzer |
GetAnalyzer()
Returns the analyzer in use by this parser. |
internal ProductionPattern |
GetPattern( int id )
Returns the production pattern with the specified id. |
internal ICollection |
GetPatterns()
Returns the ordered set of production patterns. |
internal ProductionPattern |
GetStartPattern()
Returns the production pattern for the starting production. |
internal string |
GetTokenDescription( int token )
Returns a token description for a specified token. |
Tokenizer |
GetTokenizer()
Returns the tokenizer in use by this parser. |
internal Token |
NextToken()
Reads and consumes the next token in the queue. |
internal Token |
NextToken( int id )
Reads and consumes the next token in the queue. |
Node |
Parse()
Parses the token stream and returns a parse tree. |
protected abstract Node |
ParseStart()
Parses the token stream and returns a parse tree. |
internal Token |
PeekToken( int steps )
Returns a token from the queue. |
virtual void |
Prepare()
Initializes the parser. |
internal void |
SetInitialized( bool initialized )
Sets the parser initialized flag. |
override string |
ToString()
Returns a string representation of this parser. |
Constructor Detail |
internal Parser( Tokenizer tokenizer );
tokenizer
- the tokenizer to useinternal Parser( Tokenizer tokenizer, Analyzer analyzer );
tokenizer
- the tokenizer to use
analyzer
- the analyzer callback to useMethod Detail |
internal void AddError( ParseException e, bool recovery );
e
- the error to add
recovery
- the recover flaginternal void AddNode( Production node, Node child );
node
- the parent parse tree node
child
- the child parse tree node, or nullpublic virtual void AddPattern( ProductionPattern pattern );
pattern
- the pattern to addParserCreationException
- if the pattern couldn't be
added correctly to the parserinternal void EnterNode( Node node );
node
- the parse tree nodeinternal Node ExitNode( Node node );
node
- the parse tree nodepublic Analyzer GetAnalyzer();
internal ProductionPattern GetPattern( int id );
id
- the production pattern idinternal ICollection GetPatterns();
internal ProductionPattern GetStartPattern();
internal string GetTokenDescription( int token );
token
- the token to describepublic Tokenizer GetTokenizer();
internal Token NextToken();
ParseException
- if the input stream couldn't be read or
parsed correctlyinternal Token NextToken( int id );
id
- the expected token idParseException
- if the input stream couldn't be parsed
correctly, or if the token wasn't expectedpublic Node Parse();
ParserCreationException
- if the parser couldn't be
initialized correctly
ParserLogException
- if the input couldn't be parsed
correctlyprepare
protected abstract Node ParseStart();
ParseException
- if the input couldn't be parsed
correctlyinternal Token PeekToken( int steps );
steps
- the token queue number, zero (0) for firstpublic virtual void Prepare();
ParserCreationException
- if the parser couldn't be
initialized correctlyinternal void SetInitialized( bool initialized );
initialized
- the new initialized flagpublic override string ToString();
|
Grammatica 1.4 Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |