Package org.antlr.tool

Examples of org.antlr.tool.Grammar


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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

import static org.junit.Assert.*;

/** This actually tests new (12/4/09) buffered but on-demand fetching stream */
public class TestCommonTokenStream extends BaseTest {
    @Test public void testFirstToken() 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

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

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

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.