public class GrammarTransformPipeline extends Object
Constructor and Description |
---|
GrammarTransformPipeline(Grammar g,
Tool tool) |
Modifier and Type | Method and Description |
---|---|
static void |
augmentTokensWithOriginalPosition(Grammar g,
GrammarAST tree) |
GrammarAST |
expandParameterizedLoop(GrammarAST t) |
void |
expandParameterizedLoops(GrammarAST root)
Find and replace
ID*[','] with ID (',' ID)*
ID+[','] with ID (',' ID)+
(x {action} y)+[','] with x {action} y (',' x {action} y)+
Parameter must be a token.
|
GrammarRootAST |
extractImplicitLexer(Grammar combinedGrammar)
Build lexer grammar from combined grammar that looks like:
(COMBINED_GRAMMAR A
(tokens { X (= Y 'y'))
(OPTIONS (= x 'y'))
(@ members {foo})
(@ lexer header {package jj;})
(RULES (RULE .+)))
Move rules and actions to new tree, don't dup.
|
void |
integrateImportedGrammars(Grammar rootGrammar)
Merge all the rules, token definitions, and named actions from
imported grammars into the root grammar tree.
|
void |
process() |
void |
reduceBlocksToSets(GrammarAST root) |
static void |
setGrammarPtr(Grammar g,
GrammarAST tree)
Utility visitor that sets grammar ptr in each node
|
public void process()
public void reduceBlocksToSets(GrammarAST root)
public void expandParameterizedLoops(GrammarAST root)
public GrammarAST expandParameterizedLoop(GrammarAST t)
public static void setGrammarPtr(Grammar g, GrammarAST tree)
public static void augmentTokensWithOriginalPosition(Grammar g, GrammarAST tree)
public void integrateImportedGrammars(Grammar rootGrammar)
public GrammarRootAST extractImplicitLexer(Grammar combinedGrammar)
Copyright © 1992–2020 ANTLR. All rights reserved.