/** Create a grammar from file name. */ public Grammar(Tool tool, String fileName, CompositeGrammar composite) { this.composite = composite; setTool(tool); setFileName(fileName); // ensure we have the composite set to something if ( composite.delegateGrammarTreeRoot==null ) { composite.setDelegationRoot(this); } }
/** Create a grammar from file name. */ public Grammar(Tool tool, String fileName, CompositeGrammar composite) { this.composite = composite; setTool(tool); setFileName(fileName); // ensure we have the composite set to something if ( composite.delegateGrammarTreeRoot==null ) { composite.setDelegationRoot(this); } target = CodeGenerator.loadLanguageTarget((String)getOption("language")); }
/** Used for testing and Interp/RandomPhrase. Only useful on * noncomposite grammars. */ public Grammar(Tool tool, String grammarString) throws antlr.RecognitionException { this(); setTool(tool); setFileName("<string>"); StringReader r = new StringReader(grammarString); parseAndBuildAST(r); composite.assignTokenTypes(); defineGrammarSymbols(); checkNameSpaceAndActions(); }
/** Used for testing and Interp/RandomPhrase. Only useful on * noncomposite grammars. */ public Grammar(Tool tool, String grammarString) throws RecognitionException { this(tool); setFileName("<string>"); StringReader r = new StringReader(grammarString); parseAndBuildAST(r); composite.assignTokenTypes(); //composite.translateLeftRecursiveRules(); addRulesForSyntacticPredicates(); composite.defineGrammarSymbols(); //composite.createNFAs(); checkNameSpaceAndActions(); }
/** Used for testing and Interp/RandomPhrase. Only useful on * noncomposite grammars. */ public Grammar(Tool tool, String grammarString) throws antlr.RecognitionException { this(); setTool(tool); setFileName("<string>"); StringReader r = new StringReader(grammarString); parseAndBuildAST(r); composite.assignTokenTypes(); defineGrammarSymbols(); checkNameSpaceAndActions(); }
/** Used for testing and Interp/RandomPhrase. Only useful on * noncomposite grammars. */ public Grammar(Tool tool, String grammarString) throws RecognitionException { this(tool); setFileName("<string>"); StringReader r = new StringReader(grammarString); parseAndBuildAST(r); composite.assignTokenTypes(); //composite.translateLeftRecursiveRules(); addRulesForSyntacticPredicates(); composite.defineGrammarSymbols(); //composite.createNFAs(); checkNameSpaceAndActions(); }
/** Create a grammar from file name. */ public Grammar(Tool tool, String fileName, CompositeGrammar composite) { this.composite = composite; setTool(tool); setFileName(fileName); // ensure we have the composite set to something if ( composite.delegateGrammarTreeRoot==null ) { composite.setDelegationRoot(this); } STGroup lexerGrammarSTG = new STGroupString(lexerGrammarTemplate); lexerGrammarST = lexerGrammarSTG.getInstanceOf("grammar"); target = CodeGenerator.loadLanguageTarget((String) getOption("language")); }
/** Create a grammar from file name. */ public Grammar(Tool tool, String fileName, CompositeGrammar composite) { this.composite = composite; setTool(tool); setFileName(fileName); // ensure we have the composite set to something if ( composite.delegateGrammarTreeRoot==null ) { composite.setDelegationRoot(this); } STGroup lexerGrammarSTG = new STGroupString(lexerGrammarTemplate); lexerGrammarST = lexerGrammarSTG.getInstanceOf("grammar"); target = CodeGenerator.loadLanguageTarget((String) getOption("language")); }
private Grammar createLexerGrammarFromCombinedGrammar(Grammar grammar) throws Exception { String lexerGrammarStr = grammar.getLexerGrammar(); if(lexerGrammarStr == null) return null; Grammar lexerGrammar = new Grammar(); lexerGrammar.implicitLexer = true; lexerGrammar.setTool(engine.getANTLRTool()); lexerGrammar.setFileName("<internally-generated-lexer>"); lexerGrammar.importTokenVocabulary(grammar); lexerGrammar.setGrammarContent(lexerGrammarStr); lexerGrammar.composite.createNFAs(); return lexerGrammar; }
private Grammar createNewGrammar() throws TokenStreamException, RecognitionException, IOException { Grammar g = new Grammar(); g.setTool(engine.getANTLRTool()); g.setFileName(engine.getGrammarFileName()); g.setGrammarContent(engine.getGrammarText()); g.composite.createNFAs(); // don't want errors from a previous grammar to interfere with this new grammar. // must reset error state otherwise analysis will not proceed if // there were previous errors. ErrorManager.resetErrorState(); return g; }
File lexerGrammarFullFile = new File(getFileDirectory(lexerGrammarFileName), lexerGrammarFileName); lexerGrammar.setFileName(lexerGrammarFullFile.toString());
File lexerGrammarFullFile = new File(getFileDirectory(lexerGrammarFileName), lexerGrammarFileName); lexerGrammar.setFileName(lexerGrammarFullFile.toString());
lexerGrammar.setFileName(lexerGrammarFullFile.toString());
lexerGrammar.setFileName(lexerGrammarFullFile.toString());
setFileName(lexer.getFilename()); // the lexer #src might change name if ( grammarTree==null || grammarTree.findFirstType(ANTLRParser.RULE)==null ) { ErrorManager.error(ErrorManager.MSG_NO_RULES, getFileName());
setFileName(lexer.getFilename()); // the lexer #src might change name if ( grammarTree==null || grammarTree.findFirstType(ANTLRParser.RULE)==null ) { ErrorManager.error(ErrorManager.MSG_NO_RULES, getFileName());
setFileName(lexer.getFileName()); // the lexer #src might change name if ( grammarTree.findFirstType(ANTLRParser.RULE)==null ) { ErrorManager.error(ErrorManager.MSG_NO_RULES, getFileName());
setFileName(lexer.getFileName()); // the lexer #src might change name if ( grammarTree.findFirstType(ANTLRParser.RULE)==null ) { ErrorManager.error(ErrorManager.MSG_NO_RULES, getFileName());