Example usage for org.antlr.v4.runtime CharStreams fromPath

List of usage examples for org.antlr.v4.runtime CharStreams fromPath

Introduction

In this page you can find the example usage for org.antlr.v4.runtime CharStreams fromPath.

Prototype

public static CharStream fromPath(Path path, Charset charset) throws IOException 

Source Link

Document

Creates a CharStream given a path to a file on disk and the charset of the bytes contained in the file.

Usage

From source file:org.kie.dmn.feel.parser.feel11.FEELTestRig.java

License:Apache License

@Override
public void process() throws Exception {
    Charset charset = (encoding == null ? Charset.defaultCharset() : Charset.forName(encoding));
    if (inputFiles.size() == 0) {
        CharStream charStream = CharStreams.fromStream(System.in, charset);
        process(lexer, parserClass, parser, charStream);
        return;/*from w w w. j  ava 2 s  . c om*/
    }
    for (String inputFile : inputFiles) {
        CharStream charStream = CharStreams.fromPath(Paths.get(inputFile), charset);
        if (inputFiles.size() > 1) {
            System.err.println(inputFile);
        }
        process(lexer, parserClass, parser, charStream);
    }
}