Package org.antlr.v4.runtime

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


   * {@link IllegalStateException}.
   */
  @Test(expected = IllegalStateException.class)
  public void testMarkReleaseOutOfOrder() {
    CharStream input = createStream("");
    int m1 = input.mark();
    int m2 = input.mark();
    input.release(m1);
  }

  /**
 
View Full Code Here


   */
  @Test(expected = IllegalStateException.class)
  public void testMarkReleaseOutOfOrder() {
    CharStream input = createStream("");
    int m1 = input.mark();
    int m2 = input.mark();
    input.release(m1);
  }

  /**
   * The {@link IntStream} interface does not specify the behavior when a mark
View Full Code Here

   * throwing an {@link IllegalStateException}.
   */
  @Test(expected = IllegalStateException.class)
  public void testMarkReleasedTwice() {
    CharStream input = createStream("");
    int m1 = input.mark();
    input.release(m1);
    input.release(m1);
  }

  /**
 
View Full Code Here

   * throwing an {@link IllegalStateException}.
   */
  @Test(expected = IllegalStateException.class)
  public void testNestedMarkReleasedTwice() {
    CharStream input = createStream("");
    int m1 = input.mark();
    int m2 = input.mark();
    input.release(m2);
    input.release(m2);
  }

View Full Code Here

   */
  @Test(expected = IllegalStateException.class)
  public void testNestedMarkReleasedTwice() {
    CharStream input = createStream("");
    int m1 = input.mark();
    int m2 = input.mark();
    input.release(m2);
    input.release(m2);
  }

  /**
 
View Full Code Here

   * invalid usage results in an {@link IllegalArgumentException}.
   */
  @Test(expected = IllegalArgumentException.class)
  public void testMarkPassedToSeek() {
    CharStream input = createStream("");
    int m1 = input.mark();
    input.seek(m1);
  }

  @Test(expected = IllegalArgumentException.class)
  public void testSeekBeforeBufferStart() {
View Full Code Here

  @Test(expected = IllegalArgumentException.class)
  public void testSeekBeforeBufferStart() {
    CharStream input = createStream("xyz");
    input.consume();
    int m1 = input.mark();
    assertEquals(1, input.index());
    input.consume();
    input.seek(0);
  }
View Full Code Here

  @Test(expected = UnsupportedOperationException.class)
  public void testGetTextBeforeBufferStart() {
    CharStream input = createStream("xyz");
    input.consume();
    int m1 = input.mark();
    assertEquals(1, input.index());
    input.getText(new Interval(0, 1));
  }

  @Test
View Full Code Here

  @Test
  public void testGetTextInMarkedRange() {
    CharStream input = createStream("xyz");
    input.consume();
    int m1 = input.mark();
    assertEquals(1, input.index());
    input.consume();
    input.consume();
    assertEquals("yz", input.getText(new Interval(1, 2)));
  }
View Full Code Here

    CharStream input = createStream("abcdef");

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

    int m1 = input.mark();
    input.consume();
    input.consume();
    input.consume();
    assertEquals('d', input.LA(-1));
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.