public virtual void Process(Grammar g, bool gencode)
{
g.LoadImportedGrammars();
GrammarTransformPipeline transform = new GrammarTransformPipeline(g, this);
transform.Process();
LexerGrammar lexerg;
GrammarRootAST lexerAST;
if (g.ast != null && g.ast.grammarType == ANTLRParser.COMBINED &&
!g.ast.hasErrors)
{
lexerAST = transform.ExtractImplicitLexer(g); // alters g.ast
if (lexerAST != null)
{
if (grammarOptions != null)
{
lexerAST.cmdLineOptions = grammarOptions;
}
lexerg = new LexerGrammar(this, lexerAST);
lexerg.fileName = g.fileName;
lexerg.originalGrammar = g;
g.implicitLexer = lexerg;
lexerg.implicitLexerOwner = g;
int prevErrors = errMgr.GetNumErrors();
ProcessNonCombinedGrammar(lexerg, gencode);
if (errMgr.GetNumErrors() > prevErrors)
{
return;
}
// System.out.println("lexer tokens="+lexerg.tokenNameToTypeMap);
// System.out.println("lexer strings="+lexerg.stringLiteralToTypeMap);
}
}
if (g.implicitLexer != null)
g.ImportVocab(g.implicitLexer);
// System.out.println("tokens="+g.tokenNameToTypeMap);
// System.out.println("strings="+g.stringLiteralToTypeMap);
ProcessNonCombinedGrammar(g, gencode);
}