Package org.drools.compiler.compiler
Class DrlParser
- java.lang.Object
-
- org.drools.compiler.compiler.DrlParser
-
public class DrlParser extends Object
This is a low level parser API. This will return textual AST representations of the DRL source, including with DSL expanders if appropriate.
-
-
Field Summary
Fields Modifier and Type Field Description static org.kie.internal.builder.conf.LanguageLevelOptionDEFAULT_LANGUAGE_LEVEL
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultExpanderResolvergetDefaultResolver(Reader dsl)List<DroolsSentence>getEditorSentences()List<DroolsError>getErrors()StringgetExpandedDRL(String source, Reader dsl)This will expand the DRL. useful for debugging.StringgetExpandedDRL(String source, DefaultExpanderResolver resolver)This will expand the DRL using the given expander resolver. useful for debugging.LocationgetLocation()booleanhasErrors()PackageDescrparse(boolean isEditor, Reader reader)PackageDescrparse(boolean isEditor, Reader drl, Reader dsl)PackageDescrparse(boolean isEditor, String text)PackageDescrparse(boolean isEditor, String source, Reader dsl)Parse and build a rule package from a DRL source with a domain specific language.PackageDescrparse(boolean isEditor, org.kie.api.io.Resource resource)PackageDescrparse(boolean isEditor, org.kie.api.io.Resource resource, InputStream is)PackageDescrparse(Reader reader)PackageDescrparse(Reader drl, Reader dsl)Parse and build a rule package from a DRL source with a domain specific language.PackageDescrparse(String source, Reader dsl)PackageDescrparse(org.kie.api.io.Resource resource)PackageDescrparse(org.kie.api.io.Resource resource, InputStream is)PackageDescrparse(org.kie.api.io.Resource resource, Reader reader)PackageDescrparse(org.kie.api.io.Resource resource, String text)Parse a rule from text
-
-
-
Method Detail
-
parse
public PackageDescr parse(org.kie.api.io.Resource resource, String text) throws DroolsParserException
Parse a rule from text- Throws:
DroolsParserException
-
parse
public PackageDescr parse(boolean isEditor, String text) throws DroolsParserException
- Throws:
DroolsParserException
-
parse
public PackageDescr parse(boolean isEditor, Reader reader) throws DroolsParserException
- Throws:
DroolsParserException
-
parse
public PackageDescr parse(org.kie.api.io.Resource resource, Reader reader) throws DroolsParserException
- Throws:
DroolsParserException
-
parse
public PackageDescr parse(Reader reader) throws DroolsParserException
- Throws:
DroolsParserException
-
parse
public PackageDescr parse(Reader drl, Reader dsl) throws DroolsParserException, IOException
Parse and build a rule package from a DRL source with a domain specific language.- Throws:
DroolsParserExceptionIOException
-
parse
public PackageDescr parse(boolean isEditor, Reader drl, Reader dsl) throws DroolsParserException, IOException
- Throws:
DroolsParserExceptionIOException
-
parse
public PackageDescr parse(boolean isEditor, String source, Reader dsl) throws DroolsParserException
Parse and build a rule package from a DRL source with a domain specific language.- Parameters:
source- As Text.dsl-- Returns:
- Throws:
DroolsParserException
-
parse
public PackageDescr parse(String source, Reader dsl) throws DroolsParserException
- Throws:
DroolsParserException
-
parse
public PackageDescr parse(org.kie.api.io.Resource resource) throws DroolsParserException, IOException
- Throws:
DroolsParserExceptionIOException
-
parse
public PackageDescr parse(org.kie.api.io.Resource resource, InputStream is) throws DroolsParserException, IOException
- Throws:
DroolsParserExceptionIOException
-
parse
public PackageDescr parse(boolean isEditor, org.kie.api.io.Resource resource) throws DroolsParserException, IOException
- Throws:
DroolsParserExceptionIOException
-
parse
public PackageDescr parse(boolean isEditor, org.kie.api.io.Resource resource, InputStream is) throws DroolsParserException, IOException
- Throws:
DroolsParserExceptionIOException
-
getExpandedDRL
public String getExpandedDRL(String source, Reader dsl) throws DroolsParserException
This will expand the DRL. useful for debugging.- Parameters:
source- - the source which use a DSLdsl- - the DSL itself.- Throws:
DroolsParserException- If unable to expand in any way.
-
getExpandedDRL
public String getExpandedDRL(String source, DefaultExpanderResolver resolver) throws DroolsParserException
This will expand the DRL using the given expander resolver. useful for debugging.- Parameters:
source- - the source which use a DSLresolver- - the DSL expander resolver itself.- Throws:
DroolsParserException- If unable to expand in any way.
-
hasErrors
public boolean hasErrors()
- Returns:
- true if there were parser errors.
-
getErrors
public List<DroolsError> getErrors()
- Returns:
- a list of errors found while parsing. DroolsError: either ParserError, or ExpanderException
-
getLocation
public Location getLocation()
-
getDefaultResolver
public DefaultExpanderResolver getDefaultResolver(Reader dsl) throws DroolsParserException
- Throws:
DroolsParserException
-
getEditorSentences
public List<DroolsSentence> getEditorSentences()
-
-