Package org.antlr.grammar.v2
Class ANTLRTreePrinter
java.lang.Object
antlr.TreeParser
org.antlr.grammar.v2.ANTLRTreePrinter
- All Implemented Interfaces:
ANTLRTreePrinterTokenTypes
Print out a grammar (no pretty printing).
Terence Parr
University of San Francisco
August 19, 2003
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]
protected StringBuffer
protected Grammar
protected boolean
Fields inherited from class antlr.TreeParser
_retTree, astFactory, ASTNULL, inputState, returnAST, tokenNames, traceDepth
Fields inherited from interface org.antlr.grammar.v2.ANTLRTreePrinterTokenTypes
ACTION, ACTION_CHAR_LITERAL, ACTION_ESC, ACTION_STRING_LITERAL, ALT, AMPERSAND, ARG, ARG_ACTION, ARGLIST, ASSIGN, BACKTRACK_SEMPRED, BANG, BLOCK, CHAR_LITERAL, CHAR_RANGE, CLOSE_ELEMENT_OPTION, CLOSURE, COLON, COMBINED_GRAMMAR, COMMA, COMMENT, DIGIT, DOC_COMMENT, DOLLAR, DOT, DOUBLE_ANGLE_STRING_LITERAL, DOUBLE_QUOTE_STRING_LITERAL, EOA, EOB, EOF, EOR, EPSILON, ESC, ETC, FORCED_ACTION, FRAGMENT, GATED_SEMPRED, ID, IMPLIES, IMPORT, INITACTION, INT, INTERNAL_RULE_REF, LABEL, LEXER, LEXER_GRAMMAR, LITERAL_catch, LITERAL_finally, LITERAL_grammar, LITERAL_lexer, LITERAL_private, LITERAL_protected, LITERAL_public, LITERAL_returns, LITERAL_throws, LITERAL_tree, LPAREN, ML_COMMENT, NESTED_ACTION, NESTED_ARG_ACTION, NOT, NULL_TREE_LOOKAHEAD, OPEN_ELEMENT_OPTION, OPTIONAL, OPTIONS, OR, PARSER, PARSER_GRAMMAR, PLUS, PLUS_ASSIGN, POSITIVE_CLOSURE, QUESTION, RANGE, RCURLY, RET, REWRITE, ROOT, RPAREN, RULE, RULE_REF, SCOPE, SEMI, SEMPRED, SL_COMMENT, SRC, STAR, STRAY_BRACKET, STRING_LITERAL, SYN_SEMPRED, SYNPRED, TEMPLATE, TOKEN_REF, TOKENS, TREE_BEGIN, TREE_GRAMMAR, WILDCARD, WS, WS_LOOP, WS_OPT, XDIGIT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
action
(antlr.collections.AST _t) final void
actions
(antlr.collections.AST _t) final void
alternative
(antlr.collections.AST _t) final void
ast_suffix
(antlr.collections.AST _t) final void
atom
(antlr.collections.AST _t) final void
attrScope
(antlr.collections.AST _t) final void
block
(antlr.collections.AST _t, boolean forceParens) final int
countAltsForBlock
(antlr.collections.AST _t) final void
delegateGrammars
(antlr.collections.AST _t) final void
ebnf
(antlr.collections.AST _t) final void
element
(antlr.collections.AST _t) final void
exceptionGroup
(antlr.collections.AST _t) final void
exceptionHandler
(antlr.collections.AST _t) final void
finallyClause
(antlr.collections.AST _t) final void
grammar
(antlr.collections.AST _t) final void
grammarSpec
(antlr.collections.AST _t, String gtype) final void
modifier
(antlr.collections.AST _t) static String
Normalize a grammar print out by removing all double spaces and trailing/beginning stuff.final void
option
(antlr.collections.AST _t) final void
optionsSpec
(antlr.collections.AST _t) final void
optionValue
(antlr.collections.AST _t) void
void
reportError
(antlr.RecognitionException ex) final void
rewrite
(antlr.collections.AST _t) final void
rewrite_template
(antlr.collections.AST _t) final void
rule
(antlr.collections.AST _t) final void
ruleAction
(antlr.collections.AST _t) final void
rules
(antlr.collections.AST _t) final void
ruleScopeSpec
(antlr.collections.AST _t) final void
single_rewrite
(antlr.collections.AST _t) final void
tokenSpec
(antlr.collections.AST _t) final void
tokensSpec
(antlr.collections.AST _t) final String
Call this to figure out how to printfinal void
tree
(antlr.collections.AST _t) Methods inherited from class antlr.TreeParser
getAST, getASTFactory, getTokenName, getTokenNames, match, match, matchNot, panic, reportError, reportWarning, setASTFactory, setASTNodeClass, setASTNodeType, traceIn, traceIndent, traceOut
-
Field Details
-
grammar
-
showActions
protected boolean showActions -
buf
-
_tokenNames
-
-
Constructor Details
-
ANTLRTreePrinter
public ANTLRTreePrinter()
-
-
Method Details
-
out
-
reportError
public void reportError(antlr.RecognitionException ex) - Overrides:
reportError
in classantlr.TreeParser
-
normalize
Normalize a grammar print out by removing all double spaces and trailing/beginning stuff. FOr example, convert ( A | B | C )* to ( A | B | C )* -
toString
public final String toString(antlr.collections.AST _t, Grammar g, boolean showActions) throws antlr.RecognitionException Call this to figure out how to print- Throws:
antlr.RecognitionException
-
grammar
public final void grammar(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
rule
public final void rule(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
alternative
public final void alternative(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
element
public final void element(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
single_rewrite
public final void single_rewrite(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
grammarSpec
public final void grammarSpec(antlr.collections.AST _t, String gtype) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
attrScope
public final void attrScope(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
optionsSpec
public final void optionsSpec(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
delegateGrammars
public final void delegateGrammars(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
tokensSpec
public final void tokensSpec(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
actions
public final void actions(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
rules
public final void rules(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
action
public final void action(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
option
public final void option(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
optionValue
public final void optionValue(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
tokenSpec
public final void tokenSpec(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
modifier
public final void modifier(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
ruleScopeSpec
public final void ruleScopeSpec(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
ruleAction
public final void ruleAction(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
block
public final void block(antlr.collections.AST _t, boolean forceParens) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
exceptionGroup
public final void exceptionGroup(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
rewrite
public final void rewrite(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
countAltsForBlock
public final int countAltsForBlock(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
exceptionHandler
public final void exceptionHandler(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
finallyClause
public final void finallyClause(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
rewrite_template
public final void rewrite_template(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
atom
public final void atom(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
ebnf
public final void ebnf(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
tree
public final void tree(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
ast_suffix
public final void ast_suffix(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-