
org.antlr.v4.codegen.OutputModelFactory Maven / Gradle / Ivy
The newest version!
/*
* [The "BSD license"]
* Copyright (c) 2012 Terence Parr
* Copyright (c) 2012 Sam Harwell
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.antlr.v4.codegen;
import org.antlr.v4.codegen.model.Choice;
import org.antlr.v4.codegen.model.CodeBlockForAlt;
import org.antlr.v4.codegen.model.CodeBlockForOuterMostAlt;
import org.antlr.v4.codegen.model.LabeledOp;
import org.antlr.v4.codegen.model.Lexer;
import org.antlr.v4.codegen.model.LexerFile;
import org.antlr.v4.codegen.model.OutputModelObject;
import org.antlr.v4.codegen.model.Parser;
import org.antlr.v4.codegen.model.ParserFile;
import org.antlr.v4.codegen.model.RuleFunction;
import org.antlr.v4.codegen.model.SrcOp;
import org.antlr.v4.codegen.model.decl.CodeBlock;
import org.antlr.v4.runtime.misc.IntervalSet;
import org.antlr.v4.tool.Alternative;
import org.antlr.v4.tool.Grammar;
import org.antlr.v4.tool.Rule;
import org.antlr.v4.tool.ast.ActionAST;
import org.antlr.v4.tool.ast.BlockAST;
import org.antlr.v4.tool.ast.GrammarAST;
import java.util.List;
public interface OutputModelFactory {
Grammar getGrammar();
CodeGenerator getGenerator();
void setController(OutputModelController controller);
OutputModelController getController();
ParserFile parserFile(String fileName);
Parser parser(ParserFile file);
LexerFile lexerFile(String fileName);
Lexer lexer(LexerFile file);
RuleFunction rule(Rule r);
List rulePostamble(RuleFunction function, Rule r);
// ELEMENT TRIGGERS
CodeBlockForAlt alternative(Alternative alt, boolean outerMost);
CodeBlockForAlt finishAlternative(CodeBlockForAlt blk, List ops);
CodeBlockForAlt epsilon(Alternative alt, boolean outerMost);
List ruleRef(GrammarAST ID, GrammarAST label, GrammarAST args);
List tokenRef(GrammarAST ID, GrammarAST label, GrammarAST args);
List stringRef(GrammarAST ID, GrammarAST label);
List set(GrammarAST setAST, GrammarAST label, boolean invert);
List wildcard(GrammarAST ast, GrammarAST labelAST);
List action(ActionAST ast);
List sempred(ActionAST ast);
Choice getChoiceBlock(BlockAST blkAST, List alts, GrammarAST label);
Choice getEBNFBlock(GrammarAST ebnfRoot, List alts);
Choice getLL1ChoiceBlock(BlockAST blkAST, List alts);
Choice getComplexChoiceBlock(BlockAST blkAST, List alts);
Choice getLL1EBNFBlock(GrammarAST ebnfRoot, List alts);
Choice getComplexEBNFBlock(GrammarAST ebnfRoot, List alts);
List getLL1Test(IntervalSet look, GrammarAST blkAST);
boolean needsImplicitLabel(GrammarAST ID, LabeledOp op);
// CONTEXT INFO
OutputModelObject getRoot();
RuleFunction getCurrentRuleFunction();
Alternative getCurrentOuterMostAlt();
CodeBlock getCurrentBlock();
CodeBlockForOuterMostAlt getCurrentOuterMostAlternativeBlock();
int getCodeBlockLevel();
int getTreeLevel();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy