Package org.antlr.v4.parse

Examples of org.antlr.v4.parse.ActionSplitter


    if ( rf!=null ) translator.nodeContext = rf.ruleCtx;
    if ( altLabel!=null ) translator.nodeContext = rf.altLabelCtxs.get(altLabel);
    ANTLRStringStream in = new ANTLRStringStream(action);
    in.setLine(tokenWithinAction.getLine());
    in.setCharPositionInLine(tokenWithinAction.getCharPositionInLine());
    ActionSplitter trigger = new ActionSplitter(in, translator);
    // forces eval, triggers listener methods
    trigger.getActionTokens();
    return translator.chunks;
  }
View Full Code Here


    public void examineAction() {
    //System.out.println("examine "+actionToken);
        ANTLRStringStream in = new ANTLRStringStream(actionToken.getText());
        in.setLine(actionToken.getLine());
        in.setCharPositionInLine(actionToken.getCharPositionInLine());
        ActionSplitter splitter = new ActionSplitter(in, this);
    // forces eval, triggers listener methods
        node.chunks = splitter.getActionTokens();
    }
View Full Code Here

  public void examineAction() {
    //System.out.println("examine "+actionToken);
    ANTLRStringStream in = new ANTLRStringStream(actionToken.getText());
    in.setLine(actionToken.getLine());
    in.setCharPositionInLine(actionToken.getCharPositionInLine());
    ActionSplitter splitter = new ActionSplitter(in, this);
    // forces eval, triggers listener methods
    node.chunks = splitter.getActionTokens();
  }
View Full Code Here

  public void processNested(Token actionToken) {
    ANTLRStringStream in = new ANTLRStringStream(actionToken.getText());
    in.setLine(actionToken.getLine());
    in.setCharPositionInLine(actionToken.getCharPositionInLine());
    ActionSplitter splitter = new ActionSplitter(in, this);
    // forces eval, triggers listener methods
    splitter.getActionTokens();
  }
View Full Code Here

      @Override
      public void setNonLocalAttr(String expr, Token x, Token y, Token rhs) { dependent[0] = true; }
      @Override
      public void attr(String expr, Token x) {  dependent[0] = true; }
    };
    ActionSplitter splitter = new ActionSplitter(in, listener);
    // forces eval, triggers listener methods
    splitter.getActionTokens();
    return dependent[0];
  }
View Full Code Here

        }
    }

    public static List<String> getActionChunks(String a) {
        List<String> chunks = new ArrayList<String>();
        ActionSplitter splitter = new ActionSplitter(new ANTLRStringStream(a),
                           new BlankActionSplitterListener());
        Token t = splitter.nextToken();
        while ( t.getType()!=Token.EOF ) {
            chunks.add("'"+t.getText()+"'<"+t.getType()+">");
            t = splitter.nextToken();
        }
        return chunks;
    }
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

     *
     *  Parameter must be a token.
     *  todo: do we want?
     */
    public void expandParameterizedLoops(GrammarAST root) {
        TreeVisitor v = new TreeVisitor(new GrammarASTAdaptor());
        v.visit(root, new TreeVisitorAction() {
            @Override
            public Object pre(Object t) {
                if ( ((GrammarAST)t).getType() == 3 ) {
                    return expandParameterizedLoop((GrammarAST)t);
View Full Code Here

TOP

Related Classes of org.antlr.v4.parse.ActionSplitter

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.