Package org.antlr.codegen

Examples of org.antlr.codegen.ActionTranslator


      "  ;\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 antlr.CommonToken(ANTLRParser.ACTION,action),1);
    String rawTranslation =
      translator.translate();
    StringTemplateGroup templates =
      new StringTemplateGroup(".", AngleBracketTemplateLexer.class);
    StringTemplate actionST = new StringTemplate(templates, rawTranslation);
    String found = actionST.toString();
    assertEquals(expecting, found);
View Full Code Here


      "  ;\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 antlr.CommonToken(ANTLRParser.ACTION,action),1);
    String rawTranslation =
      translator.translate();
    StringTemplateGroup templates =
      new StringTemplateGroup(".", AngleBracketTemplateLexer.class);
    StringTemplate actionST = new StringTemplate(templates, rawTranslation);
    String found = actionST.toString();
    assertEquals(expecting, found);
View Full Code Here

      "  ;\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 antlr.CommonToken(ANTLRParser.ACTION,action),1);
    String rawTranslation =
      translator.translate();
    StringTemplateGroup templates =
      new StringTemplateGroup(".", AngleBracketTemplateLexer.class);
    StringTemplate actionST = new StringTemplate(templates, rawTranslation);
    String found = actionST.toString();
    assertEquals(expecting, found);
View Full Code Here

      "  ;\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 antlr.CommonToken(ANTLRParser.ACTION,action),1);
    String rawTranslation =
      translator.translate();
    StringTemplateGroup templates =
      new StringTemplateGroup(".", AngleBracketTemplateLexer.class);
    StringTemplate actionST = new StringTemplate(templates, rawTranslation);
    String found = actionST.toString();
    assertEquals(expecting, found);
View Full Code Here

      "  ;\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 antlr.CommonToken(ANTLRParser.ACTION,action),1);
    StringTemplate codeST = generator.getRecognizerST();
    String code = codeST.toString();
    String found = code.substring(code.indexOf("###")+3,code.indexOf("!!!"));
    assertEquals(expecting, found);
View Full Code Here

      "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 antlr.CommonToken(ANTLRParser.ACTION,action),1);
    String rawTranslation =
      translator.translate();
    StringTemplateGroup templates =
      new StringTemplateGroup(".", AngleBracketTemplateLexer.class);
    StringTemplate actionST = new StringTemplate(templates, rawTranslation);
    String found = actionST.toString();
    assertEquals(expecting, found);

    assertEquals("unexpected errors: "+equeue, 0, equeue.errors.size());
    translator = new ActionTranslator(generator,
                         "a",
                         new antlr.CommonToken(ANTLRParser.ACTION,action2),2);
    rawTranslation =
      translator.translate();
    templates =
      new StringTemplateGroup(".", AngleBracketTemplateLexer.class);
    actionST = new StringTemplate(templates, rawTranslation);
    found = actionST.toString();
View Full Code Here

      "c : '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 antlr.CommonToken(ANTLRParser.ACTION,action),1);
    String rawTranslation =
      translator.translate();
    StringTemplateGroup templates =
      new StringTemplateGroup(".", AngleBracketTemplateLexer.class);
    StringTemplate actionST = new StringTemplate(templates, rawTranslation);
    String found = actionST.toString();
    assertEquals(expecting, found);

    assertEquals("unexpected errors: "+equeue, 0, equeue.errors.size());
    translator = new ActionTranslator(generator,
                         "a",
                         new antlr.CommonToken(ANTLRParser.ACTION,action2),2);
    rawTranslation =
      translator.translate();
    templates =
      new StringTemplateGroup(".", AngleBracketTemplateLexer.class);
    actionST = new StringTemplate(templates, rawTranslation);
    found = actionST.toString();
View Full Code Here

      "  ;\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 antlr.CommonToken(ANTLRParser.ACTION,action),1);
    String rawTranslation =
      translator.translate();
    StringTemplateGroup templates =
      new StringTemplateGroup(".", AngleBracketTemplateLexer.class);
    StringTemplate actionST = new StringTemplate(templates, rawTranslation);
    String found = actionST.toString();
    assertEquals(expecting, found);
View Full Code Here

      "  ;\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 antlr.CommonToken(ANTLRParser.ACTION,action),1);
    String rawTranslation =
      translator.translate();
    StringTemplateGroup templates =
      new StringTemplateGroup(".", AngleBracketTemplateLexer.class);
    StringTemplate actionST = new StringTemplate(templates, rawTranslation);
    String found = actionST.toString();
    assertEquals(expecting, found);
View Full Code Here

      "  ;\n" +
      "b : {'+action+'}\n" +
      "  ;\n");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    ActionTranslator translator =
      new ActionTranslator(generator,
                    "b",
                    new antlr.CommonToken(ANTLRParser.ACTION,action),1);
    String rawTranslation =
      translator.translate();
    StringTemplateGroup templates =
      new StringTemplateGroup(".", AngleBracketTemplateLexer.class);
    StringTemplate actionST = new StringTemplate(templates, rawTranslation);
    String found = actionST.toString();
    assertEquals(expecting, found);
View Full Code Here

TOP

Related Classes of org.antlr.codegen.ActionTranslator

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.