forked from JavaTX/JavaCompilerCore
Add possibility to parse a String to parser
This commit is contained in:
parent
0ad97251ca
commit
2167a4288e
@ -9,6 +9,7 @@ import org.antlr.v4.runtime.ANTLRInputStream;
|
|||||||
import org.antlr.v4.runtime.CommonTokenStream;
|
import org.antlr.v4.runtime.CommonTokenStream;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -40,4 +41,8 @@ public class JavaTXParser {
|
|||||||
public SourceFile parse(File file) throws IOException, ClassNotFoundException {
|
public SourceFile parse(File file) throws IOException, ClassNotFoundException {
|
||||||
return this.parse(new FileInputStream(file));
|
return this.parse(new FileInputStream(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SourceFile parse(String fileContent) throws IOException, ClassNotFoundException {
|
||||||
|
return this.parse(new ByteArrayInputStream(fileContent.getBytes(StandardCharsets.UTF_8)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user