Package org.antlr.runtime

Examples of org.antlr.runtime.ANTLRFileStream


  public FrontendBeta (String grammarFilePath) throws IOException, RecognitionException, InvalidGrammarException {
   
    //====== Syntax check
    System.err.println("===============");
    System.err.println("Syntax");
    FTLSyntaxLexer lex = new FTLSyntaxLexer(new ANTLRFileStream(grammarFilePath));
        CommonTokenStream tokens = new CommonTokenStream(lex);
        FTLSyntaxParser parser = new FTLSyntaxParser (tokens);
        FTLSyntaxParser.root_return r = parser.root();       
       
    //====== Sort top levels
View Full Code Here


      System.out.println("  (checks pass)");
    }
   
   
        //ALELexer lexer = new ALELexer(new ANTLRFileStream(aleGrammar.replace("_", "USCORE")));
    ALELexer lexer = new ALELexer(new ANTLRFileStream(aleGrammar));
    CommonTokenStream tokens = new CommonTokenStream(lexer);
        ast = new ALEParser(tokens);
        ast.stripFloats = stripFloats;
        ast.root(); //force parse...
       
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

    }

    private boolean updateModuleVersion(Module module, Map<String,String> updatedModuleVersions) throws IOException,
            RecognitionException {
        String moduleDescriptorPath = module.getUnit().getFullPath();
        CeylonLexer lexer = new CeylonLexer(new ANTLRFileStream(moduleDescriptorPath, encoding));
        TokenRewriteStream tokenStream = new TokenRewriteStream(lexer);
        CeylonParser parser = new CeylonParser(tokenStream);
        Tree.CompilationUnit cu = parser.compilationUnit();
        String v = this.confirm == Confirm.dependencies ? this.newVersion : confirm("update.module.version", module.getNameAsString(), module.getVersion(), this.newVersion);
        if (v == null) {
View Full Code Here

    }

    private boolean updateModuleImports(Module module, Map<String,String> updatedModuleVersions) throws IOException,
            RecognitionException {
        String moduleDescriptorPath = module.getUnit().getFullPath();
        CeylonLexer lexer = new CeylonLexer(new ANTLRFileStream(moduleDescriptorPath, encoding));
        TokenRewriteStream tokenStream = new TokenRewriteStream(lexer);
        CeylonParser parser = new CeylonParser(tokenStream);
        Tree.CompilationUnit cu = parser.compilationUnit();
        List<Tree.ImportModule> moduleImports = findUpdatedImport(cu, updatedModuleVersions);
        for (Tree.ImportModule moduleImport : moduleImports) {
View Full Code Here

            RecognitionException {
        if (isMatch) {
            outputVersion(module);
        } else if (dependencies) {
            String moduleDescriptorPath = module.getUnit().getFullPath();
            CeylonLexer lexer = new CeylonLexer(new ANTLRFileStream(moduleDescriptorPath, encoding));
            CommonTokenStream tokenStream = new CommonTokenStream(lexer);
            CeylonParser parser = new CeylonParser(tokenStream);
            Tree.CompilationUnit cu = parser.compilationUnit();
            List<Tree.ImportModule> moduleImports = findImport(cu);
            for (Tree.ImportModule moduleImport : moduleImports) {
View Full Code Here

      this.filename = filename;
    }
    public void setInputStream(String sourceFile) {

      try {
        input = new ANTLRFileStream(sourceFile);
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
View Full Code Here

  {
    String inputFile = file.substring(file.lastIndexOf("/") + 1);
    String rawInputFile = inputFile.substring(0, inputFile.lastIndexOf("."));
    String base = file.substring(0, file.lastIndexOf("/"));

    lex = new JavaLexer(new ANTLRFileStream(file, "UTF8"));
    CommonTokenStream tokens = new CommonTokenStream(lex);

    JavaParser g = new JavaParser(tokens);
    try {
      // parse
View Full Code Here

      parseDirectory(file, typeParser);
      return; //Do not continue to parse as file
    }
   
    try {
      GuiceyDataLexer lexer = new GuiceyDataLexer(new ANTLRFileStream(file.getAbsolutePath()));
        CommonTokenStream tokens = new CommonTokenStream(lexer);

        GuiceyDataParser parser = new GuiceyDataParser(tokens);
        GuiceyDataParser.start_return ret = parser.start();
        CommonTree tree = (CommonTree)ret.getTree();
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.