Package org.antlr.runtime

Examples of org.antlr.runtime.RuleReturnScope


    assertEquals("testing rule element", expecting, actual);
  }

  @Test public void test_element18() throws Exception {
    // gunit test on line 146
    RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x+=~(A|B)", 146);
    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(+= x (~ (SET A B)))";
    assertEquals("testing rule element", expecting, actual);
  }
View Full Code Here


    assertEquals("testing rule element", expecting, actual);
  }

  @Test public void test_element19() throws Exception {
    // gunit test on line 147
    RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x+=~(A|B)+", 147);
    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(+ (BLOCK (ALT (+= x (~ (SET A B))))))";
    assertEquals("testing rule element", expecting, actual);
  }
View Full Code Here

    assertEquals("testing rule element", expecting, actual);
  }

  @Test public void test_element20() throws Exception {
    // gunit test on line 148
    RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x=b+", 148);
    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(+ (BLOCK (ALT (= x b))))";
    assertEquals("testing rule element", expecting, actual);
  }
View Full Code Here

    assertEquals("testing rule element", expecting, actual);
  }

  @Test public void test_element21() throws Exception {
    // gunit test on line 149
    RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x+=ID*", 149);
    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(* (BLOCK (ALT (+= x ID))))";
    assertEquals("testing rule element", expecting, actual);
  }
View Full Code Here

    assertEquals("testing rule element", expecting, actual);
  }

  @Test public void test_element22() throws Exception {
    // gunit test on line 150
    RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x+='int'*", 150);
    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(* (BLOCK (ALT (+= x 'int'))))";
    assertEquals("testing rule element", expecting, actual);
  }
View Full Code Here

    assertEquals("testing rule element", expecting, actual);
  }

  @Test public void test_element23() throws Exception {
    // gunit test on line 151
    RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "x+=b+", 151);
    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(+ (BLOCK (ALT (+= x b))))";
    assertEquals("testing rule element", expecting, actual);
  }
View Full Code Here

    assertEquals("testing rule element", expecting, actual);
  }

  @Test public void test_element24() throws Exception {
    // gunit test on line 152
    RuleReturnScope rstruct = (RuleReturnScope)execParser("element", "({blort} 'x')*", 152);
    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(* (BLOCK (ALT {blort} 'x')))";
    assertEquals("testing rule element", expecting, actual);
  }
View Full Code Here

      lexerClassName = "org.stringtemplate.v4.compiler.STLexer";
      parserClassName = "org.stringtemplate.v4.compiler.STParser";
  }
  @Test public void test_template1() throws Exception {
    // gunit test on line 16
    RuleReturnScope rstruct = (RuleReturnScope)execParser("template", "<[]>", 16);
    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(EXPR [)";
    assertEquals("testing rule template", expecting, actual);
  }
View Full Code Here

    assertEquals("testing rule template", expecting, actual);
  }

  @Test public void test_template2() throws Exception {
    // gunit test on line 17
    RuleReturnScope rstruct = (RuleReturnScope)execParser("template", "<[a,b]>", 17);
    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(EXPR ([ a b))";
    assertEquals("testing rule template", expecting, actual);
  }
View Full Code Here

    final BasicMathParser parser = new BasicMathParser(
        new CommonTokenStream(
            lexer));

    try {
      final RuleReturnScope rule = parser.expression();
      if (parser.hasError()) {
        throw new EvaluationException(
            parser.errorMessage() + " " + parser.errorPosition());
      }

      return (CommonTree) rule.getTree();
    }
    catch (final EvaluationException e) {
      throw e;
    }
    catch (final Exception e) {
View Full Code Here

TOP

Related Classes of org.antlr.runtime.RuleReturnScope

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.