public ActionTranslator(OutputModelFactory factory, ActionAST node) { this.factory = factory; this.node = node; this.gen = factory.getGenerator(); }
public ActionTranslator(OutputModelFactory factory, ActionAST node) { this.factory = factory; this.node = node; this.gen = factory.getGenerator(); }
public ActionTranslator(OutputModelFactory factory, ActionAST node) { this.factory = factory; this.node = node; this.gen = factory.getGenerator(); }
public String[][] getSegments() { List<String[]> segments = new ArrayList<String[]>(); int segmentLimit = factory.getGenerator().getTarget().getSerializedATNSegmentLimit(); for (int i = 0; i < serialized.size(); i += segmentLimit) { List<String> currentSegment = serialized.subList(i, Math.min(i + segmentLimit, serialized.size())); segments.add(currentSegment.toArray(new String[currentSegment.size()])); } return segments.toArray(new String[segments.size()][]); } }
public StarBlock(OutputModelFactory factory, GrammarAST blkOrEbnfRootAST, List<CodeBlockForAlt> alts) { super(factory, blkOrEbnfRootAST, alts); loopLabel = factory.getGenerator().getTarget().getLoopLabel(blkOrEbnfRootAST); StarLoopEntryState star = (StarLoopEntryState)blkOrEbnfRootAST.atnState; loopBackStateNumber = star.loopBackState.stateNumber; decision = star.decision; } }
public AltLabelStructDecl(OutputModelFactory factory, Rule r, int altNum, String label) { super(factory, r); this.altNum = altNum; this.name = // override name set in super to the label ctx factory.getGenerator().getTarget().getAltLabelContextStructName(label); derivedFromName = label; }
public List<String[]> getAltLookaheadAsStringLists(IntervalSet[] altLookSets) { List<String[]> altLook = new ArrayList<String[]>(); for (IntervalSet s : altLookSets) { altLook.add(factory.getGenerator().getTarget().getTokenTypesAsTargetLabels(factory.getGrammar(), s.toArray())); } return altLook; }
public List<String[]> getAltLookaheadAsStringLists(IntervalSet[] altLookSets) { List<String[]> altLook = new ArrayList<String[]>(); for (IntervalSet s : altLookSets) { altLook.add(factory.getGenerator().getTarget().getTokenTypesAsTargetLabels(factory.getGrammar(), s.toArray())); } return altLook; }
public List<String[]> getAltLookaheadAsStringLists(IntervalSet[] altLookSets) { List<String[]> altLook = new ArrayList<String[]>(); for (IntervalSet s : altLookSets) { altLook.add(factory.getGenerator().getTarget().getTokenTypesAsTargetLabels(factory.getGrammar(), s.toArray())); } return altLook; }
public SerializedATN(OutputModelFactory factory, ATN atn) { super(factory); IntegerList data = ATNSerializer.getSerialized(atn); serialized = new ArrayList<String>(data.size()); for (int c : data.toArray()) { String encoded = factory.getGenerator().getTarget().encodeIntAsCharEscape(c == -1 ? Character.MAX_VALUE : c); serialized.add(encoded); } // System.out.println(ATNSerializer.getDecoded(factory.getGrammar(), atn)); }
public StructDecl(OutputModelFactory factory, Rule r) { super(factory, factory.getGenerator().getTarget().getRuleFunctionContextStructName(r)); addDispatchMethods(r); derivedFromName = r.name; provideCopyFrom = r.hasAltSpecificContexts(); }
public StructDecl(OutputModelFactory factory, Rule r) { super(factory, factory.getGenerator().getTarget().getRuleFunctionContextStructName(r)); addDispatchMethods(r); derivedFromName = r.name; provideCopyFrom = r.hasAltSpecificContexts(); }
public MatchToken(OutputModelFactory factory, TerminalAST ast) { super(factory, ast); Grammar g = factory.getGrammar(); CodeGenerator gen = factory.getGenerator(); ttype = g.getTokenType(ast.getText()); name = gen.getTarget().getTokenTypeAsTargetLabel(g, ttype); }
public OutputModelObject buildLexerOutputModel() { CodeGenerator gen = delegate.getGenerator(); LexerFile file = lexerFile(gen.getRecognizerFileName()); setRoot(file); file.lexer = lexer(file); Grammar g = delegate.getGrammar(); for (Rule r : g.rules.values()) { buildLexerRuleActions(file.lexer, r); } return file; }
public OutputModelObject buildLexerOutputModel(boolean header) { CodeGenerator gen = delegate.getGenerator(); LexerFile file = lexerFile(gen.getRecognizerFileName(header)); setRoot(file); file.lexer = lexer(file); Grammar g = delegate.getGrammar(); for (Rule r : g.rules.values()) { buildLexerRuleActions(file.lexer, r); } return file; }
public MatchSet(OutputModelFactory factory, GrammarAST ast) { super(factory, ast); SetTransition st = (SetTransition)ast.atnState.transition(0); int wordSize = factory.getGenerator().getTarget().getInlineTestSetWordSize(); expr = new TestSetInline(factory, null, st.set, wordSize); Decl d = new TokenTypeDecl(factory, expr.varName); factory.getCurrentRuleFunction().addLocalDecl(d); capture = new CaptureNextTokenType(factory,expr.varName); } }
public MatchSet(OutputModelFactory factory, GrammarAST ast) { super(factory, ast); SetTransition st = (SetTransition)ast.atnState.transition(0); int wordSize = factory.getGenerator().getTarget().getInlineTestSetWordSize(); expr = new TestSetInline(factory, null, st.set, wordSize); Decl d = new TokenTypeDecl(factory, expr.varName); factory.getCurrentRuleFunction().addLocalDecl(d); capture = new CaptureNextTokenType(factory,expr.varName); } }
public MatchSet(OutputModelFactory factory, GrammarAST ast) { super(factory, ast); SetTransition st = (SetTransition)ast.atnState.transition(0); int wordSize = factory.getGenerator().getTarget().getInlineTestSetWordSize(); expr = new TestSetInline(factory, null, st.set, wordSize); Decl d = new TokenTypeDecl(factory, expr.varName); factory.getCurrentRuleFunction().addLocalDecl(d); capture = new CaptureNextTokenType(factory,expr.varName); } }
public MatchSet(OutputModelFactory factory, GrammarAST ast) { super(factory, ast); SetTransition st = (SetTransition)ast.atnState.transition(0); int wordSize = factory.getGenerator().getTarget().getInlineTestSetWordSize(); expr = new TestSetInline(factory, null, st.set, wordSize); Decl d = new TokenTypeDecl(factory, expr.varName); factory.getCurrentRuleFunction().addLocalDecl(d); capture = new CaptureNextTokenType(factory,expr.varName); } }
public MatchSet(OutputModelFactory factory, GrammarAST ast) { super(factory, ast); SetTransition st = (SetTransition)ast.atnState.transition(0); int wordSize = factory.getGenerator().getTarget().getInlineTestSetWordSize(); expr = new TestSetInline(factory, null, st.set, wordSize); Decl d = new TokenTypeDecl(factory, expr.varName); factory.getCurrentRuleFunction().addLocalDecl(d); capture = new CaptureNextTokenType(factory,expr.varName); } }