/** 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); } }
/** 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(); }
/** 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(); }
public Grammar(Tool tool) { setTool(tool); builtFromString = true; composite = new CompositeGrammar(this); STGroup lexerGrammarSTG = new STGroupString(lexerGrammarTemplate); lexerGrammarST = lexerGrammarSTG.getInstanceOf("grammar"); target = CodeGenerator.loadLanguageTarget((String)getOption("language")); }
public Grammar(Tool tool) { setTool(tool); builtFromString = true; composite = new CompositeGrammar(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")); }
/** 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; }
lexer.importTokenVocabulary(parser); lexer.fileName = grammarFileName; lexer.setTool(tool); if ( lexerGrammarText!=null ) { lexer.setGrammarContent(lexerGrammarText);
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; }
lexer.importTokenVocabulary(parser); lexer.fileName = grammarFileName; lexer.setTool(tool); if ( lexerGrammarText!=null ) { lexer.setGrammarContent(lexerGrammarText);
lexer.importTokenVocabulary(parser); lexer.fileName = grammarFileName; lexer.setTool(tool); if ( lexerGrammarText!=null ) { lexer.setGrammarContent(lexerGrammarText);
lexer.importTokenVocabulary(parser); lexer.fileName = grammarFileName; lexer.setTool(tool); if ( lexerGrammarText!=null ) { lexer.setGrammarContent(lexerGrammarText);
lexerGrammar.composite.watchNFAConversion = internalOption_watchNFAConversion; lexerGrammar.implicitLexer = true; lexerGrammar.setTool(this); File lexerGrammarFullFile = new File(getFileDirectory(lexerGrammarFileName), lexerGrammarFileName);
lexerGrammar.composite.watchNFAConversion = internalOption_watchNFAConversion; lexerGrammar.implicitLexer = true; lexerGrammar.setTool(this); File lexerGrammarFullFile = new File(getFileDirectory(lexerGrammarFileName), lexerGrammarFileName);