@Override public List<SrcOp> wildcard(GrammarAST ast, GrammarAST labelAST) { Wildcard wild = new Wildcard(this, ast); // TODO: dup with tokenRef if ( labelAST!=null ) { String label = labelAST.getText(); Decl d = getTokenLabelDecl(label); wild.labels.add(d); getCurrentRuleFunction().addContextDecl(ast.getAltLabel(), d); if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) { TokenListDecl l = getTokenListLabelDecl(label); getCurrentRuleFunction().addContextDecl(ast.getAltLabel(), l); } } if ( controller.needsImplicitLabel(ast, wild) ) defineImplicitLabel(ast, wild); AddToLabelList listLabelOp = getAddToListOpIfListLabelPresent(wild, labelAST); return list(wild, listLabelOp); }
@Override public List<SrcOp> wildcard(GrammarAST ast, GrammarAST labelAST) { Wildcard wild = new Wildcard(this, ast); // TODO: dup with tokenRef if ( labelAST!=null ) { String label = labelAST.getText(); Decl d = getTokenLabelDecl(label); wild.labels.add(d); getCurrentRuleFunction().addContextDecl(ast.getAltLabel(), d); if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) { TokenListDecl l = getTokenListLabelDecl(label); getCurrentRuleFunction().addContextDecl(ast.getAltLabel(), l); } } if ( controller.needsImplicitLabel(ast, wild) ) defineImplicitLabel(ast, wild); AddToLabelList listLabelOp = getAddToListOpIfListLabelPresent(wild, labelAST); return list(wild, listLabelOp); }
@Override public List<SrcOp> wildcard(GrammarAST ast, GrammarAST labelAST) { Wildcard wild = new Wildcard(this, ast); // TODO: dup with tokenRef if ( labelAST!=null ) { String label = labelAST.getText(); Decl d = getTokenLabelDecl(label); wild.labels.add(d); getCurrentRuleFunction().addContextDecl(ast.getAltLabel(), d); if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) { TokenListDecl l = getTokenListLabelDecl(label); getCurrentRuleFunction().addContextDecl(ast.getAltLabel(), l); } } if ( controller.needsImplicitLabel(ast, wild) ) defineImplicitLabel(ast, wild); AddToLabelList listLabelOp = getAddToListOpIfListLabelPresent(wild, labelAST); return list(wild, listLabelOp); }
@Override public List<SrcOp> wildcard(GrammarAST ast, GrammarAST labelAST) { Wildcard wild = new Wildcard(this, ast); // TODO: dup with tokenRef if ( labelAST!=null ) { String label = labelAST.getText(); Decl d = getTokenLabelDecl(label); wild.labels.add(d); getCurrentRuleFunction().addContextDecl(ast.getAltLabel(), d); if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) { TokenListDecl l = getTokenListLabelDecl(label); getCurrentRuleFunction().addContextDecl(ast.getAltLabel(), l); } } if ( controller.needsImplicitLabel(ast, wild) ) defineImplicitLabel(ast, wild); AddToLabelList listLabelOp = getAddToListOpIfListLabelPresent(wild, labelAST); return list(wild, listLabelOp); }
@Override public List<SrcOp> wildcard(GrammarAST ast, GrammarAST labelAST) { Wildcard wild = new Wildcard(this, ast); // TODO: dup with tokenRef if ( labelAST!=null ) { String label = labelAST.getText(); Decl d = getTokenLabelDecl(label); wild.labels.add(d); getCurrentRuleFunction().addContextDecl(ast.getAltLabel(), d); if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) { TokenListDecl l = getTokenListLabelDecl(label); getCurrentRuleFunction().addContextDecl(ast.getAltLabel(), l); } } if ( controller.needsImplicitLabel(ast, wild) ) defineImplicitLabel(ast, wild); AddToLabelList listLabelOp = getAddToListOpIfListLabelPresent(wild, labelAST); return list(wild, listLabelOp); }
@Override public Choice getChoiceBlock(BlockAST blkAST, List<CodeBlockForAlt> alts, GrammarAST labelAST) { int decision = ((DecisionState)blkAST.atnState).decision; Choice c; if ( !g.tool.force_atn && AnalysisPipeline.disjoint(g.decisionLOOK.get(decision)) ) { c = getLL1ChoiceBlock(blkAST, alts); } else { c = getComplexChoiceBlock(blkAST, alts); } if ( labelAST!=null ) { // for x=(...), define x or x_list String label = labelAST.getText(); Decl d = getTokenLabelDecl(label); c.label = d; getCurrentRuleFunction().addContextDecl(labelAST.getAltLabel(), d); if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) { String listLabel = gen.getTarget().getListLabel(label); TokenListDecl l = new TokenListDecl(this, listLabel); getCurrentRuleFunction().addContextDecl(labelAST.getAltLabel(), l); } } return c; }
@Override public Choice getChoiceBlock(BlockAST blkAST, List<CodeBlockForAlt> alts, GrammarAST labelAST) { int decision = ((DecisionState)blkAST.atnState).decision; Choice c; if ( !g.tool.force_atn && AnalysisPipeline.disjoint(g.decisionLOOK.get(decision)) ) { c = getLL1ChoiceBlock(blkAST, alts); } else { c = getComplexChoiceBlock(blkAST, alts); } if ( labelAST!=null ) { // for x=(...), define x or x_list String label = labelAST.getText(); Decl d = getTokenLabelDecl(label); c.label = d; getCurrentRuleFunction().addContextDecl(labelAST.getAltLabel(), d); if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) { String listLabel = getTarget().getListLabel(label); TokenListDecl l = new TokenListDecl(this, listLabel); getCurrentRuleFunction().addContextDecl(labelAST.getAltLabel(), l); } } return c; }
@Override public Choice getChoiceBlock(BlockAST blkAST, List<CodeBlockForAlt> alts, GrammarAST labelAST) { int decision = ((DecisionState)blkAST.atnState).decision; Choice c; if ( !g.tool.force_atn && AnalysisPipeline.disjoint(g.decisionLOOK.get(decision)) ) { c = getLL1ChoiceBlock(blkAST, alts); } else { c = getComplexChoiceBlock(blkAST, alts); } if ( labelAST!=null ) { // for x=(...), define x or x_list String label = labelAST.getText(); Decl d = getTokenLabelDecl(label); c.label = d; getCurrentRuleFunction().addContextDecl(labelAST.getAltLabel(), d); if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) { String listLabel = gen.getTarget().getListLabel(label); TokenListDecl l = new TokenListDecl(this, listLabel); getCurrentRuleFunction().addContextDecl(labelAST.getAltLabel(), l); } } return c; }
@Override public Choice getChoiceBlock(BlockAST blkAST, List<CodeBlockForAlt> alts, GrammarAST labelAST) { int decision = ((DecisionState)blkAST.atnState).decision; Choice c; if ( !g.tool.force_atn && AnalysisPipeline.disjoint(g.decisionLOOK.get(decision)) ) { c = getLL1ChoiceBlock(blkAST, alts); } else { c = getComplexChoiceBlock(blkAST, alts); } if ( labelAST!=null ) { // for x=(...), define x or x_list String label = labelAST.getText(); Decl d = getTokenLabelDecl(label); c.label = d; getCurrentRuleFunction().addContextDecl(labelAST.getAltLabel(), d); if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) { String listLabel = gen.getTarget().getListLabel(label); TokenListDecl l = new TokenListDecl(this, listLabel); getCurrentRuleFunction().addContextDecl(labelAST.getAltLabel(), l); } } return c; }
@Override public Choice getChoiceBlock(BlockAST blkAST, List<CodeBlockForAlt> alts, GrammarAST labelAST) { int decision = ((DecisionState)blkAST.atnState).decision; Choice c; if ( !g.tool.force_atn && AnalysisPipeline.disjoint(g.decisionLOOK.get(decision)) ) { c = getLL1ChoiceBlock(blkAST, alts); } else { c = getComplexChoiceBlock(blkAST, alts); } if ( labelAST!=null ) { // for x=(...), define x or x_list String label = labelAST.getText(); Decl d = getTokenLabelDecl(label); c.label = d; getCurrentRuleFunction().addContextDecl(labelAST.getAltLabel(), d); if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) { String listLabel = gen.getTarget().getListLabel(label); TokenListDecl l = new TokenListDecl(this, listLabel); getCurrentRuleFunction().addContextDecl(labelAST.getAltLabel(), l); } } return c; }
@Override public List<SrcOp> set(GrammarAST setAST, GrammarAST labelAST, boolean invert) { MatchSet matchOp; if ( invert ) matchOp = new MatchNotSet(this, setAST); else matchOp = new MatchSet(this, setAST); if ( labelAST!=null ) { String label = labelAST.getText(); RuleFunction rf = getCurrentRuleFunction(); if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) { defineImplicitLabel(setAST, matchOp); TokenListDecl l = getTokenListLabelDecl(label); rf.addContextDecl(setAST.getAltLabel(), l); } else { Decl d = getTokenLabelDecl(label); matchOp.labels.add(d); rf.addContextDecl(setAST.getAltLabel(), d); } } if ( controller.needsImplicitLabel(setAST, matchOp) ) defineImplicitLabel(setAST, matchOp); AddToLabelList listLabelOp = getAddToListOpIfListLabelPresent(matchOp, labelAST); return list(matchOp, listLabelOp); }
@Override public List<SrcOp> set(GrammarAST setAST, GrammarAST labelAST, boolean invert) { MatchSet matchOp; if ( invert ) matchOp = new MatchNotSet(this, setAST); else matchOp = new MatchSet(this, setAST); if ( labelAST!=null ) { String label = labelAST.getText(); RuleFunction rf = getCurrentRuleFunction(); if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) { defineImplicitLabel(setAST, matchOp); TokenListDecl l = getTokenListLabelDecl(label); rf.addContextDecl(setAST.getAltLabel(), l); } else { Decl d = getTokenLabelDecl(label); matchOp.labels.add(d); rf.addContextDecl(setAST.getAltLabel(), d); } } if ( controller.needsImplicitLabel(setAST, matchOp) ) defineImplicitLabel(setAST, matchOp); AddToLabelList listLabelOp = getAddToListOpIfListLabelPresent(matchOp, labelAST); return list(matchOp, listLabelOp); }
@Override public List<SrcOp> set(GrammarAST setAST, GrammarAST labelAST, boolean invert) { MatchSet matchOp; if ( invert ) matchOp = new MatchNotSet(this, setAST); else matchOp = new MatchSet(this, setAST); if ( labelAST!=null ) { String label = labelAST.getText(); RuleFunction rf = getCurrentRuleFunction(); if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) { defineImplicitLabel(setAST, matchOp); TokenListDecl l = getTokenListLabelDecl(label); rf.addContextDecl(setAST.getAltLabel(), l); } else { Decl d = getTokenLabelDecl(label); matchOp.labels.add(d); rf.addContextDecl(setAST.getAltLabel(), d); } } if ( controller.needsImplicitLabel(setAST, matchOp) ) defineImplicitLabel(setAST, matchOp); AddToLabelList listLabelOp = getAddToListOpIfListLabelPresent(matchOp, labelAST); return list(matchOp, listLabelOp); }
@Override public List<SrcOp> set(GrammarAST setAST, GrammarAST labelAST, boolean invert) { MatchSet matchOp; if ( invert ) matchOp = new MatchNotSet(this, setAST); else matchOp = new MatchSet(this, setAST); if ( labelAST!=null ) { String label = labelAST.getText(); RuleFunction rf = getCurrentRuleFunction(); if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) { defineImplicitLabel(setAST, matchOp); TokenListDecl l = getTokenListLabelDecl(label); rf.addContextDecl(setAST.getAltLabel(), l); } else { Decl d = getTokenLabelDecl(label); matchOp.labels.add(d); rf.addContextDecl(setAST.getAltLabel(), d); } } if ( controller.needsImplicitLabel(setAST, matchOp) ) defineImplicitLabel(setAST, matchOp); AddToLabelList listLabelOp = getAddToListOpIfListLabelPresent(matchOp, labelAST); return list(matchOp, listLabelOp); }
@Override public List<SrcOp> set(GrammarAST setAST, GrammarAST labelAST, boolean invert) { MatchSet matchOp; if ( invert ) matchOp = new MatchNotSet(this, setAST); else matchOp = new MatchSet(this, setAST); if ( labelAST!=null ) { String label = labelAST.getText(); RuleFunction rf = getCurrentRuleFunction(); if ( labelAST.parent.getType() == ANTLRParser.PLUS_ASSIGN ) { defineImplicitLabel(setAST, matchOp); TokenListDecl l = getTokenListLabelDecl(label); rf.addContextDecl(setAST.getAltLabel(), l); } else { Decl d = getTokenLabelDecl(label); matchOp.labels.add(d); rf.addContextDecl(setAST.getAltLabel(), d); } } if ( controller.needsImplicitLabel(setAST, matchOp) ) defineImplicitLabel(setAST, matchOp); AddToLabelList listLabelOp = getAddToListOpIfListLabelPresent(matchOp, labelAST); return list(matchOp, listLabelOp); }
public void defineImplicitLabel(GrammarAST ast, LabeledOp op) { Decl d; if ( ast.getType()==ANTLRParser.SET || ast.getType()==ANTLRParser.WILDCARD ) { String implLabel = gen.getTarget().getImplicitSetLabel(String.valueOf(ast.token.getTokenIndex())); d = getTokenLabelDecl(implLabel); ((TokenDecl)d).isImplicit = true; } else if ( ast.getType()==ANTLRParser.RULE_REF ) { // a rule reference? Rule r = g.getRule(ast.getText()); String implLabel = gen.getTarget().getImplicitRuleLabel(ast.getText()); String ctxName = gen.getTarget().getRuleFunctionContextStructName(r); d = new RuleContextDecl(this, implLabel, ctxName); ((RuleContextDecl)d).isImplicit = true; } else { String implLabel = gen.getTarget().getImplicitTokenLabel(ast.getText()); d = getTokenLabelDecl(implLabel); ((TokenDecl)d).isImplicit = true; } op.getLabels().add(d); // all labels must be in scope struct in case we exec action out of context getCurrentRuleFunction().addContextDecl(ast.getAltLabel(), d); }
public void defineImplicitLabel(GrammarAST ast, LabeledOp op) { Decl d; if ( ast.getType()==ANTLRParser.SET || ast.getType()==ANTLRParser.WILDCARD ) { String implLabel = gen.getTarget().getImplicitSetLabel(String.valueOf(ast.token.getTokenIndex())); d = getTokenLabelDecl(implLabel); ((TokenDecl)d).isImplicit = true; } else if ( ast.getType()==ANTLRParser.RULE_REF ) { // a rule reference? Rule r = g.getRule(ast.getText()); String implLabel = gen.getTarget().getImplicitRuleLabel(ast.getText()); String ctxName = gen.getTarget().getRuleFunctionContextStructName(r); d = new RuleContextDecl(this, implLabel, ctxName); ((RuleContextDecl)d).isImplicit = true; } else { String implLabel = gen.getTarget().getImplicitTokenLabel(ast.getText()); d = getTokenLabelDecl(implLabel); ((TokenDecl)d).isImplicit = true; } op.getLabels().add(d); // all labels must be in scope struct in case we exec action out of context getCurrentRuleFunction().addContextDecl(ast.getAltLabel(), d); }
public void defineImplicitLabel(GrammarAST ast, LabeledOp op) { Decl d; if ( ast.getType()==ANTLRParser.SET || ast.getType()==ANTLRParser.WILDCARD ) { String implLabel = getTarget().getImplicitSetLabel(String.valueOf(ast.token.getTokenIndex())); d = getTokenLabelDecl(implLabel); ((TokenDecl)d).isImplicit = true; } else if ( ast.getType()==ANTLRParser.RULE_REF ) { // a rule reference? Rule r = g.getRule(ast.getText()); String implLabel = getTarget().getImplicitRuleLabel(ast.getText()); String ctxName = getTarget().getRuleFunctionContextStructName(r); d = new RuleContextDecl(this, implLabel, ctxName); ((RuleContextDecl)d).isImplicit = true; } else { String implLabel = getTarget().getImplicitTokenLabel(ast.getText()); d = getTokenLabelDecl(implLabel); ((TokenDecl)d).isImplicit = true; } op.getLabels().add(d); // all labels must be in scope struct in case we exec action out of context getCurrentRuleFunction().addContextDecl(ast.getAltLabel(), d); }
public void defineImplicitLabel(GrammarAST ast, LabeledOp op) { Decl d; if ( ast.getType()==ANTLRParser.SET || ast.getType()==ANTLRParser.WILDCARD ) { String implLabel = gen.getTarget().getImplicitSetLabel(String.valueOf(ast.token.getTokenIndex())); d = getTokenLabelDecl(implLabel); ((TokenDecl)d).isImplicit = true; } else if ( ast.getType()==ANTLRParser.RULE_REF ) { // a rule reference? Rule r = g.getRule(ast.getText()); String implLabel = gen.getTarget().getImplicitRuleLabel(ast.getText()); String ctxName = gen.getTarget().getRuleFunctionContextStructName(r); d = new RuleContextDecl(this, implLabel, ctxName); ((RuleContextDecl)d).isImplicit = true; } else { String implLabel = gen.getTarget().getImplicitTokenLabel(ast.getText()); d = getTokenLabelDecl(implLabel); ((TokenDecl)d).isImplicit = true; } op.getLabels().add(d); // all labels must be in scope struct in case we exec action out of context getCurrentRuleFunction().addContextDecl(ast.getAltLabel(), d); }
public void defineImplicitLabel(GrammarAST ast, LabeledOp op) { Decl d; if ( ast.getType()==ANTLRParser.SET || ast.getType()==ANTLRParser.WILDCARD ) { String implLabel = gen.getTarget().getImplicitSetLabel(String.valueOf(ast.token.getTokenIndex())); d = getTokenLabelDecl(implLabel); ((TokenDecl)d).isImplicit = true; } else if ( ast.getType()==ANTLRParser.RULE_REF ) { // a rule reference? Rule r = g.getRule(ast.getText()); String implLabel = gen.getTarget().getImplicitRuleLabel(ast.getText()); String ctxName = gen.getTarget().getRuleFunctionContextStructName(r); d = new RuleContextDecl(this, implLabel, ctxName); ((RuleContextDecl)d).isImplicit = true; } else { String implLabel = gen.getTarget().getImplicitTokenLabel(ast.getText()); d = getTokenLabelDecl(implLabel); ((TokenDecl)d).isImplicit = true; } op.getLabels().add(d); // all labels must be in scope struct in case we exec action out of context getCurrentRuleFunction().addContextDecl(ast.getAltLabel(), d); }