Package org.antlr.tool

Examples of org.antlr.tool.Grammar


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

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

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

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

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

    @Test public void testToStringStartStop() throws Exception {
        Grammar g = new Grammar(
            "lexer grammar t;\n"+
            "ID : 'a'..'z'+;\n" +
            "INT : '0'..'9'+;\n" +
            "SEMI : ';';\n" +
            "MUL : '*';\n" +
View Full Code Here

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

    @Test public void testToStringStartStop2() throws Exception {
        Grammar g = new Grammar(
            "lexer grammar t;\n"+
            "ID : 'a'..'z'+;\n" +
            "INT : '0'..'9'+;\n" +
            "SEMI : ';';\n" +
            "ASSIGN : '=';\n" +
View Full Code Here

        assertEquals(expecting, result);
    }


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

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

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

  @Test public void testInsertInPriorReplace() 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

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.