Examples of genRecognizer()


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

        "ID : 'a';\n");
    Tool antlr = newTool();
    antlr.setOutputDirectory(null); // write to /dev/null
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    g.setCodeGenerator(generator);
    generator.genRecognizer();

    int expectedMsgID = ErrorManager.MSG_RULE_HAS_NO_ARGS;
    Object expectedArg = "ID";
    Object expectedArg2 = null;
    GrammarSemanticsMessage expectedMessage =
View Full Code Here

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

        "R : 'z' i=ID {"+action+"};" +
        "fragment 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,
        "R",
        new CommonToken(ANTLRParser.ACTION,action),1);
    String found = translator.translate();
View Full Code Here

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

        "        : A \n"+
        "        ;");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    g.setCodeGenerator(generator);
    generator.genRecognizer(); // forces load of templates
    Rule r = g.getRule("a");
    AttributeScope parameters = r.parameterScope;
    List<Attribute> attrs = parameters.getAttributes();
    assertEquals("attribute mismatch","String[] ick",attrs.get(0).decl.toString());
    assertEquals("parameter name mismatch","ick",attrs.get(0).name);
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()

        "        : 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()

        "        : 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()

    assertEquals("declarator mismatch", "HashMap<String,String>", attrs.get(0).type);

    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()

    assertEquals("declarator mismatch", "List<String>", attrs.get(2).type);

    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 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 : x=b {"+action+"} ;\n" +
        "b returns [int foo] : B {$b.start} ;\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
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.