C# Class Spring.Expressions.Parser.antlr.debug.ParseTreeDebugParser

Specifies the behaviour required (i.e. parser modifications) specifically to support parse tree debugging and derivation.

Override the standard matching and rule entry/exit routines to build parse trees. This class is useful for 2.7.3 where you can specify a superclass like

class TinyCParser extends Parser(ParseTreeDebugParser);

Inheritance: antlr.LLkParser
Afficher le fichier Open project: spring-projects/spring-net

Protected Properties

Свойство Type Description
currentParseTreeRoot System.Collections.Stack
mostRecentParseTreeRoot antlr.ParseTreeRule
numberOfDerivationSteps int

Méthodes publiques

Méthode Description
ParseTreeDebugParser ( antlr.ParserSharedInputState state, int k_ ) : antlr
ParseTreeDebugParser ( antlr.TokenBuffer tokenBuf, int k_ ) : antlr
ParseTreeDebugParser ( TokenStream lexer, int k_ ) : antlr
ParseTreeDebugParser ( int k_ ) : antlr
getNumberOfDerivationSteps ( ) : int
getParseTree ( ) : antlr.ParseTree
match ( antlr.collections.impl.BitSet bitSet ) : void
match ( int i ) : void
matchNot ( int i ) : void
traceIn ( string s ) : void

Create a rule node, add to current tree, and make it current root

traceOut ( string s ) : void

Pop current root; back to adding to old root

Méthodes protégées

Méthode Description
addCurrentTokenToParseTree ( ) : void

Adds LT(1) to the current parse subtree.

Note that the match() routines add the node before checking for correct match. This means that, upon mismatched token, there will a token node in the tree corresponding to where that token was expected. For no viable alternative errors, no node will be in the tree as nothing was matched() (the lookahead failed to predict an alternative).

Method Details

ParseTreeDebugParser() public méthode

public ParseTreeDebugParser ( antlr.ParserSharedInputState state, int k_ ) : antlr
state antlr.ParserSharedInputState
k_ int
Résultat antlr

ParseTreeDebugParser() public méthode

public ParseTreeDebugParser ( antlr.TokenBuffer tokenBuf, int k_ ) : antlr
tokenBuf antlr.TokenBuffer
k_ int
Résultat antlr

ParseTreeDebugParser() public méthode

public ParseTreeDebugParser ( TokenStream lexer, int k_ ) : antlr
lexer TokenStream
k_ int
Résultat antlr

ParseTreeDebugParser() public méthode

public ParseTreeDebugParser ( int k_ ) : antlr
k_ int
Résultat antlr

addCurrentTokenToParseTree() protected méthode

Adds LT(1) to the current parse subtree.

Note that the match() routines add the node before checking for correct match. This means that, upon mismatched token, there will a token node in the tree corresponding to where that token was expected. For no viable alternative errors, no node will be in the tree as nothing was matched() (the lookahead failed to predict an alternative).

protected addCurrentTokenToParseTree ( ) : void
Résultat void

getNumberOfDerivationSteps() public méthode

public getNumberOfDerivationSteps ( ) : int
Résultat int

getParseTree() public méthode

public getParseTree ( ) : antlr.ParseTree
Résultat antlr.ParseTree

match() public méthode

public match ( antlr.collections.impl.BitSet bitSet ) : void
bitSet antlr.collections.impl.BitSet
Résultat void

match() public méthode

public match ( int i ) : void
i int
Résultat void

matchNot() public méthode

public matchNot ( int i ) : void
i int
Résultat void

traceIn() public méthode

Create a rule node, add to current tree, and make it current root
public traceIn ( string s ) : void
s string
Résultat void

traceOut() public méthode

Pop current root; back to adding to old root
public traceOut ( string s ) : void
s string
Résultat void

Property Details

currentParseTreeRoot protected_oe property

Each new rule invocation must have it's own subtree. Tokens are added to the current root so we must have a stack of subtree roots.
protected System.Collections.Stack currentParseTreeRoot
Résultat System.Collections.Stack

mostRecentParseTreeRoot protected_oe property

Track most recently created parse subtree so that when parsing is finished, we can get to the root.
protected ParseTreeRule,antlr mostRecentParseTreeRoot
Résultat antlr.ParseTreeRule

numberOfDerivationSteps protected_oe property

For every rule replacement with a production, we bump up count.
protected int numberOfDerivationSteps
Résultat int