Package org.antlr.runtime

Examples of org.antlr.runtime.TokenStream


    try {
      System.out.println("===== QualifiedName: " + source + " =====");
      CharStream stream =
          new NoCaseStringStream(source);
      ForteLexer lexer = new ForteLexer(stream);
      TokenStream tokens = new CommonTokenStream(lexer);
      parser = new ForteParser(tokens);
      parser.setTokenStream(tokens);
      qualifiedIdentExpression_return result = parser.qualifiedIdentExpression();
      CommonTree tree = (CommonTree) result.getTree();
      errors = parser.getNumberOfSyntaxErrors();
View Full Code Here


                  "        exit;\n" +
                  "      end if;\n" +
                  "    end for;\n"
                  );
        ForteLexer lexer = new ForteLexer(stream);
        TokenStream tokenStream = new CommonTokenStream(lexer);
        ForteParser parser = new ForteParser(tokenStream);
        CommonTree tree = (CommonTree) parser.whenss().getTree();
        System.out.println(tree.toStringTree());
        int errors = parser.getNumberOfSyntaxErrors();
        if (errors > 0){
View Full Code Here

  @Test
  public void assignmentStatement_1() throws Exception{
      CharStream stream =
          new NoCaseStringStream("self.legs(34).value = 7;");
        ForteLexer lexer = new ForteLexer(stream);
        TokenStream tokenStream = new CommonTokenStream(lexer);
        ForteParser parser = new ForteParser(tokenStream);
        parser.statement();
        int errors = parser.getNumberOfSyntaxErrors();
        if (errors > 0){
          Assert.fail("assignmentStatement completed with " + errors + " errors");
View Full Code Here

  @Test
  public void assignmentStatement_2() throws Exception{
      CharStream stream =
          new NoCaseStringStream("self.legs[34].value = 7;");
        ForteLexer lexer = new ForteLexer(stream);
        TokenStream tokenStream = new CommonTokenStream(lexer);
        ForteParser parser = new ForteParser(tokenStream);
        parser.statement();
        int errors = parser.getNumberOfSyntaxErrors();
        if (errors > 0){
          Assert.fail("assignmentStatement_2 completed with " + errors + " errors");
View Full Code Here

  @Test
  public void assignmentStatement_3() throws Exception{
      CharStream stream =
          new NoCaseStringStream("self.legs[34] = 7;");
        ForteLexer lexer = new ForteLexer(stream);
        TokenStream tokenStream = new CommonTokenStream(lexer);
        ForteParser parser = new ForteParser(tokenStream);
        parser.statement();
        int errors = parser.getNumberOfSyntaxErrors();
        if (errors > 0){
          Assert.fail("assignmentStatement completed with " + errors + " errors");
View Full Code Here

  @Test
  public void simpleMethodInvocationStatement() throws Exception{
      CharStream stream =
          new NoCaseStringStream("__PutProperty(17,OLE.VariantI2(Value='Action'));");
        ForteLexer lexer = new ForteLexer(stream);
        TokenStream tokenStream = new CommonTokenStream(lexer);
        ForteParser parser = new ForteParser(tokenStream);
        parser.statement();
        int errors = parser.getNumberOfSyntaxErrors();
        if (errors > 0){
          Assert.fail("simpleMethodInvocationStatement completed with " + errors + " errors");
View Full Code Here

      CharStream stream =
          new NoCaseStringStream("if a then\n" +
              "x = y;" +
              "end if;");
        ForteLexer lexer = new ForteLexer(stream);
        TokenStream tokenStream = new CommonTokenStream(lexer);
        ForteParser parser = new ForteParser(tokenStream);
        parser.statement();
        int errors = parser.getNumberOfSyntaxErrors();
        if (errors > 0){
          Assert.fail("ifStatement_1 completed with " + errors + " errors");
View Full Code Here

      CharStream stream =
          new NoCaseStringStream("if a = b then\n" +
              "x = y;" +
              "end if;");
        ForteLexer lexer = new ForteLexer(stream);
        TokenStream tokenStream = new CommonTokenStream(lexer);
        ForteParser parser = new ForteParser(tokenStream);
        parser.statement();
        int errors = parser.getNumberOfSyntaxErrors();
        if (errors > 0){
          Assert.fail("ifStatement_2 completed with " + errors + " errors");
View Full Code Here

              "        -- This is the one.  Delete it.\n" +
              "        self.PaintingData.DeleteRow(p);\n" +
              "        exit;\n" +
              "      end if;");
        ForteLexer lexer = new ForteLexer(stream);
        TokenStream tokenStream = new CommonTokenStream(lexer);
        ForteParser parser = new ForteParser(tokenStream);
        parser.statement();
        int errors = parser.getNumberOfSyntaxErrors();
        if (errors > 0){
          Assert.fail("ifStatement_3 completed with " + errors + " errors");
View Full Code Here

      CharStream stream =
          new NoCaseStringStream("if (a = b) and bob then\n" +
//              "x = y;" +
              "end if;");
        ForteLexer lexer = new ForteLexer(stream);
        TokenStream tokenStream = new CommonTokenStream(lexer);
        ForteParser parser = new ForteParser(tokenStream);
        parser.statement();
        int errors = parser.getNumberOfSyntaxErrors();
        if (errors > 0){
          Assert.fail("ifStatement_4 completed with " + errors + " errors");
View Full Code Here

TOP

Related Classes of org.antlr.runtime.TokenStream

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.