| |
|
| net.percederberg.grammatica.GrammarAnalyzer net.percederberg.grammatica.FirstPassAnalyzer
FirstPassAnalyzer | class FirstPassAnalyzer extends GrammarAnalyzer (Code) | | A first pass grammar analyzer. This class processes the grammar
parse tree and creates the token and production patterns. Both
token and production patterns are added to the grammar, but the
production patterns will all be empty. In order to analyze the
production pattern rules, all the production pattern names and
identifiers must be present in the grammar, so the pattern rules
must be analyzed in a second pass. This analyzer also adds all
header declarations to the grammar.
author: Per Cederberg, version: 1.0 |
FirstPassAnalyzer | public FirstPassAnalyzer(Grammar grammar)(Code) | | Creates a new grammar analyser.
Parameters: grammar - the grammar where objects are added |
exitError | protected Node exitError(Token node)(Code) | | Sets the node value to the error message. If no message is set,
no node value will be added.
Parameters: node - the token node the token node |
exitHeaderDeclaration | protected Node exitHeaderDeclaration(Production node) throws ParseException(Code) | | Adds the header declaration to the grammar. This method will
also remove the header declaration from the parse tree by
returning null.
Parameters: node - the production node the new production node throws: ParseException - if the node analysis discovered errors |
exitHeaderPart | protected Node exitHeaderPart(Production node)(Code) | | Removes the header part from the parse tree by returning null.
Parameters: node - the production node the new production node |
exitIdentifier | protected Node exitIdentifier(Token node)(Code) | | Sets the node value to the identifier string.
Parameters: node - the token node the token node |
exitIgnore | protected Node exitIgnore(Token node)(Code) | | Sets the node value to the ignore message. If no message is
set, no node value will be added.
Parameters: node - the token node the token node |
exitProductionDeclaration | protected Node exitProductionDeclaration(Production node) throws ParseException(Code) | | Adds an empty production pattern to the grammar. This metod
will return the production node to make it available for the
second pass analyzer.
Parameters: node - the production node the new production node throws: ParseException - if the node analysis discovered errors |
exitQuotedString | protected Node exitQuotedString(Token node)(Code) | | Sets the node value to the contents of the quoted string. The
quotation marks will be removed, but any escaped character
will be left intact.
Parameters: node - the token node the token node |
exitRegexp | protected Node exitRegexp(Token node)(Code) | | Sets the node value to the regular expression string. The
quotation marks will be removed, and the "\<" and "\>" will be
unescaped (replaced by the '<' and '>' characters). The rest of
the expression is left intact.
Parameters: node - the token node the token node |
exitTokenDeclaration | protected Node exitTokenDeclaration(Production node) throws ParseException(Code) | | Adds a token pattern to the grammar. This method will also
remove the token declaration from the parse tree by reutrning
null.
Parameters: node - the production node the new production node throws: ParseException - if the node analysis discovered errors |
exitTokenHandling | protected Node exitTokenHandling(Production node) throws ParseException(Code) | | Sets the node values to the error or ignore token. If present,
the message string will also be added as a node value.
Parameters: node - the production node the new production node throws: ParseException - if the node analysis discovered errors |
exitTokenPart | protected Node exitTokenPart(Production node)(Code) | | Removes the token part from the parse tree by returning null.
Parameters: node - the production node the new production node |
exitTokenValue | protected Node exitTokenValue(Production node) throws ParseException(Code) | | Sets the node values to the token pattern type and the token
pattern string.
Parameters: node - the production node the new production node throws: ParseException - if the node analysis discovered errors |
Methods inherited from net.percederberg.grammatica.GrammarAnalyzer | protected void child(Production node, Node child) throws ParseException(Code)(Java Doc) protected void childGrammar(Production node, Node child) throws ParseException(Code)(Java Doc) protected void childHeaderDeclaration(Production node, Node child) throws ParseException(Code)(Java Doc) protected void childHeaderPart(Production node, Node child) throws ParseException(Code)(Java Doc) protected void childProduction(Production node, Node child) throws ParseException(Code)(Java Doc) protected void childProductionAtom(Production node, Node child) throws ParseException(Code)(Java Doc) protected void childProductionDeclaration(Production node, Node child) throws ParseException(Code)(Java Doc) protected void childProductionPart(Production node, Node child) throws ParseException(Code)(Java Doc) protected void childTokenDeclaration(Production node, Node child) throws ParseException(Code)(Java Doc) protected void childTokenHandling(Production node, Node child) throws ParseException(Code)(Java Doc) protected void childTokenPart(Production node, Node child) throws ParseException(Code)(Java Doc) protected void childTokenValue(Production node, Node child) throws ParseException(Code)(Java Doc) protected void enter(Node node) throws ParseException(Code)(Java Doc) protected void enterAsterisk(Token node) throws ParseException(Code)(Java Doc) protected void enterEquals(Token node) throws ParseException(Code)(Java Doc) protected void enterError(Token node) throws ParseException(Code)(Java Doc) protected void enterGrammar(Production node) throws ParseException(Code)(Java Doc) protected void enterHeader(Token node) throws ParseException(Code)(Java Doc) protected void enterHeaderDeclaration(Production node) throws ParseException(Code)(Java Doc) protected void enterHeaderPart(Production node) throws ParseException(Code)(Java Doc) protected void enterIdentifier(Token node) throws ParseException(Code)(Java Doc) protected void enterIgnore(Token node) throws ParseException(Code)(Java Doc) protected void enterLeftBrace(Token node) throws ParseException(Code)(Java Doc) protected void enterLeftBracket(Token node) throws ParseException(Code)(Java Doc) protected void enterLeftParen(Token node) throws ParseException(Code)(Java Doc) protected void enterPlusSign(Token node) throws ParseException(Code)(Java Doc) protected void enterProduction(Production node) throws ParseException(Code)(Java Doc) protected void enterProductionAtom(Production node) throws ParseException(Code)(Java Doc) protected void enterProductionDeclaration(Production node) throws ParseException(Code)(Java Doc) protected void enterProductionPart(Production node) throws ParseException(Code)(Java Doc) protected void enterProductions(Token node) throws ParseException(Code)(Java Doc) protected void enterQuestionMark(Token node) throws ParseException(Code)(Java Doc) protected void enterQuotedString(Token node) throws ParseException(Code)(Java Doc) protected void enterRegexp(Token node) throws ParseException(Code)(Java Doc) protected void enterRightBrace(Token node) throws ParseException(Code)(Java Doc) protected void enterRightBracket(Token node) throws ParseException(Code)(Java Doc) protected void enterRightParen(Token node) throws ParseException(Code)(Java Doc) protected void enterSemicolon(Token node) throws ParseException(Code)(Java Doc) protected void enterTokenDeclaration(Production node) throws ParseException(Code)(Java Doc) protected void enterTokenHandling(Production node) throws ParseException(Code)(Java Doc) protected void enterTokenPart(Production node) throws ParseException(Code)(Java Doc) protected void enterTokenValue(Production node) throws ParseException(Code)(Java Doc) protected void enterTokens(Token node) throws ParseException(Code)(Java Doc) protected void enterUnterminatedDirective(Token node) throws ParseException(Code)(Java Doc) protected void enterVerticalBar(Token node) throws ParseException(Code)(Java Doc) protected Node exit(Node node) throws ParseException(Code)(Java Doc) protected Node exitAsterisk(Token node) throws ParseException(Code)(Java Doc) protected Node exitEquals(Token node) throws ParseException(Code)(Java Doc) protected Node exitError(Token node) throws ParseException(Code)(Java Doc) protected Node exitGrammar(Production node) throws ParseException(Code)(Java Doc) protected Node exitHeader(Token node) throws ParseException(Code)(Java Doc) protected Node exitHeaderDeclaration(Production node) throws ParseException(Code)(Java Doc) protected Node exitHeaderPart(Production node) throws ParseException(Code)(Java Doc) protected Node exitIdentifier(Token node) throws ParseException(Code)(Java Doc) protected Node exitIgnore(Token node) throws ParseException(Code)(Java Doc) protected Node exitLeftBrace(Token node) throws ParseException(Code)(Java Doc) protected Node exitLeftBracket(Token node) throws ParseException(Code)(Java Doc) protected Node exitLeftParen(Token node) throws ParseException(Code)(Java Doc) protected Node exitPlusSign(Token node) throws ParseException(Code)(Java Doc) protected Node exitProduction(Production node) throws ParseException(Code)(Java Doc) protected Node exitProductionAtom(Production node) throws ParseException(Code)(Java Doc) protected Node exitProductionDeclaration(Production node) throws ParseException(Code)(Java Doc) protected Node exitProductionPart(Production node) throws ParseException(Code)(Java Doc) protected Node exitProductions(Token node) throws ParseException(Code)(Java Doc) protected Node exitQuestionMark(Token node) throws ParseException(Code)(Java Doc) protected Node exitQuotedString(Token node) throws ParseException(Code)(Java Doc) protected Node exitRegexp(Token node) throws ParseException(Code)(Java Doc) protected Node exitRightBrace(Token node) throws ParseException(Code)(Java Doc) protected Node exitRightBracket(Token node) throws ParseException(Code)(Java Doc) protected Node exitRightParen(Token node) throws ParseException(Code)(Java Doc) protected Node exitSemicolon(Token node) throws ParseException(Code)(Java Doc) protected Node exitTokenDeclaration(Production node) throws ParseException(Code)(Java Doc) protected Node exitTokenHandling(Production node) throws ParseException(Code)(Java Doc) protected Node exitTokenPart(Production node) throws ParseException(Code)(Java Doc) protected Node exitTokenValue(Production node) throws ParseException(Code)(Java Doc) protected Node exitTokens(Token node) throws ParseException(Code)(Java Doc) protected Node exitUnterminatedDirective(Token node) throws ParseException(Code)(Java Doc) protected Node exitVerticalBar(Token node) throws ParseException(Code)(Java Doc)
|
|
|
|