Examples of LA()


Examples of org.antlr.v4.runtime.CharStream.LA()

        input.consume();
        assertEquals('3', input.LA(1));
        input.consume();
        assertEquals('4', input.LA(1));
        input.consume();
       assertEquals(IntStream.EOF, input.LA(1));
     }

  @Test public void test1Mark() throws Exception {
    TestingUnbufferedCharStream input = createStream("xyz");
    int m = input.mark();
View Full Code Here

Examples of org.antlr.v4.runtime.CommonTokenStream.LA()

        tokens.consume();
        assertEquals(";", tokens.LT(1).getText());
        assertEquals("34", tokens.LT(-1).getText());

        tokens.consume();
        assertEquals(Token.EOF, tokens.LA(1));
        assertEquals(";", tokens.LT(-1).getText());

        assertEquals("34", tokens.LT(-2).getText());
        assertEquals("=", tokens.LT(-3).getText());
        assertEquals("x", tokens.LT(-4).getText());
View Full Code Here

Examples of org.antlr.v4.runtime.CommonTokenStream.LA()

    };

    CommonTokenStream tokens = new CommonTokenStream(lexer);
    tokens.fill();

    assertEquals(Token.EOF, tokens.LA(1));
    assertEquals(0, tokens.index());
    assertEquals(1, tokens.size());
  }

  @Test(expected = IllegalStateException.class)
View Full Code Here

Examples of org.antlr.v4.runtime.CommonTokenStream.LA()

    };

    CommonTokenStream tokens = new CommonTokenStream(lexer);
    tokens.fill();

    assertEquals(Token.EOF, tokens.LA(1));
    assertEquals(0, tokens.index());
    assertEquals(1, tokens.size());
    tokens.consume();
  }
}
View Full Code Here

Examples of org.antlr.v4.runtime.CommonTokenStream.LA()

    catch (Exception e) {
      throw new CannotInvokeStartRule(e);
    }

    // Make sure tree pattern compilation checks for a complete parse
    if ( tokens.LA(1)!=Token.EOF ) {
      throw new StartRuleDoesNotConsumeFullPattern();
    }

    return new ParseTreePattern(this, pattern, patternRuleIndex, tree);
  }
View Full Code Here

Examples of org.antlr.v4.runtime.TokenStream.LA()

    if (inErrorRecoveryMode(recognizer)) {
      return;
    }

    TokenStream tokens = recognizer.getInputStream();
    int la = tokens.LA(1);

    // try cheaper subset first; might get lucky. seems to shave a wee bit
    // off
    if (recognizer.getATN().nextTokens(s).contains(la) || la == Token.EOF)
      return;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.