Package org.antlr.tool

Examples of org.antlr.tool.Grammar


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

  @Test public void testReplaceSubsetThenFetch() 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 = "abxyzba";
    assertEquals(expecting, result);
  }

  @Test public void testReplaceThenReplaceSuperset() 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 testReplaceThenReplaceLowerIndexedSuperset() 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 testReplaceSingleMiddleThenOverlappingSuperset() throws Exception {
    Grammar g = new Grammar(
      "lexer grammar t;\n"+
      "A : 'a';\n" +
      "B : 'b';\n" +
      "C : 'c';\n");
    CharStream input = new ANTLRStringStream("abcba");
View Full Code Here

  }

  // June 2, 2008 I rewrote core of rewrite engine; just adding lots more tests here

  @Test public void testCombineInserts() 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 = "yxabc";
    assertEquals(expecting, result);
  }

  @Test public void testCombine3Inserts() 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 = "yazxbc";
    assertEquals(expecting, result);
  }

  @Test public void testCombineInsertOnLeftWithReplace() 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 = "zfoo";
    assertEquals(expecting, result);
  }

  @Test public void testCombineInsertOnLeftWithDelete() 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 = "z"; // make sure combo is not znull
    assertEquals(expecting, result);
  }

  @Test public void testDisjointInserts() 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 = "zaxbyc";
    assertEquals(expecting, result);
  }

  @Test public void testOverlappingReplace() throws Exception {
    Grammar g = new Grammar(
      "lexer grammar t;\n"+
      "A : 'a';\n" +
      "B : 'b';\n" +
      "C : 'c';\n");
    CharStream input = new ANTLRStringStream("abcc");
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.