Package org.antlr.tool

Examples of org.antlr.tool.Interpreter.scan()


    assertEquals(result.getType(), Atype);
        engine = new Interpreter(g, new ANTLRStringStream("b"));
    result = engine.scan("A");
    assertEquals(result.getType(), Atype);
        engine = new Interpreter(g, new ANTLRStringStream("baa"));
    result = engine.scan("A");
    assertEquals(result.getType(), Atype);
    }

  public void testSimpleLoops() throws Exception {
    Grammar g = new Grammar(
View Full Code Here


        "lexer grammar t;\n"+
        "A : ('0'..'9')+ '.' ('0'..'9')* | ('0'..'9')+ ;\n");
    final int Atype = g.getTokenType("A");
    CharStream input = new ANTLRStringStream("1234.5");
    Interpreter engine = new Interpreter(g, input);
    Token result = engine.scan("A");
    assertEquals(result.getType(), Atype);
  }

  public void testTokensRules() throws Exception {
    Grammar pg = new Grammar(
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.