public List<DocItem> collect(Path file) throws IOException { this.file = file; doc = new ArrayList<>(); CharStream input = CharStreams.fromPath(file, StandardCharsets.UTF_8); FuzzyDocLexer lexer = new FuzzyDocLexer(input); ANTLRErrorListener error = errorListener(LoggerFactory.getLogger(DocCollector.class), file); lexer.removeErrorListeners(); lexer.addErrorListener(error); TokenStream tokens = new CommonTokenStream(lexer); FuzzyDocParser parser = new FuzzyDocParser(tokens); parser.removeErrorListeners(); parser.addErrorListener(error); ParseTreeWalker.DEFAULT.walk(this, parser.source()); return doc; }
/** * Creates a {@link CharStream} given a path to a UTF-8 * encoded file on disk. * * Reads the entire contents of the file into the result before returning. */ public static CharStream fromPath(Path path) throws IOException { return fromPath(path, StandardCharsets.UTF_8); }
/** * Creates a {@link CharStream} given a string containing a * path to a UTF-8 file on disk. * * Reads the entire contents of the file into the result before returning. */ public static CharStream fromFileName(String fileName) throws IOException { return fromPath(Paths.get(fileName), StandardCharsets.UTF_8); }
/** * Creates a {@link CharStream} given a string containing a * path to a file on disk and the charset of the bytes * contained in the file. * * Reads the entire contents of the file into the result before returning. */ public static CharStream fromFileName(String fileName, Charset charset) throws IOException { return fromPath(Paths.get(fileName), charset); }
public List<Token> tokenize(File file) throws IOException { return getAllTokens(lexerInstance(CharStreams.fromPath(file.toPath()))); }
public Iterator<Token> getTokenIterator(File file) throws IOException { return new TokenIterator(this, lexerInstance(CharStreams.fromPath(file.toPath()))); }
/** * Creates a {@link CharStream} given a path to a UTF-8 * encoded file on disk. * * Reads the entire contents of the file into the result before returning. */ public static CharStream fromPath(Path path) throws IOException { return fromPath(path, StandardCharsets.UTF_8); }
@Override public CharStream chars() throws Exception { return CharStreams.fromPath(this.path, this.charset); } }
/** * Creates a {@link CharStream} given a string containing a * path to a file on disk and the charset of the bytes * contained in the file. * * Reads the entire contents of the file into the result before returning. */ public static CharStream fromFileName(String fileName, Charset charset) throws IOException { return fromPath(Paths.get(fileName), charset); }
/** * Creates a {@link CharStream} given a string containing a * path to a UTF-8 file on disk. * * Reads the entire contents of the file into the result before returning. */ public static CharStream fromFileName(String fileName) throws IOException { return fromPath(Paths.get(fileName), StandardCharsets.UTF_8); }
@Override public CompileStatus compile(Path path) throws CompileException { try { return compile(CharStreams.fromPath(path)); } catch (IOException e) { throw new CompileException(e.getMessage(), e); } catch (Exception e) { throw new CompileException(e.getMessage(), e); } }
CharStream charStream = CharStreams.fromPath(Paths.get(inputFile), charset); if ( inputFiles.size()>1 ) { System.err.println(inputFile);
CharStream charStream = CharStreams.fromPath(Paths.get(inputFile), charset); if ( inputFiles.size()>1 ) { System.err.println(inputFile);
CharStream localcs = CharStreams.fromPath(filePath); RouteParser.ConfigurationContext localtree = getTree(localcs, conflistener); lockedProperties.forEach( i -> conflistener.lockProperty(i));