Package org.antlr.v4.tool

Examples of org.antlr.v4.tool.Grammar


      tool.removeListeners();
      tool.addListener(errorQueue);
      assertEquals(0, errorQueue.size());
      GrammarRootAST grammarRootAST = tool.parseGrammarFromString(gstr);
      assertEquals(0, errorQueue.size());
      Grammar g = tool.createGrammar(grammarRootAST);
      assertEquals(0, errorQueue.size());
      g.fileName = "<string>";
      tool.process(g, false);
    }
    catch (Exception e) {
View Full Code Here


import java.util.Arrays;

public class TestATNDeserialization extends BaseTest {
  @Test public void testSimpleNoBlock() throws Exception {
    Grammar g = new Grammar(
      "parser grammar T;\n"+
      "a : A B ;");
    checkDeserializationIsStable(g);
  }
View Full Code Here

      "a : A B ;");
    checkDeserializationIsStable(g);
  }

  @Test public void testEOF() throws Exception {
    Grammar g = new Grammar(
      "parser grammar T;\n"+
      "a : EOF ;");
    checkDeserializationIsStable(g);
  }
View Full Code Here

      "a : EOF ;");
    checkDeserializationIsStable(g);
  }

  @Test public void testEOFInSet() throws Exception {
    Grammar g = new Grammar(
      "parser grammar T;\n"+
      "a : (EOF|A) ;");
    checkDeserializationIsStable(g);
  }
View Full Code Here

      "a : (EOF|A) ;");
    checkDeserializationIsStable(g);
  }

  @Test public void testNot() throws Exception {
    Grammar g = new Grammar(
      "parser grammar T;\n"+
      "tokens {A, B, C}\n" +
      "a : ~A ;");
    checkDeserializationIsStable(g);
  }
View Full Code Here

      "a : ~A ;");
    checkDeserializationIsStable(g);
  }

  @Test public void testWildcard() throws Exception {
    Grammar g = new Grammar(
      "parser grammar T;\n"+
      "tokens {A, B, C}\n" +
      "a : . ;");
    checkDeserializationIsStable(g);
  }
View Full Code Here

      "a : . ;");
    checkDeserializationIsStable(g);
  }

  @Test public void testPEGAchillesHeel() throws Exception {
    Grammar g = new Grammar(
      "parser grammar T;\n"+
      "a : A | A B ;");
    checkDeserializationIsStable(g);
  }
View Full Code Here

      "a : A | A B ;");
    checkDeserializationIsStable(g);
  }

  @Test public void test3Alts() throws Exception {
    Grammar g = new Grammar(
      "parser grammar T;\n"+
      "a : A | A B | A B C ;");
    checkDeserializationIsStable(g);
  }
View Full Code Here

      "a : A | A B | A B C ;");
    checkDeserializationIsStable(g);
  }

  @Test public void testSimpleLoop() throws Exception {
    Grammar g = new Grammar(
      "parser grammar T;\n"+
      "a : A+ B ;");
    checkDeserializationIsStable(g);
  }
View Full Code Here

      "a : A+ B ;");
    checkDeserializationIsStable(g);
  }

  @Test public void testRuleRef() throws Exception {
    Grammar g = new Grammar(
      "parser grammar T;\n"+
      "a : e ;\n" +
      "e : E ;\n");
    checkDeserializationIsStable(g);
  }
View Full Code Here

TOP

Related Classes of org.antlr.v4.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.