Package org.antlr.runtime

Examples of org.antlr.runtime.ANTLRFileStream


  private HashMap<String,BstFunction> buildInFunctions;

  public File file;

  public VM(File f) throws RecognitionException, IOException {
    this(new ANTLRFileStream(f.getPath()));
    this.file = f;
  }
View Full Code Here


    }
  }

  private RutaModule loadScript(String scriptLocation) throws IOException, RecognitionException {
    File scriptFile = new File(scriptLocation);
    CharStream st = new ANTLRFileStream(scriptLocation, scriptEncoding);
    RutaLexer lexer = new RutaLexer(st);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    RutaParser parser = new RutaParser(tokens);
    parser.setExternalFactory(factory);
    parser.setResourcePaths(resourcePaths);
View Full Code Here

  }

  @Test
  public void compostieModel() throws org.antlr.runtime.RecognitionException,
      IOException {
    CharStream input = new ANTLRFileStream(
        "src/main/java/samples/CompositeModel.java");
    ModelLexer lex = new ModelLexer(input);
    CommonTokenStream tokens = new CommonTokenStream(lex);
    ModelParser p = new ModelParser(tokens);
    p.compilationUnit();
View Full Code Here

      final String scriptPath = script.getAbsolutePath();
      System.out.println( "Executing script " + scriptPath );
      try {
        String scriptBaseName = StringUtils.chompLast( FileUtils.basename( script.getName() ), "." );

        ANTLRFileStream antlrStream = new ANTLRFileStream( scriptPath );
        GrammarInfo grammarInfo = Interp.parse( antlrStream );
        gUnitExecutor executor = new gUnitExecutor(
            grammarInfo,
            projectCompileScopeClassLoader,
            script.getParentFile().getAbsolutePath()
View Full Code Here

      File file = new File(fileName);
      if (!file.isAbsolute()) {
        file = new File(inputDirectory, fileName);
      }

      ANTLRFileStream in = new ANTLRFileStream(file.getAbsolutePath(), grammarEncoding);
      GrammarRootAST t = parse(fileName, in);
      return t;
    }
    catch (IOException ioe) {
      errMgr.toolError(ErrorType.CANNOT_OPEN_FILE, ioe, fileName);
View Full Code Here

        errMgr.grammarError(ErrorType.CANNOT_FIND_IMPORTED_GRAMMAR, g.fileName, nameNode.getToken(), name);
        return null;
      }

      String absolutePath = importedFile.getAbsolutePath();
      ANTLRFileStream in = new ANTLRFileStream(absolutePath, grammarEncoding);
      GrammarRootAST root = parse(g.fileName, in);
      if (root == null) {
        return null;
      }
View Full Code Here

    }
  }

  private RutaModule loadScript(String scriptLocation) throws IOException, RecognitionException {
    File scriptFile = new File(scriptLocation);
    CharStream st = new ANTLRFileStream(scriptLocation, scriptEncoding);
    RutaLexer lexer = new RutaLexer(st);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    RutaParser parser = new RutaParser(tokens);
    parser.setExternalFactory(factory);
    parser.setResourcePaths(resourcePaths);
View Full Code Here

      final String scriptPath = script.getAbsolutePath();
      System.out.println( "Executing script " + scriptPath );
      try {
        String scriptBaseName = StringUtils.chompLast( FileUtils.basename( script.getName() ), "." );

        ANTLRFileStream antlrStream = new ANTLRFileStream( scriptPath );
        GrammarInfo grammarInfo = Interp.parse( antlrStream );
        gUnitExecutor executor = new gUnitExecutor(
            grammarInfo,
            projectCompileScopeClassLoader,
            script.getParentFile().getAbsolutePath()
View Full Code Here

    public static Map<String,Object> readFig(String fileName)
        throws IOException, RecognitionException
    {
        // Create lexer attached to character stream from fileName
        FigLexer lexer = new FigLexer(new ANTLRFileStream(fileName));
        // Create a buffer of tokens feeding off of lexer
        CommonTokenStream tokens = new CommonTokenStream(lexer);
        // Create parser feeding off of token buffer
        FigParser p = new FigParser(tokens);
        return p.file(); // parse, return dictionary of config'd objects
View Full Code Here

   *
   * @param path 
   * @return parser
   */
  public static HaxeParser createHaxeParser(final String path) {
    ANTLRFileStream charStream = null;
    try {
      charStream = new ANTLRFileStream(path);
    } catch (IOException e1) {
      e1.printStackTrace();
      Assert.fail("Exception on reading file");
    }
    HaxeLexer lexer = new HaxeLexer(charStream);
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.