Package org.antlr.runtime

Examples of org.antlr.runtime.TokenStream


    CharStream stream;
    try {
      stream = new NoCaseFileStream(source);
      ForteLexer lexer = new ForteLexer(stream);
      TokenStream tokenStream = new CommonTokenStream(lexer);
      return tokenStream;
    } catch (IOException e) {
      ToolModelActivator.showError("Cannot create parser for Plan " + source.getName(), e);
    }
    return null;
View Full Code Here


  private TokenStream getStream(String source){
    CharStream stream =
        new NoCaseStringStream(source);
    ForteLexer lexer = new ForteLexer(stream);
    TokenStream tokenStream = new CommonTokenStream(lexer);
    return tokenStream;
  }
View Full Code Here

  }
  public int testClassDefinitionFile(File cdf, boolean failOnError) throws IOException, RecognitionException {
    CharStream stream =
        new NoCaseFileStream(cdf.getAbsolutePath());
    ForteLexer lexer = new ForteLexer(stream);
    TokenStream tokenStream = new CommonTokenStream(lexer);
    ForteParser parser = new ForteParser(tokenStream);
    CommonTree tree = (CommonTree) parser.cdfFile().getTree();
    printTree(tree);
    int errors = parser.getNumberOfSyntaxErrors();
    int treeerrorsCDF = 0;
View Full Code Here

  }
  public int testClassImplementationFile(File cex, boolean failOnError) throws RecognitionException, IOException {
    CharStream stream =
        new NoCaseFileStream(cex.getAbsolutePath());
    ForteLexer lexer = new ForteLexer(stream);
    TokenStream tokenStream = new CommonTokenStream(lexer);
    ForteParser parser = new ForteParser(tokenStream);
    printTree(parser.implementationFile().getTree());
    int errors = parser.getNumberOfSyntaxErrors();
    if (failOnError && errors > 0Assert.fail() ;
    return errors;
View Full Code Here

    if (!prx.exists())
      return;
    CharStream stream =
        new NoCaseFileStream(prx.getAbsolutePath());
    ForteLexer lexer = new ForteLexer(stream);
    TokenStream tokenStream = new CommonTokenStream(lexer);
    ForteParser parser = new ForteParser(tokenStream);
    CommonTree tree = (CommonTree) parser.project().getTree();
    printTree(tree);
    int errors = parser.getNumberOfSyntaxErrors();
    System.out.println(prx.getName() + " completed with " + errors + " errors");
View Full Code Here

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

    CharStream stream =
        new NoCaseStringStream("sql select * from PaintingTab\n" +
            "          where Painter = :painter.name\n" +
            "        on session self.MGRSession;");
    ForteLexer lexer = new ForteLexer(stream);
    TokenStream tokenStream = new CommonTokenStream(lexer);
    ForteParser parser = new ForteParser(tokenStream);
    sql_select_return sql = parser.sql_select();
    CommonTree tree = (CommonTree) sql.getTree();
    System.out.println("SQL:" + tree.toString());
    int 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

  public void assignmentStatement_1(){
    try {
      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

  public void assignmentStatement_2(){
    try {
      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

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.