Package org.antlr.v4.tool

Examples of org.antlr.v4.tool.LexerGrammar


      "A : 'a' (EOF|'\\n') ;\n");
    checkDeserializationIsStable(lg);
  }

  @Test public void testLexerRange() throws Exception {
    LexerGrammar lg = new LexerGrammar(
      "lexer grammar L;\n"+
      "INT : '0'..'9' ;\n");
    checkDeserializationIsStable(lg);
  }
View Full Code Here


      "INT : '0'..'9' ;\n");
    checkDeserializationIsStable(lg);
  }

  @Test public void testLexerLoops() throws Exception {
    LexerGrammar lg = new LexerGrammar(
      "lexer grammar L;\n"+
      "INT : '0'..'9'+ ;\n");
    checkDeserializationIsStable(lg);
  }
View Full Code Here

      "INT : '0'..'9'+ ;\n");
    checkDeserializationIsStable(lg);
  }

  @Test public void testLexerNotSet() throws Exception {
    LexerGrammar lg = new LexerGrammar(
      "lexer grammar L;\n"+
      "ID : ~('a'|'b')\n ;");
    checkDeserializationIsStable(lg);
  }
View Full Code Here

      "ID : ~('a'|'b')\n ;");
    checkDeserializationIsStable(lg);
  }

  @Test public void testLexerNotSetWithRange() throws Exception {
    LexerGrammar lg = new LexerGrammar(
      "lexer grammar L;\n"+
      "ID : ~('a'|'b'|'e'|'p'..'t')\n ;");
    checkDeserializationIsStable(lg);
  }
View Full Code Here

      "ID : ~('a'|'b'|'e'|'p'..'t')\n ;");
    checkDeserializationIsStable(lg);
  }

  @Test public void testLexerNotSetWithRange2() throws Exception {
    LexerGrammar lg = new LexerGrammar(
      "lexer grammar L;\n"+
      "ID : ~('a'|'b') ~('e'|'p'..'t')\n ;");
    checkDeserializationIsStable(lg);
  }
View Full Code Here

      "ID : ~('a'|'b') ~('e'|'p'..'t')\n ;");
    checkDeserializationIsStable(lg);
  }

  @Test public void test2ModesInLexer() throws Exception {
    LexerGrammar lg = new LexerGrammar(
      "lexer grammar L;\n"+
      "A : 'a'\n ;\n" +
      "mode M;\n" +
      "B : 'b';\n" +
      "mode M2;\n" +
View Full Code Here

  // NOTICE: TOKENS IN LEXER, PARSER MUST BE SAME OR TOKEN TYPE MISMATCH
  // NOTICE: TOKENS IN LEXER, PARSER MUST BE SAME OR TOKEN TYPE MISMATCH

public class TestATNParserPrediction extends BaseTest {
  @Test public void testAorB() throws Exception {
    LexerGrammar lg = new LexerGrammar(
      "lexer grammar L;\n" +
      "A : 'a' ;\n" +
      "B : 'b' ;\n" +
      "C : 'c' ;\n");
    Grammar g = new Grammar(
View Full Code Here

    };
    checkDFAConstruction(lg, g, decision, inputs, dfa);
  }

  @Test public void testEmptyInput() throws Exception {
    LexerGrammar lg = new LexerGrammar(
      "lexer grammar L;\n" +
      "A : 'a' ;\n" +
      "B : 'b' ;\n" +
      "C : 'c' ;\n");
    Grammar g = new Grammar(
View Full Code Here

    };
    checkDFAConstruction(lg, g, decision, inputs, dfa);
  }

  @Test public void testPEGAchillesHeel() throws Exception {
    LexerGrammar lg = new LexerGrammar(
      "lexer grammar L;\n" +
      "A : 'a' ;\n" +
      "B : 'b' ;\n" +
      "C : 'c' ;\n");
    Grammar g = new Grammar(
View Full Code Here

    };
    checkDFAConstruction(lg, g, 0, inputs, dfa);
  }

  @Test public void testRuleRefxory() throws Exception {
    LexerGrammar lg = new LexerGrammar(
      "lexer grammar L;\n" +
      "A : 'a' ;\n" +
      "B : 'b' ;\n" +
      "C : 'c' ;\n");
    Grammar g = new Grammar(
View Full Code Here

TOP

Related Classes of org.antlr.v4.tool.LexerGrammar

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.