Package org.antlr.tool

Examples of org.antlr.tool.Grammar


    assertNotNull(exc);
    assertEquals(expecting, exc.getMessage());
  }

  @Test public void testInsertThenReplaceSameIndex() throws Exception {
    Grammar g = new Grammar(
      "lexer grammar t;\n"+
      "A : 'a';\n" +
      "B : 'b';\n" +
      "C : 'c';\n");
    CharStream input = new ANTLRStringStream("abc");
View Full Code Here


    String expecting = "0xbc";
    assertEquals(expecting, result);
  }

  @Test public void test2InsertMiddleIndex() throws Exception {
    Grammar g = new Grammar(
      "lexer grammar t;\n"+
      "A : 'a';\n" +
      "B : 'b';\n" +
      "C : 'c';\n");
    CharStream input = new ANTLRStringStream("abc");
View Full Code Here

    String expecting = "ayxbc";
    assertEquals(expecting, result);
  }

  @Test public void test2InsertThenReplaceIndex0() throws Exception {
    Grammar g = new Grammar(
      "lexer grammar t;\n"+
      "A : 'a';\n" +
      "B : 'b';\n" +
      "C : 'c';\n");
    CharStream input = new ANTLRStringStream("abc");
View Full Code Here

    String expecting = "yxzbc";
    assertEquals(expecting, result);
  }

  @Test public void testReplaceThenInsertBeforeLastIndex() throws Exception {
    Grammar g = new Grammar(
      "lexer grammar t;\n"+
      "A : 'a';\n" +
      "B : 'b';\n" +
      "C : 'c';\n");
    CharStream input = new ANTLRStringStream("abc");
View Full Code Here

    String expecting = "abyx";
    assertEquals(expecting, result);
  }

  @Test public void testInsertThenReplaceLastIndex() throws Exception {
    Grammar g = new Grammar(
      "lexer grammar t;\n"+
      "A : 'a';\n" +
      "B : 'b';\n" +
      "C : 'c';\n");
    CharStream input = new ANTLRStringStream("abc");
View Full Code Here

    String expecting = "abyx";
    assertEquals(expecting, result);
  }

  @Test public void testReplaceThenInsertAfterLastIndex() throws Exception {
    Grammar g = new Grammar(
      "lexer grammar t;\n"+
      "A : 'a';\n" +
      "B : 'b';\n" +
      "C : 'c';\n");
    CharStream input = new ANTLRStringStream("abc");
View Full Code Here

    String expecting = "abxy";
    assertEquals(expecting, result);
  }

  @Test public void testReplaceRangeThenInsertAtLeftEdge() throws Exception {
    Grammar g = new Grammar(
      "lexer grammar t;\n"+
      "A : 'a';\n" +
      "B : 'b';\n" +
      "C : 'c';\n");
    CharStream input = new ANTLRStringStream("abcccba");
View Full Code Here

    String expecting = "abyxba";
    assertEquals(expecting, result);
  }

  @Test public void testReplaceRangeThenInsertAtRightEdge() throws Exception {
    Grammar g = new Grammar(
      "lexer grammar t;\n"+
      "A : 'a';\n" +
      "B : 'b';\n" +
      "C : 'c';\n");
    CharStream input = new ANTLRStringStream("abcccba");
View Full Code Here

    assertNotNull(exc);
    assertEquals(expecting, exc.getMessage());
  }

  @Test public void testReplaceRangeThenInsertAfterRightEdge() throws Exception {
    Grammar g = new Grammar(
      "lexer grammar t;\n"+
      "A : 'a';\n" +
      "B : 'b';\n" +
      "C : 'c';\n");
    CharStream input = new ANTLRStringStream("abcccba");
View Full Code Here

    String expecting = "abxyba";
    assertEquals(expecting, result);
  }

  @Test public void testReplaceAll() throws Exception {
    Grammar g = new Grammar(
      "lexer grammar t;\n"+
      "A : 'a';\n" +
      "B : 'b';\n" +
      "C : 'c';\n");
    CharStream input = new ANTLRStringStream("abcccba");
View Full Code Here

TOP

Related Classes of org.antlr.tool.Grammar

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.