Examples of genRecognizer()


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

        "a : {###"+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,"a",
      new CommonToken(ANTLRParser.ACTION,action),1);
    ST codeST = generator.getRecognizerST();
    String code = codeST.render();
    String found = code.substring(code.indexOf("###")+3,code.indexOf("!!!"));
View Full Code Here

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

        "ID : 'a';\n" +
        "INT : '0';\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()

        "b : 'a';\n" +
        "c : '0';\n");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    g.setCodeGenerator(generator);
    generator.genRecognizer(); // codegen phase sets some vars we need
    ST codeST = generator.getRecognizerST();
    String code = codeST.render();
    String found = code.substring(code.indexOf("###")+3,code.indexOf("!!!"));
    assertEquals(expecting, found);
    found = code.substring(code.indexOf("^^^")+3,code.indexOf("&&&"));
View Full Code Here

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

        "} : {"+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,
        "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()

        "a : {'+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,
        "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()

      "parser grammar t;\n"+
        "a : ids+=ID ( COMMA ids+=ID {"+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();
View Full Code Here

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

        "a : ids+='if' ( ',' ids+=ID {"+action+"})* ;" +
        "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();
View Full Code Here

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

        "a : ids+=('a'|'b') ( ',' ids+=ID {"+action+"})* ;" +
        "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();
View Full Code Here

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

    ActionTranslator translator =
      new ActionTranslator(generator,
        "a",
        new CommonToken(ANTLRParser.ACTION,action),1);
    g.setCodeGenerator(generator);
    generator.genRecognizer(); // forces load of templates
    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()

    ActionTranslator translator =
      new ActionTranslator(generator,
        "a",
        new CommonToken(ANTLRParser.ACTION,action),1);
    g.setCodeGenerator(generator);
    generator.genRecognizer(); // forces load of templates
    String found = translator.translate();
    assertEquals(expecting, found);

    assertEquals("unexpected errors: "+equeue, 0, equeue.errors.size());
  }
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.