/** Given the raw AST of a grammar, create a grammar object associated with the AST. Once we have the grammar object, ensure that all nodes in tree referred to this grammar. Later, we will use it for error handling and generally knowing from where a rule comes from. */ public Grammar createGrammar(GrammarRootAST ast) { final Grammar g; if ( ast.grammarType==ANTLRParser.LEXER ) g = new LexerGrammar(this, ast); else g = new Grammar(this, ast); // ensure each node has pointer to surrounding grammar GrammarTransformPipeline.setGrammarPtr(g, ast); return g; }
/** Given the raw AST of a grammar, create a grammar object associated with the AST. Once we have the grammar object, ensure that all nodes in tree referred to this grammar. Later, we will use it for error handling and generally knowing from where a rule comes from. */ public Grammar createGrammar(GrammarRootAST ast) { final Grammar g; if ( ast.grammarType==ANTLRParser.LEXER ) g = new LexerGrammar(this, ast); else g = new Grammar(this, ast); // ensure each node has pointer to surrounding grammar GrammarTransformPipeline.setGrammarPtr(g, ast); return g; }
/** Given the raw AST of a grammar, create a grammar object associated with the AST. Once we have the grammar object, ensure that all nodes in tree referred to this grammar. Later, we will use it for error handling and generally knowing from where a rule comes from. */ public Grammar createGrammar(GrammarRootAST ast) { final Grammar g; if ( ast.grammarType==ANTLRParser.LEXER ) g = new LexerGrammar(this, ast); else g = new Grammar(this, ast); // ensure each node has pointer to surrounding grammar GrammarTransformPipeline.setGrammarPtr(g, ast); return g; }
/** Given the raw AST of a grammar, create a grammar object associated with the AST. Once we have the grammar object, ensure that all nodes in tree referred to this grammar. Later, we will use it for error handling and generally knowing from where a rule comes from. */ public Grammar createGrammar(GrammarRootAST ast) { final Grammar g; if ( ast.grammarType==ANTLRParser.LEXER ) g = new LexerGrammar(this, ast); else g = new Grammar(this, ast); // ensure each node has pointer to surrounding grammar GrammarTransformPipeline.setGrammarPtr(g, ast); return g; }
/** Given the raw AST of a grammar, create a grammar object associated with the AST. Once we have the grammar object, ensure that all nodes in tree referred to this grammar. Later, we will use it for error handling and generally knowing from where a rule comes from. */ public Grammar createGrammar(GrammarRootAST ast) { final Grammar g; if ( ast.grammarType==ANTLRParser.LEXER ) g = new LexerGrammar(this, ast); else g = new Grammar(this, ast); // ensure each node has pointer to surrounding grammar GrammarTransformPipeline.setGrammarPtr(g, ast); return g; }
ParsingUtils.BAD_PARSER_GRAMMAR = new Grammar("grammar BAD; a : 'bad' ;"); ParsingUtils.BAD_PARSER_GRAMMAR.name = "BAD_PARSER_GRAMMAR"; ParsingUtils.BAD_LEXER_GRAMMAR = new LexerGrammar("lexer grammar BADLEXER; A : 'bad' ;");