|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectantlr.LLkParser
org.antlr.tool.ANTLRParser
public class ANTLRParser
Read in an ANTLR grammar and build an AST. Try not to do any actions, just build the tree. The phases are: antlr.g (this file) assign.types.g define.g buildnfa.g antlr.print.g (optional) codegen.g Terence Parr University of San Francisco 2005
Field Summary | |
---|---|
static java.lang.String[] |
_tokenNames
|
static BitSet |
_tokenSet_0
|
static BitSet |
_tokenSet_1
|
static BitSet |
_tokenSet_10
|
static BitSet |
_tokenSet_11
|
static BitSet |
_tokenSet_12
|
static BitSet |
_tokenSet_13
|
static BitSet |
_tokenSet_14
|
static BitSet |
_tokenSet_15
|
static BitSet |
_tokenSet_16
|
static BitSet |
_tokenSet_17
|
static BitSet |
_tokenSet_18
|
static BitSet |
_tokenSet_19
|
static BitSet |
_tokenSet_2
|
static BitSet |
_tokenSet_20
|
static BitSet |
_tokenSet_21
|
static BitSet |
_tokenSet_22
|
static BitSet |
_tokenSet_23
|
static BitSet |
_tokenSet_24
|
static BitSet |
_tokenSet_25
|
static BitSet |
_tokenSet_26
|
static BitSet |
_tokenSet_27
|
static BitSet |
_tokenSet_28
|
static BitSet |
_tokenSet_29
|
static BitSet |
_tokenSet_3
|
static BitSet |
_tokenSet_30
|
static BitSet |
_tokenSet_31
|
static BitSet |
_tokenSet_32
|
static BitSet |
_tokenSet_33
|
static BitSet |
_tokenSet_34
|
static BitSet |
_tokenSet_35
|
static BitSet |
_tokenSet_36
|
static BitSet |
_tokenSet_37
|
static BitSet |
_tokenSet_38
|
static BitSet |
_tokenSet_39
|
static BitSet |
_tokenSet_4
|
static BitSet |
_tokenSet_5
|
static BitSet |
_tokenSet_6
|
static BitSet |
_tokenSet_7
|
static BitSet |
_tokenSet_8
|
static BitSet |
_tokenSet_9
|
protected GrammarAST |
currentBlockAST
|
protected java.lang.String |
currentRuleName
|
protected int |
gtype
|
protected java.util.List |
lexerRuleNames
|
Constructor Summary | |
---|---|
|
ANTLRParser(ParserSharedInputState state)
|
|
ANTLRParser(TokenBuffer tokenBuf)
|
protected |
ANTLRParser(TokenBuffer tokenBuf,
int k)
|
|
ANTLRParser(TokenStream lexer)
|
protected |
ANTLRParser(TokenStream lexer,
int k)
|
Method Summary | |
---|---|
void |
action()
Match stuff like @parser::members {int i;} |
void |
actions()
|
void |
actionScopeName()
Sometimes the scope names will collide with keywords; allow them as ids for action scopes. |
void |
alternative()
|
void |
altList(java.util.Map opts)
|
void |
atom()
|
void |
attrScope()
|
void |
attrScopes()
|
void |
block()
Build #(BLOCK ( #(ALT ...) EOB )+ ) |
protected void |
buildTokenTypeASTClassMap()
|
void |
cleanup(GrammarAST root)
|
protected GrammarAST |
createBlockFromDupAlt(GrammarAST alt)
Create a copy of the alt and make it into a BLOCK; all actions, labels, tree operators, rewrites are removed. |
GrammarAST |
createSimpleRuleAST(java.lang.String name,
GrammarAST block,
boolean fragment)
|
protected GrammarAST |
createSynSemPredFromBlock(GrammarAST synpredBlockAST,
int synpredTokenType)
|
void |
ebnf()
matches ENBF blocks (and sets via block rule) |
GrammarAST |
ebnfSuffix(GrammarAST elemAST,
boolean inRewrite)
|
void |
element()
|
void |
elementNoOptionSpec()
|
void |
exceptionGroup()
|
void |
exceptionHandler()
|
void |
finallyClause()
|
java.util.List |
getLexerRuleNames()
|
void |
grammar(Grammar g)
|
void |
grammarType()
|
void |
id()
|
void |
idList()
|
void |
idToken()
Match anything that looks like an ID and return tree as token type ID |
void |
notSet()
|
void |
notTerminal()
|
void |
option(java.util.Map opts)
|
java.util.Map |
optionsSpec()
|
java.lang.Object |
optionValue()
|
protected void |
prefixWithSynPred(GrammarAST alt)
Rewrite alt to have a synpred as first element; (xxx)=>xxx but only if they didn't specify one manually. |
void |
range()
|
void |
reportError(RecognitionException ex)
|
void |
rewrite_alternative()
|
void |
rewrite_atom()
|
void |
rewrite_block()
|
void |
rewrite_ebnf()
|
void |
rewrite_element()
|
void |
rewrite_indirect_template_head()
-> ({expr})(a={...}, ...) |
void |
rewrite_template_arg()
|
void |
rewrite_template_args()
|
void |
rewrite_template_head()
-> foo(a={...}, ...) |
void |
rewrite_template()
Build a tree for a template rewrite: ^(TEMPLATE (ID|ACTION) ^(ARGLIST ^(ARG ID ACTION) ...) ) where ARGLIST is always there even if no args exist. |
void |
rewrite_tree()
|
void |
rewrite()
|
void |
rule()
|
void |
ruleAction()
Match stuff like @init {int i;} |
void |
ruleActions()
|
void |
rules()
|
void |
ruleScopeSpec()
|
protected GrammarAST |
setToBlockWithSet(GrammarAST b)
|
void |
terminal()
|
void |
throwsSpec()
|
void |
tokenSpec()
|
void |
tokensSpec()
|
void |
tree()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected int gtype
protected java.lang.String currentRuleName
protected GrammarAST currentBlockAST
protected java.util.List lexerRuleNames
public static final java.lang.String[] _tokenNames
public static final BitSet _tokenSet_0
public static final BitSet _tokenSet_1
public static final BitSet _tokenSet_2
public static final BitSet _tokenSet_3
public static final BitSet _tokenSet_4
public static final BitSet _tokenSet_5
public static final BitSet _tokenSet_6
public static final BitSet _tokenSet_7
public static final BitSet _tokenSet_8
public static final BitSet _tokenSet_9
public static final BitSet _tokenSet_10
public static final BitSet _tokenSet_11
public static final BitSet _tokenSet_12
public static final BitSet _tokenSet_13
public static final BitSet _tokenSet_14
public static final BitSet _tokenSet_15
public static final BitSet _tokenSet_16
public static final BitSet _tokenSet_17
public static final BitSet _tokenSet_18
public static final BitSet _tokenSet_19
public static final BitSet _tokenSet_20
public static final BitSet _tokenSet_21
public static final BitSet _tokenSet_22
public static final BitSet _tokenSet_23
public static final BitSet _tokenSet_24
public static final BitSet _tokenSet_25
public static final BitSet _tokenSet_26
public static final BitSet _tokenSet_27
public static final BitSet _tokenSet_28
public static final BitSet _tokenSet_29
public static final BitSet _tokenSet_30
public static final BitSet _tokenSet_31
public static final BitSet _tokenSet_32
public static final BitSet _tokenSet_33
public static final BitSet _tokenSet_34
public static final BitSet _tokenSet_35
public static final BitSet _tokenSet_36
public static final BitSet _tokenSet_37
public static final BitSet _tokenSet_38
public static final BitSet _tokenSet_39
Constructor Detail |
---|
protected ANTLRParser(TokenBuffer tokenBuf, int k)
public ANTLRParser(TokenBuffer tokenBuf)
protected ANTLRParser(TokenStream lexer, int k)
public ANTLRParser(TokenStream lexer)
public ANTLRParser(ParserSharedInputState state)
Method Detail |
---|
public java.util.List getLexerRuleNames()
protected GrammarAST setToBlockWithSet(GrammarAST b)
protected GrammarAST createBlockFromDupAlt(GrammarAST alt)
protected void prefixWithSynPred(GrammarAST alt)
protected GrammarAST createSynSemPredFromBlock(GrammarAST synpredBlockAST, int synpredTokenType)
public GrammarAST createSimpleRuleAST(java.lang.String name, GrammarAST block, boolean fragment)
public void reportError(RecognitionException ex)
public void cleanup(GrammarAST root)
public final void grammar(Grammar g) throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void grammarType() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void id() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final java.util.Map optionsSpec() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void tokensSpec() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void attrScopes() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void actions() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void rules() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void action() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void actionScopeName() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void option(java.util.Map opts) throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final java.lang.Object optionValue() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void tokenSpec() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void attrScope() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void rule() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void throwsSpec() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void ruleScopeSpec() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void ruleActions() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void altList(java.util.Map opts) throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void exceptionGroup() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void ruleAction() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void idList() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void block() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void alternative() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void rewrite() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void element() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void exceptionHandler() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void finallyClause() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void elementNoOptionSpec() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void atom() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final GrammarAST ebnfSuffix(GrammarAST elemAST, boolean inRewrite) throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void ebnf() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void tree() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void range() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void terminal() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void notSet() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void notTerminal() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void idToken() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void rewrite_alternative() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void rewrite_block() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void rewrite_template() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void rewrite_element() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void rewrite_atom() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void rewrite_ebnf() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void rewrite_tree() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void rewrite_template_head() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void rewrite_indirect_template_head() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void rewrite_template_args() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
public final void rewrite_template_arg() throws RecognitionException, TokenStreamException
RecognitionException
TokenStreamException
protected void buildTokenTypeASTClassMap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |