Package org.antlr.grammar.v3

Examples of org.antlr.grammar.v3.ActionTranslator


        "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());
    translator = new ActionTranslator(generator,
      "a",
      new CommonToken(ANTLRParser.ACTION,action2),2);
    found = translator.translate();
    assertEquals(expecting2, found);

    assertEquals("unexpected errors: "+equeue, 0, equeue.errors.size());
  }
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 CommonToken(ANTLRParser.ACTION,action),1);
    String found = translator.translate();    assertEquals(expecting, found);

    int expectedMsgID = ErrorManager.MSG_UNKNOWN_DYNAMIC_SCOPE_ATTRIBUTE;
    Object expectedArg = "a";
    Object expectedArg2 = "x";
    GrammarSemanticsMessage expectedMessage =
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 CommonToken(ANTLRParser.ACTION,action),1);
    String found = translator.translate();    assertEquals(expecting, found);

    int expectedMsgID = ErrorManager.MSG_UNKNOWN_DYNAMIC_SCOPE_ATTRIBUTE;
    Object expectedArg = "Symbols";
    Object expectedArg2 = "x";
    GrammarSemanticsMessage expectedMessage =
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 CommonToken(ANTLRParser.ACTION,action),1);
    String found = translator.translate();    assertEquals(expecting, found);

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

        "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();
    assertEquals(expecting, found);

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

        "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);

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

        "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);

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

      "grammar t;\n"+
        "a : ids+=. ( ',' ids+=ID {"+action+"})* ;" +
        "ID : 'a';\n");
    Tool antlr = newTool();
    CodeGenerator generator = new CodeGenerator(antlr, g, "Java");
    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

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

    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

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

    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

TOP

Related Classes of org.antlr.grammar.v3.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.