Package org.antlr.runtime3_3_0

Examples of org.antlr.runtime3_3_0.Token


    super(adaptor, elementDescription, elements);
  }

  /** Get next token from stream and make a node for it */
  public Object nextNode() {
    Token t = (Token)_next();
    return adaptor.create(t);
  }
View Full Code Here


  }
*/
  public void process() throws IOException {
    CharStream input = new ANTLRFileStream(dispelFile);
    DISPEL lexer = new DISPEL(input);
    Token token;
    while ((token = lexer.nextToken()) != Token.EOF_TOKEN) {
      tp.process(token);
    }
  }
View Full Code Here

    CharStream input;
    try {
      input = new ANTLRInputStream(is);
     
      DISPEL lexer = new DISPEL(input);
      Token token;
       
        while ((token = lexer.nextToken()).getType() !=
          org.antlr.runtime3_3_0.Token.EOF) {
   
          tp.process(token);
View Full Code Here

  public void enterDecision(int decisionNumber, boolean couldBacktrack) {
    lastRealTokenTouchedInDecision = null;
    stats.numDecisionEvents++;
    int startingLookaheadIndex = parser.getTokenStream().index();
    TokenStream input = parser.getTokenStream();
    if ( dump ) System.out.println("enterDecision canBacktrack="+couldBacktrack+" "+ decisionNumber +
               " backtrack depth " + backtrackDepth +
               " @ " + input.get(input.index()) +
               " rule " +locationDescription());
    String g = (String) currentGrammarFileName.peek();
    DecisionDescriptor descriptor = decisions.get(g, decisionNumber);
    if ( descriptor == null ) {
      descriptor = new DecisionDescriptor();
View Full Code Here

  }

  /** Get num hidden tokens between i..j inclusive */
  public int getNumberOfHiddenTokens(int i, int j) {
    int n = 0;
    TokenStream input = parser.getTokenStream();
    for (int ti = i; ti<input.size() && ti <= j; ti++) {
      Token t = input.get(ti);
      if ( t.getChannel()!=Token.DEFAULT_CHANNEL ) {
        n++;
      }
    }
    return n;
View Full Code Here

    public TreeIterator(TreeAdaptor adaptor, Object tree) {
        this.adaptor = adaptor;
        this.tree = tree;
        this.root = tree;
        nodes = new FastQueue();
        down = adaptor.create(Token.DOWN, "DOWN");
        up = adaptor.create(Token.UP, "UP");
        eof = adaptor.create(Token.EOF, "EOF");
    }
View Full Code Here

  /** Make stream jump to a new location, saving old location.
   *  Switch back with pop().
   */
  public void push(int index) {
    if ( calls==null ) {
      calls = new IntArray();
    }
    calls.push(p); // save current index
    seek(index);
  }
View Full Code Here

    /** Make stream jump to a new location, saving old location.
     *  Switch back with pop().
     */
    public void push(int index) {
        if ( calls==null ) {
            calls = new IntArray();
        }
        calls.push(p); // save current index
        seek(index);
    }
View Full Code Here

  Stack callStack = new Stack();
  List hiddenTokens = new ArrayList();
  int backtracking = 0;

  public ParseTreeBuilder(String grammarName) {
    ParseTree root = create("<grammar "+grammarName+">");
    callStack.push(root);
  }
View Full Code Here

  /**  What kind of node to create.  You might want to override
   *   so I factored out creation here.
   */
  public ParseTree create(Object payload) {
    return new ParseTree(payload);
  }
View Full Code Here

TOP

Related Classes of org.antlr.runtime3_3_0.Token

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.