forked from jasder/antlr
tweak to compile. strange
This commit is contained in:
parent
133b00aef9
commit
ffbdf8a36c
|
@ -1,6 +1,6 @@
|
||||||
grammar T;
|
grammar T;
|
||||||
|
|
||||||
s : rule ;
|
s : R ;
|
||||||
|
|
||||||
|
R : 'x' EOF;
|
||||||
|
|
||||||
rule : A # X
|
|
||||||
;
|
|
||||||
|
|
|
@ -279,7 +279,7 @@ public class GrammarTransformPipeline {
|
||||||
GrammarRootAST combinedAST = combinedGrammar.ast;
|
GrammarRootAST combinedAST = combinedGrammar.ast;
|
||||||
//tool.log("grammar", "before="+combinedAST.toStringTree());
|
//tool.log("grammar", "before="+combinedAST.toStringTree());
|
||||||
GrammarASTAdaptor adaptor = new GrammarASTAdaptor(combinedAST.token.getInputStream());
|
GrammarASTAdaptor adaptor = new GrammarASTAdaptor(combinedAST.token.getInputStream());
|
||||||
GrammarAST[] elements = combinedAST.getChildren().toArray(new GrammarAST[0]);
|
GrammarAST[] elements = (GrammarAST[])combinedAST.getChildren().toArray(new GrammarAST[0]);
|
||||||
|
|
||||||
// MAKE A GRAMMAR ROOT and ID
|
// MAKE A GRAMMAR ROOT and ID
|
||||||
String lexerName = combinedAST.getChild(0).getText()+"Lexer";
|
String lexerName = combinedAST.getChild(0).getText()+"Lexer";
|
||||||
|
@ -295,7 +295,7 @@ public class GrammarTransformPipeline {
|
||||||
if ( optionsRoot!=null ) {
|
if ( optionsRoot!=null ) {
|
||||||
GrammarAST lexerOptionsRoot = (GrammarAST)adaptor.dupNode(optionsRoot);
|
GrammarAST lexerOptionsRoot = (GrammarAST)adaptor.dupNode(optionsRoot);
|
||||||
lexerAST.addChild(lexerOptionsRoot);
|
lexerAST.addChild(lexerOptionsRoot);
|
||||||
GrammarAST[] options = optionsRoot.getChildren().toArray(new GrammarAST[0]);
|
GrammarAST[] options = (GrammarAST[])optionsRoot.getChildren().toArray(new GrammarAST[0]);
|
||||||
for (GrammarAST o : options) {
|
for (GrammarAST o : options) {
|
||||||
String optionName = o.getChild(0).getText();
|
String optionName = o.getChild(0).getText();
|
||||||
if ( Grammar.lexerOptions.contains(optionName) &&
|
if ( Grammar.lexerOptions.contains(optionName) &&
|
||||||
|
|
Loading…
Reference in New Issue