| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static void | |
| public GrammarAST | |
| public 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. |
| public 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. |
| public void | integrateImportedGrammars(Grammar rootGrammar)
Merge all the rules, token definitions, and named actions from imported grammars into the root grammar tree. |
| public void | |
| public void | |
| public static void |
| GrammarTransformPipeline | back to summary |
|---|---|
| public GrammarTransformPipeline(Grammar g, Tool tool) | |
| augmentTokensWithOriginalPosition | back to summary |
|---|---|
| public static void augmentTokensWithOriginalPosition(final Grammar g, GrammarAST tree) | |
| expandParameterizedLoop | back to summary |
|---|---|
| public GrammarAST expandParameterizedLoop(GrammarAST t) | |
| expandParameterizedLoops | back to summary |
|---|---|
| public 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. Todo do we want? | |
| extractImplicitLexer | back to summary |
|---|---|
| public 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. Split AST apart. We'll have this Grammar share token symbols later; don't generate tokenVocab or tokens{} section. Copy over named actions. Side-effects: it removes children from GRAMMAR & RULES nodes in combined AST. Anything cut out is dup'd before adding to lexer to avoid "who's ur daddy" issues | |
| integrateImportedGrammars | back to summary |
|---|---|
| public void integrateImportedGrammars(Grammar rootGrammar) Merge all the rules, token definitions, and named actions from imported grammars into the root grammar tree. Perform: (tokens { X (= Y 'y')) + (tokens { Z ) -> (tokens { X (= Y 'y') Z) (@ members {foo}) + (@ members {bar}) -> (@ members {foobar}) (RULES (RULE x y)) + (RULES (RULE z)) -> (RULES (RULE x y z)) Rules in root prevent same rule from being appended to RULES node. The goal is a complete combined grammar so we can ignore subordinate grammars. | |
| process | back to summary |
|---|---|
| public void process() | |
| reduceBlocksToSets | back to summary |
|---|---|
| public void reduceBlocksToSets(GrammarAST root) | |
| setGrammarPtr | back to summary |
|---|---|
| public static void setGrammarPtr(final Grammar g, GrammarAST tree) Utility visitor that sets grammar ptr in each node | |