Package org.antlr.codegen

Examples of org.antlr.codegen.ActionTranslatorLexer


    generator.genRecognizer(); // forces load of templates
    int i = 0;
    String action = action1;
    String expecting = expecting1;
    do {
      ActionTranslatorLexer translator = new ActionTranslatorLexer(generator,"rule1",
                                     new antlr.CommonToken(ANTLRParser.ACTION,action),i+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


        "a returns [User u, int i]\n" +
        "        : {"+action+"}\n" +
        "        ;");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    ActionTranslatorLexer translator = new ActionTranslatorLexer(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

        "  ;");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    g.setCodeGenerator(generator);
    generator.genRecognizer(); // forces load of templates
    ActionTranslatorLexer translator = new ActionTranslatorLexer(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 : r=a[3] {"+action+"}\n" +
        "  ;");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    ActionTranslatorLexer translator = new ActionTranslatorLexer(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"+
        "b : r=a[3] {"+action+"}\n" +
        "  ;");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    ActionTranslatorLexer translator = new ActionTranslatorLexer(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"+
        "b : r=a[3] {"+action+"}\n" +
        "  ;");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    ActionTranslatorLexer translator = new ActionTranslatorLexer(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"+
        "b : r=a[3] {"+action+"}\n" +
        "  ;");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    ActionTranslatorLexer translator = new ActionTranslatorLexer(generator, "b",
                                   new antlr.CommonToken(ANTLRParser.ACTION,action),1);
    String rawTranslation =
      translator.translate();

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

        "  ;\n"+
        "b : a {"+action+"}\n" +
        "  ;");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    ActionTranslatorLexer translator = new ActionTranslatorLexer(generator, "b",
                                   new antlr.CommonToken(ANTLRParser.ACTION,action),1);
    String rawTranslation =
      translator.translate();

    int expectedMsgID = ErrorManager.MSG_ISOLATED_RULE_SCOPE;
    Object expectedArg = "a";
    GrammarSemanticsMessage expectedMessage =
      new GrammarSemanticsMessage(expectedMsgID, g, null, expectedArg);
View Full Code Here

      "parser grammar t;\n"+
        "@members {'+action+'}\n" +
        "a : ;\n");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    ActionTranslatorLexer translator = new ActionTranslatorLexer(generator,
                                   null,
                                   new antlr.CommonToken(ANTLRParser.ACTION,action),0);
    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

      "parser grammar t;\n"+
        "@members {'+action+'}\n" +
        "a : ;\n");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    ActionTranslatorLexer translator = new ActionTranslatorLexer(generator,
                                   null,
                                   new antlr.CommonToken(ANTLRParser.ACTION,action),0);
    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.ActionTranslatorLexer

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.