org.drools.compiler
Class DrlParser

java.lang.Object
  extended by org.drools.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.


Constructor Summary
DrlParser()
           
 
Method Summary
 DefaultExpanderResolver getDefaultResolver(Reader dsl)
           
 List<DroolsSentence> getEditorSentences()
           
 List<DroolsError> getErrors()
           
 String getExpandedDRL(String source, DefaultExpanderResolver resolver)
          This will expand the DRL using the given expander resolver. useful for debugging.
 String getExpandedDRL(String source, Reader dsl)
          This will expand the DRL. useful for debugging.
 Location getLocation()
           
 boolean hasErrors()
           
 PackageDescr parse(boolean isEditor, InputStream is)
           
 PackageDescr parse(boolean isEditor, Reader reader)
           
 PackageDescr parse(boolean isEditor, Reader drl, Reader dsl)
           
 PackageDescr parse(boolean isEditor, String text)
           
 PackageDescr parse(boolean isEditor, String source, Reader dsl)
          Parse and build a rule package from a DRL source with a domain specific language.
 PackageDescr parse(InputStream is)
           
 PackageDescr parse(Reader reader)
           
 PackageDescr parse(Reader drl, Reader dsl)
          Parse and build a rule package from a DRL source with a domain specific language.
 PackageDescr parse(String text)
          Parse a rule from text
 PackageDescr parse(String source, Reader dsl)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DrlParser

public DrlParser()
Method Detail

parse

public PackageDescr parse(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(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:
DroolsParserException
IOException

parse

public PackageDescr parse(boolean isEditor,
                          Reader drl,
                          Reader dsl)
                   throws DroolsParserException,
                          IOException
Throws:
DroolsParserException
IOException

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(boolean isEditor,
                          InputStream is)
                   throws DroolsParserException
Throws:
DroolsParserException

parse

public PackageDescr parse(InputStream is)
                   throws DroolsParserException
Throws:
DroolsParserException

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 DSL
dsl - - 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 DSL
resolver - - 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()


Copyright © 2001-2013 JBoss Inc.. All Rights Reserved.