Package org.antlr.grammar.v2
Class TreeToNFAConverter
java.lang.Object
antlr.TreeParser
org.antlr.grammar.v2.TreeToNFAConverter
- All Implemented Interfaces:
TreeToNFAConverterTokenTypes
Build an NFA from a tree representing an ANTLR grammar.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]
static final antlr.collections.impl.BitSet
protected int
protected String
protected NFAFactory
Factory used to create nodes and submachinesprotected Grammar
Which grammar are we converting an NFA for?protected NFA
Which NFA object are we filling in?protected int
Fields inherited from class antlr.TreeParser
_retTree, astFactory, ASTNULL, inputState, returnAST, tokenNames, traceDepth
Fields inherited from interface org.antlr.grammar.v2.TreeToNFAConverterTokenTypes
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 TypeMethodDescriptionprotected void
addFollowTransition
(String ruleName, NFAState following) final StateCluster
alternative
(antlr.collections.AST _t) final void
ast_suffix
(antlr.collections.AST _t) final StateCluster
final StateCluster
atom_or_notatom
(antlr.collections.AST _t) final void
attrScope
(antlr.collections.AST _t) final StateCluster
block
(antlr.collections.AST _t) final StateCluster
ebnf
(antlr.collections.AST _t) final StateCluster
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) protected void
finish()
final void
grammar
(antlr.collections.AST _t) final void
grammarSpec
(antlr.collections.AST _t) private static final long[]
final void
modifier
(antlr.collections.AST _t) void
reportError
(antlr.RecognitionException ex) final void
rewrite
(antlr.collections.AST _t) final void
rule
(antlr.collections.AST _t) final void
rules
(antlr.collections.AST _t) final void
ruleScopeSpec
(antlr.collections.AST _t) final StateCluster
set
(antlr.collections.AST _t) final void
setElement
(antlr.collections.AST _t, IntSet elements) final IntSet
setRule
(antlr.collections.AST _t) final void
testBlockAsSet
(antlr.collections.AST _t) Check to see if this block can be a set.final void
testSetElement
(antlr.collections.AST _t) Match just an element; no ast suffix etc..final void
testSetRule
(antlr.collections.AST _t) final StateCluster
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
-
factory
Factory used to create nodes and submachines -
nfa
Which NFA object are we filling in? -
grammar
Which grammar are we converting an NFA for? -
currentRuleName
-
outerAltNum
protected int outerAltNum -
blockLevel
protected int blockLevel -
_tokenNames
-
_tokenSet_0
public static final antlr.collections.impl.BitSet _tokenSet_0
-
-
Constructor Details
-
TreeToNFAConverter
-
TreeToNFAConverter
public TreeToNFAConverter()
-
-
Method Details
-
addFollowTransition
-
finish
protected void finish() -
reportError
public void reportError(antlr.RecognitionException ex) - Overrides:
reportError
in classantlr.TreeParser
-
grammar
public final void grammar(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
grammarSpec
public final void grammarSpec(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
attrScope
public final void attrScope(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
-
rule
public final void rule(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
-
block
- Throws:
antlr.RecognitionException
-
exceptionGroup
public final void exceptionGroup(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
set
- Throws:
antlr.RecognitionException
-
alternative
- Throws:
antlr.RecognitionException
-
rewrite
public final void rewrite(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
element
- 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
-
atom
public final StateCluster atom(antlr.collections.AST _t, String scopeName) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
atom_or_notatom
public final StateCluster atom_or_notatom(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
ebnf
- Throws:
antlr.RecognitionException
-
tree
- Throws:
antlr.RecognitionException
-
ast_suffix
public final void ast_suffix(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
setElement
public final void setElement(antlr.collections.AST _t, IntSet elements) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
setRule
- Throws:
antlr.RecognitionException
-
testBlockAsSet
public final void testBlockAsSet(antlr.collections.AST _t) throws antlr.RecognitionException Check to see if this block can be a set. Can't have actions etc... Also can't be in a rule with a rewrite as we need to track what's inside set for use in rewrite.- Throws:
antlr.RecognitionException
-
testSetElement
public final void testSetElement(antlr.collections.AST _t) throws antlr.RecognitionException Match just an element; no ast suffix etc..- Throws:
antlr.RecognitionException
-
testSetRule
public final void testSetRule(antlr.collections.AST _t) throws antlr.RecognitionException - Throws:
antlr.RecognitionException
-
mk_tokenSet_0
private static final long[] mk_tokenSet_0()
-