Package org.antlr.runtime

Examples of org.antlr.runtime.ANTLRFileStream


          +"java ro.pub.cpl.sq2.hello1.Interpreter <file.sq2>"
          +"java ro.pub.cpl.sq2.hello1.Interpreter <file.sq2> <file.ir>"
          );
    }
    else try {
      ANTLRFileStream input = new ANTLRFileStream(args[0]);
      Sq2Lexer lexer = new Sq2Lexer(input);
      CommonTokenStream tokens = new CommonTokenStream (lexer);
      Sq2Parser parser = new Sq2Parser(tokens);       
      Program p = parser.program();
      // TODO Populate symbol table with predefine functions
View Full Code Here


      // if input test file is not found under the current dir, also try to look for it under the package dir
      if ( !testInputFile.exists() && packagePath!=null ) {
        testInputFile = new File(packagePath, filePath);
        if ( testInputFile.exists() ) filePath = testInputFile.getCanonicalPath();
      }
      input = new ANTLRFileStream(filePath);
    }
    else {
      input = new ANTLRStringStream(testInput);
    }
    Class lexer = null;
View Full Code Here

      // if input test file is not found under the current dir, also try to look for it under the package dir
      if ( !testInputFile.exists() && packagePath!=null ) {
        testInputFile = new File(packagePath, filePath);
        if ( testInputFile.exists() ) filePath = testInputFile.getCanonicalPath();
      }
      input = new ANTLRFileStream(filePath);
    }
    else {
      input = new ANTLRStringStream(testInput);
    }
    Class lexer = null;
View Full Code Here

      // if input test file is not found under the current dir, also try to look for it under the package dir
      if ( !testInputFile.exists() && packagePath!=null ) {
        testInputFile = new File(packagePath, filePath);
        if ( testInputFile.exists() ) filePath = testInputFile.getCanonicalPath();
      }
      input = new ANTLRFileStream(filePath);
    }
    else {
      input = new ANTLRStringStream(testInput);
    }
    Class lexer = null;
View Full Code Here

    String lexerGrammarText = parser.getLexerGrammar();
    Grammar lexer = new Grammar();
    lexer.importTokenVocabulary(parser);
    lexer.setGrammarContent(lexerGrammarText);
    CharStream input =
      new ANTLRFileStream(inputFileName);
    Interpreter lexEngine = new Interpreter(lexer, input);
    CommonTokenStream tokens = new CommonTokenStream(lexEngine);
    StringTokenizer tk = new StringTokenizer(ignoreTokens, " ");
    while ( tk.hasMoreTokens() ) {
      String tokenName = tk.nextToken();
View Full Code Here

   */
  static CommonTree parseFile(String filename) throws IOException,
      RecognitionException {

    // Create a scanner and parser that reads from the input stream passed to us
    FlumeDeployLexer lexer = new FlumeDeployLexer(new ANTLRFileStream(filename));
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    FlumeDeployParser parser = new FlumeDeployParser(tokens);

    return (CommonTree) parser.deflist().getTree();
  }
View Full Code Here

   */
  static CommonTree parseNodeFile(String filename) throws IOException,
      RecognitionException {

    // Create a scanner and parser that reads from the input stream passed to us
    FlumeDeployLexer lexer = new FlumeDeployLexer(new ANTLRFileStream(filename));
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    FlumeDeployParser parser = new FlumeDeployParser(tokens);

    return (CommonTree) parser.connection().getTree();
  }
View Full Code Here

    try {
      // Create a scanner that reads from the input stream passed to us
      if ( lexer==null ) {
        lexer = new JavaLexer();
      }
      lexer.setCharStream(new ANTLRFileStream(f));
      CommonTokenStream tokens = new CommonTokenStream();
      tokens.setTokenSource(lexer);
      long start = System.currentTimeMillis();
      tokens.LT(1); // force load
      long stop = System.currentTimeMillis();
View Full Code Here

    try {
      // Create a scanner that reads from the input stream passed to us
      if ( lexer==null ) {
        lexer = new JavaLexer();
      }
      lexer.setCharStream(new ANTLRFileStream(f));
      CommonTokenStream tokens = new CommonTokenStream(lexer);
      long start = System.currentTimeMillis();
      tokens.fill(); // force load
      long stop = System.currentTimeMillis();
      lexerTime += stop-start;
View Full Code Here

    try {
      // Create a scanner that reads from the input stream passed to us
      if ( lexer==null ) {
        lexer = new JavaLexer();
      }
      lexer.setCharStream(new ANTLRFileStream(f));
      CommonTokenStream tokens = new CommonTokenStream(lexer);
      tokens.fill();
      long start = System.currentTimeMillis();
      tokens.LT(1); // force load
      long stop = System.currentTimeMillis();
View Full Code Here

TOP

Related Classes of org.antlr.runtime.ANTLRFileStream

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.