public class GenericParser extends Object
Constructor and Description |
---|
GenericParser(File... gfile)
File was not found
|
GenericParser(String... gcontent)
constructor
|
GenericParser(ToolCustomizer tlc,
boolean useCached,
String... content)
constructor
|
GenericParser(ToolCustomizer tlc,
File... gfile)
constructor
|
GenericParser(ToolCustomizer tlc,
String... gcontent)
constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addUtilityJavaFiles(File... fils)
add utility Java classes on which the antlr grammar depend on
|
void |
addUtilityJavaFiles(String... fils)
add utility Java classes on which the antlr grammar depend on
|
boolean |
antrlObjectsAvailable() |
boolean |
compile()
compile generic parser
|
MemoryTupleSet |
getAllCompiledObjects()
get all compiled antlr objects (lexer, parser, etc) in source and bytecode format
|
org.antlr.v4.runtime.tree.ParseTreeListener |
getListener()
get parse tree listener
|
static GenericParser |
independentInstance(ToolCustomizer tlc,
String content) |
static GenericParser |
instance(ToolCustomizer tlc,
String content)
a signle instance of a generic parser
|
static GenericParser |
load(String file)
load serialized generic parser
|
org.antlr.v4.runtime.ParserRuleContext |
parse(File toParse)
parse file content an create a context
|
org.antlr.v4.runtime.ParserRuleContext |
parse(File toParse,
String production)
parse in fresh
|
org.antlr.v4.runtime.ParserRuleContext |
parse(String toParse)
parse string an create a context
|
org.antlr.v4.runtime.ParserRuleContext |
parse(String toParse,
String production)
parse in fresh
|
void |
setClassPath(List cp) |
void |
setListener(DefaultListener listener)
set parse tree listener
|
void |
store(String file,
boolean overwrite)
serialize generic parser
|
public GenericParser(ToolCustomizer tlc, String... gcontent)
gcontent
- List of antlr grammar contenttlc
- a ToolCustomizerpublic GenericParser(String... gcontent)
gcontent
- List of antlr grammar contentpublic GenericParser(ToolCustomizer tlc, File... gfile) throws FileNotFoundException
gfile
- List of antlr grammar filestlc
- a ToolCustomizerFileNotFoundException
- file not foundpublic GenericParser(File... gfile) throws FileNotFoundException
gfile
- List of antlr grammar filesFileNotFoundException
- file not foundpublic GenericParser(ToolCustomizer tlc, boolean useCached, String... content)
content
- grammar file contenttlc
- a ToolCustomizeruseCached
- true to used cached lexers, otherwise falsepublic void addUtilityJavaFiles(File... fils) throws FileNotFoundException
fils
- list of Java filesFileNotFoundException
- Java file does not existpublic void addUtilityJavaFiles(String... fils) throws FileNotFoundException
fils
- list of paths to Java filesFileNotFoundException
- Java file does not existpublic static GenericParser instance(ToolCustomizer tlc, String content)
content
- grammar contenttlc
- a ToolCustomizerpublic static GenericParser independentInstance(ToolCustomizer tlc, String content)
public void setClassPath(List cp)
public boolean compile()
public org.antlr.v4.runtime.ParserRuleContext parse(File toParse) throws IllegalWorkflowException, FileNotFoundException
toParse
- string to parseIllegalWorkflowException
- if compilation did not take placeFileNotFoundException
- if input file cannot be foundpublic org.antlr.v4.runtime.ParserRuleContext parse(String toParse) throws IllegalWorkflowException
toParse
- string to parseIllegalWorkflowException
- if compilation did not take placepublic org.antlr.v4.runtime.ParserRuleContext parse(File toParse, String production) throws IllegalWorkflowException, FileNotFoundException
toParse
- file to parseproduction
- production name to parseIllegalWorkflowException
- sources are not compiledFileNotFoundException
- file not foundpublic org.antlr.v4.runtime.ParserRuleContext parse(String toParse, String production) throws IllegalWorkflowException
toParse
- string to parseproduction
- production name to parseIllegalWorkflowException
- if compilation did not take placepublic org.antlr.v4.runtime.tree.ParseTreeListener getListener()
public void setListener(DefaultListener listener)
listener
- listener to usepublic MemoryTupleSet getAllCompiledObjects()
public boolean antrlObjectsAvailable()
public void store(String file, boolean overwrite) throws SerializationException
file
- path where generic parser is supposed to be storedoverwrite
- overwrite fileSerializationException
- generic parser is not serializablepublic static GenericParser load(String file) throws DeserializationException
file
- file of serialized generic parser fileDeserializationException
- generic parser is not de-serializableCopyright © 2017. All rights reserved.