Package org.antlr.v4.codegen.model.decl

Examples of org.antlr.v4.codegen.model.decl.Decl


        defineImplicitLabel(ID, matchOp); // adds _X
        TokenListDecl l = getTokenListLabelDecl(label);
        rf.addContextDecl(ID.getAltLabel(), l);
      }
      else {
        Decl d = getTokenLabelDecl(label);
        matchOp.labels.add(d);
        rf.addContextDecl(ID.getAltLabel(), d);
      }

//      Decl d = getTokenLabelDecl(label);
View Full Code Here


        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);
View Full Code Here

  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);
View Full Code Here

      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);
View Full Code Here

  }

  // support

  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;
View Full Code Here

  public TestSetInline addCodeForLookaheadTempVar(IntervalSet look) {
    List<SrcOp> testOps = factory.getLL1Test(look, ast);
    TestSetInline expr = Utils.find(testOps, TestSetInline.class);
    if (expr != null) {
      Decl d = new TokenTypeDecl(factory, expr.varName);
      factory.getCurrentRuleFunction().addLocalDecl(d);
      CaptureNextTokenType nextType = new CaptureNextTokenType(factory,expr.varName);
      addPreambleOp(nextType);
    }
    return expr;
View Full Code Here

  public MatchSet(OutputModelFactory factory, GrammarAST ast) {
    super(factory, ast);
    SetTransition st = (SetTransition)ast.atnState.transition(0);
    expr = new TestSetInline(factory, null, st.set);
    Decl d = new TokenTypeDecl(factory, expr.varName);
    factory.getCurrentRuleFunction().addLocalDecl(d);
    capture = new CaptureNextTokenType(factory,expr.varName);
  }
View Full Code Here

  }

  public void reduceBlocksToSets(GrammarAST root) {
    CommonTreeNodeStream nodes = new CommonTreeNodeStream(new GrammarASTAdaptor(), root);
    GrammarASTAdaptor adaptor = new GrammarASTAdaptor();
    BlockSetTransformer transformer = new BlockSetTransformer(nodes, g);
    transformer.setTreeAdaptor(adaptor);
    transformer.downup(root);
  }
View Full Code Here

  public Map<Integer, ASSOC> altAssociativity = new HashMap<Integer, ASSOC>();

  public LeftRecursiveRuleAnalyzer(GrammarAST ruleAST,
                   Tool tool, String ruleName, String language)
  {
    super(new CommonTreeNodeStream(new GrammarASTAdaptor(ruleAST.token.getInputStream()), ruleAST));
    this.tool = tool;
    this.ruleName = ruleName;
    this.language = language;
    this.tokenStream = ruleAST.g.tokenStream;
    if (this.tokenStream == null) {
View Full Code Here

        tool.log("grammar", "after: "+root.toStringTree());
  }

  public void reduceBlocksToSets(GrammarAST root) {
    CommonTreeNodeStream nodes = new CommonTreeNodeStream(new GrammarASTAdaptor(), root);
    GrammarASTAdaptor adaptor = new GrammarASTAdaptor();
    BlockSetTransformer transformer = new BlockSetTransformer(nodes, g);
    transformer.setTreeAdaptor(adaptor);
    transformer.downup(root);
  }
View Full Code Here

TOP

Related Classes of org.antlr.v4.codegen.model.decl.Decl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.