Examples of genRecognizer()


Examples of org.antlr.codegen.CodeGenerator.genRecognizer()

            if (isGenerate_NFA_dot()) {
                generateNFAs(grammar);
            }

            // GENERATE CODE
            generator.genRecognizer();

            if (isGenerate_DFA_dot()) {
                generateDFAs(grammar);
            }
View Full Code Here

Examples of org.antlr.codegen.CodeGenerator.genRecognizer()

    Grammar g = new Grammar(grammarStr);

    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    g.setCodeGenerator(generator);
    ST recogST = generator.genRecognizer();
    String code = recogST.render();
    assertTrue("not expecting label", code.indexOf("x=b();")<0);

    assertEquals("unexpected errors: "+equeue, 0, equeue.errors.size());
  }
View Full Code Here

Examples of org.antlr.codegen.CodeGenerator.genRecognizer()

      "    : other=otherrule {" + action +"}\n" +
      "    ;");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    g.setCodeGenerator(generator);
    generator.genRecognizer(); // forces load of templates
    ActionTranslator translator = new ActionTranslator(generator,
                                  "rule",
                                  new CommonToken(ANTLRParser.ACTION,action),1);
    String rawTranslation =
      translator.translate();
View Full Code Here

Examples of org.antlr.codegen.CodeGenerator.genRecognizer()

        Grammar g = new Grammar(treeGrammar);
        Tool antlr = newTool();
        antlr.setOutputDirectory(null); // write to /dev/null
        CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
        g.setCodeGenerator(generator);
        generator.genRecognizer();

        assertEquals("unexpected errors: "+equeue, 1, equeue.errors.size());

        int expectedMsgID = ErrorManager.MSG_WILDCARD_AS_ROOT;
        Object expectedArg = null;
View Full Code Here

Examples of org.antlr.codegen.CodeGenerator.genRecognizer()

        "        : {"+action+"}\n" +
        "        ;");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    g.setCodeGenerator(generator);
    generator.genRecognizer(); // forces load of templates
    ActionTranslator translator =
      new ActionTranslator(generator,
        "a",
        new CommonToken(ANTLRParser.ACTION,action),0);
    String found = translator.translate();    assertEquals(expecting, found);
View Full Code Here

Examples of org.antlr.codegen.CodeGenerator.genRecognizer()

        "        : {"+action+"}\n" +
        "        ;");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    g.setCodeGenerator(generator);
    generator.genRecognizer(); // forces load of templates
    ActionTranslator translator = new ActionTranslator(generator,"a",
      new CommonToken(ANTLRParser.ACTION,action),1);
    String found = translator.translate();    assertEquals(expecting, found);

    assertEquals("unexpected errors: "+equeue, 0, equeue.errors.size());
View Full Code Here

Examples of org.antlr.codegen.CodeGenerator.genRecognizer()

        "        : A a["+action+"] B\n" +
        "        ;");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    g.setCodeGenerator(generator);
    generator.genRecognizer(); // forces load of templates
    ActionTranslator translator = new ActionTranslator(generator,"a",
      new CommonToken(ANTLRParser.ACTION,action),1);
    String rawTranslation =  translator.translate();
    assertEquals(expecting, rawTranslation);
View Full Code Here

Examples of org.antlr.codegen.CodeGenerator.genRecognizer()

        "b : {"+action+"}\n" +
        "  ;\n");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    g.setCodeGenerator(generator);
    generator.genRecognizer(); // forces load of templates
    ActionTranslator translator = new ActionTranslator(generator, "b",
      new CommonToken(ANTLRParser.ACTION,action),1);
    String found = translator.translate();
    assertEquals(expecting, found);
View Full Code Here

Examples of org.antlr.codegen.CodeGenerator.genRecognizer()

        "b : ID {$Symbols::x=$ID.text} ;\n" +
        "ID : 'a';\n");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    g.setCodeGenerator(generator);
    generator.genRecognizer(); // forces load of templates
    ActionTranslator translator = new ActionTranslator(generator,"a",
      new CommonToken(ANTLRParser.ACTION,action),1);
    String found = translator.translate();
    assertEquals(expecting, found);
View Full Code Here

Examples of org.antlr.codegen.CodeGenerator.genRecognizer()

        "b : {"+action+"}\n" +
        "  ;\n");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    g.setCodeGenerator(generator);
    generator.genRecognizer(); // forces load of templates
    ActionTranslator translator = new ActionTranslator(generator, "b",
      new CommonToken(ANTLRParser.ACTION,action),1);
    String found = translator.translate();
    assertEquals(expecting, found);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.