Package org.antlr.runtime

Examples of org.antlr.runtime.RuleReturnScope


    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(PARSER_GRAMMAR P (import (= A B) C) (RULES (RULE a (BLOCK (ALT A)))))";
    assertEquals("testing rule grammarSpec", expecting, actual);
  } @Test public void test_delegateGrammars1() throws Exception {
    // gunit test on line 53
    RuleReturnScope rstruct = (RuleReturnScope)execParser("delegateGrammars", "import A;", 53);
    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(import A)";
    assertEquals("testing rule delegateGrammars", expecting, actual);
  } @Test public void test_rule1() throws Exception {
View Full Code Here


    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(import A)";
    assertEquals("testing rule delegateGrammars", expecting, actual);
  } @Test public void test_rule1() throws Exception {
    // gunit test on line 56
    RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "a : A<X,Y=a.b.c>;", 56);
    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(RULE a (BLOCK (ALT (A (ELEMENT_OPTIONS X (= Y a.b.c))))))";
    assertEquals("testing rule rule", expecting, actual);
  }
View Full Code Here

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

  @Test public void test_rule2() throws Exception {
    // gunit test on line 58
    RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "A : B+;", 58);
    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(RULE A (BLOCK (ALT (+ (BLOCK (ALT B))))))";
    assertEquals("testing rule rule", expecting, actual);
  }
View Full Code Here

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

  @Test public void test_rule3() throws Exception {
    // gunit test on line 60
    RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "\n    a[int i] returns [int y]\n    @init {blort}\n      : ID ;\n    ", 60);
    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(RULE a int i (returns int y) (@ init {blort}) (BLOCK (ALT ID)))";
    assertEquals("testing rule rule", expecting, actual);
  }
View Full Code Here

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

  @Test public void test_rule4() throws Exception {
    // gunit test on line 75
    RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "\n    a[int i] returns [int y]\n    @init {blort}\n    options {backtrack=true;}\n      : ID;\n    ", 75);
    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(RULE a int i (returns int y) (@ init {blort}) (OPTIONS (= backtrack true)) (BLOCK (ALT ID)))";
    assertEquals("testing rule rule", expecting, actual);
  }
View Full Code Here

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

  @Test public void test_rule5() throws Exception {
    // gunit test on line 88
    RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "\n    a : ID ;\n      catch[A b] {foo}\n      finally {bar}\n    ", 88);
    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(RULE a (BLOCK (ALT ID)) (catch A b {foo}) (finally {bar}))";
    assertEquals("testing rule rule", expecting, actual);
  }
View Full Code Here

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

  @Test public void test_rule6() throws Exception {
    // gunit test on line 97
    RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "\n    a : ID ;\n      catch[A a] {foo}\n      catch[B b] {fu}\n      finally {bar}\n    ", 97);
    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(RULE a (BLOCK (ALT ID)) (catch A a {foo}) (catch B b {fu}) (finally {bar}))";
    assertEquals("testing rule rule", expecting, actual);
  }
View Full Code Here

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

  @Test public void test_rule7() throws Exception {
    // gunit test on line 107
    RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "\n\ta[int i]\n\tlocals [int a, float b]\n\t\t:\tA\n\t\t;\n\t", 107);
    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(RULE a int i (locals int a, float b) (BLOCK (ALT A)))";
    assertEquals("testing rule rule", expecting, actual);
  }
View Full Code Here

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

  @Test public void test_rule8() throws Exception {
    // gunit test on line 115
    RuleReturnScope rstruct = (RuleReturnScope)execParser("rule", "\n\ta[int i] throws a.b.c\n\t\t:\tA\n\t\t;\n\t", 115);
    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(RULE a int i (throws a.b.c) (BLOCK (ALT A)))";
    assertEquals("testing rule rule", expecting, actual);
  } @Test public void test_ebnf1() throws Exception {
View Full Code Here

    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(RULE a int i (throws a.b.c) (BLOCK (ALT A)))";
    assertEquals("testing rule rule", expecting, actual);
  } @Test public void test_ebnf1() throws Exception {
    // gunit test on line 123
    RuleReturnScope rstruct = (RuleReturnScope)execParser("ebnf", "(A|B)", 123);
    Object actual = ((Tree)rstruct.getTree()).toStringTree();
    Object expecting = "(BLOCK (ALT A) (ALT B))";
    assertEquals("testing rule ebnf", expecting, actual);
  }
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.