Examples of LA()


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

   * particular case by throwing an {@link IllegalStateException}.
   */
  @Test(expected = IllegalStateException.class)
  public void testConsumeEOF() throws Exception {
    CharStream input = createStream("");
    assertEquals(IntStream.EOF, input.LA(1));
    input.consume();
    input.consume();
  }

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

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

  @Test
  public void testLastChar() {
    CharStream input = createStream("abcdef");

    input.consume();
    assertEquals('a', input.LA(-1));

    int m1 = input.mark();
    input.consume();
    input.consume();
    input.consume();
View Full Code Here

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

    int m1 = input.mark();
    input.consume();
    input.consume();
    input.consume();
    assertEquals('d', input.LA(-1));

    input.seek(2);
    assertEquals('b', input.LA(-1));

    input.release(m1);
View Full Code Here

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

    input.consume();
    input.consume();
    assertEquals('d', input.LA(-1));

    input.seek(2);
    assertEquals('b', input.LA(-1));

    input.release(m1);
    input.seek(3);
    assertEquals('c', input.LA(-1));
    // this special case is not required by the IntStream interface, but
View Full Code Here

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

    input.seek(2);
    assertEquals('b', input.LA(-1));

    input.release(m1);
    input.seek(3);
    assertEquals('c', input.LA(-1));
    // this special case is not required by the IntStream interface, but
    // UnbufferedCharStream allows it so we have to make sure the resulting
    // state is consistent
    input.seek(2);
    assertEquals('b', input.LA(-1));
View Full Code Here

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

    assertEquals('c', input.LA(-1));
    // this special case is not required by the IntStream interface, but
    // UnbufferedCharStream allows it so we have to make sure the resulting
    // state is consistent
    input.seek(2);
    assertEquals('b', input.LA(-1));
  }

  @Test public void test1Char() throws Exception {
    TestingUnbufferedCharStream input = createStream("x");
    assertEquals('x', input.LA(1));
View Full Code Here

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

    assertEquals("\uFFFF", input.getBuffer());
  }

    @Test public void test2CharAhead() throws Exception {
       CharStream input = createStream("xy");
       assertEquals('x', input.LA(1));
       assertEquals('y', input.LA(2));
       assertEquals(IntStream.EOF, input.LA(3));
     }

    @Test public void testBufferExpand() throws Exception {
View Full Code Here

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

  }

    @Test public void test2CharAhead() throws Exception {
       CharStream input = createStream("xy");
       assertEquals('x', input.LA(1));
       assertEquals('y', input.LA(2));
       assertEquals(IntStream.EOF, input.LA(3));
     }

    @Test public void testBufferExpand() throws Exception {
    TestingUnbufferedCharStream input = createStream("01234", 2);
View Full Code Here

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

    @Test public void test2CharAhead() throws Exception {
       CharStream input = createStream("xy");
       assertEquals('x', input.LA(1));
       assertEquals('y', input.LA(2));
       assertEquals(IntStream.EOF, input.LA(3));
     }

    @Test public void testBufferExpand() throws Exception {
    TestingUnbufferedCharStream input = createStream("01234", 2);
       assertEquals('0', input.LA(1));
View Full Code Here

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

       assertEquals(IntStream.EOF, input.LA(6));
     }

    @Test public void testBufferWrapSize1() throws Exception {
       CharStream input = createStream("01234", 1);
        assertEquals('0', input.LA(1));
        input.consume();
        assertEquals('1', input.LA(1));
        input.consume();
        assertEquals('2', input.LA(1));
        input.consume();
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.