Package org.drools.compiler.lang
Class ParserHelper
- java.lang.Object
-
- org.drools.compiler.lang.ParserHelper
-
public class ParserHelper extends Object
This is a class to hold all the helper functions/methods used by the DRL parser
-
-
Field Summary
Fields Modifier and Type Field Description LinkedList<DroolsSentence>
editorInterface
List<DroolsParserException>
errors
boolean
isEditorInterfaceEnabled
String[]
statementKeywords
-
Constructor Summary
Constructors Constructor Description ParserHelper(org.antlr.runtime.TokenStream input, org.antlr.runtime.RecognizerSharedState state, org.kie.internal.builder.conf.LanguageLevelOption languageLevel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
beginSentence(DroolsSentenceType sentenceType)
void
disableEditorInterface()
void
emit(int activeContext)
void
emit(List<?> tokens, DroolsEditorType editorType)
void
emit(org.antlr.runtime.Token token, DroolsEditorType editorType)
void
enableEditorInterface()
<T extends DescrBuilder<?,?>>
Tend(Class<T> clazz, DescrBuilder<?,?> builder)
DroolsSentence
getActiveSentence()
LinkedList<DroolsSentence>
getEditorInterface()
List<String>
getErrorMessages()
Return a list of pretty strings summarising the errorsList<DroolsParserException>
getErrors()
return the raw DroolsParserException errorsboolean
getHasOperator()
DroolsToken
getLastTokenOnList(LinkedList<?> list)
String
getLeftMostExpr()
String[]
getStatementKeywords()
boolean
hasErrors()
return true if any parser errors were accumulatedboolean
isPluggableEvaluator(boolean negated)
boolean
isPluggableEvaluator(int offset, boolean negated)
Map<DroolsParaphraseTypes,String>
popParaphrases()
void
pushParaphrases(DroolsParaphraseTypes type)
Method that adds a paraphrase type into paraphrases stack.void
reportError(Exception e)
void
reportError(org.antlr.runtime.RecognitionException ex)
String
retrieveLT(int LTNumber)
void
setHasOperator(boolean hasOperator)
void
setLeftMostExpr(String value)
void
setParaphrasesValue(DroolsParaphraseTypes type, String value)
Method that sets paraphrase value for a type into paraphrases stack.<T extends DescrBuilder<?,?>>
Tstart(DescrBuilder<?,?> ctxBuilder, Class<T> clazz, String param)
boolean
validateAttribute(int index)
boolean
validateCEKeyword(int index)
boolean
validateIdentifierKey(String text)
boolean
validateLT(int LTNumber, String text)
boolean
validateStatement(int index)
-
-
-
Field Detail
-
statementKeywords
public final String[] statementKeywords
-
errors
public List<DroolsParserException> errors
-
editorInterface
public LinkedList<DroolsSentence> editorInterface
-
isEditorInterfaceEnabled
public boolean isEditorInterfaceEnabled
-
-
Method Detail
-
getEditorInterface
public LinkedList<DroolsSentence> getEditorInterface()
-
setLeftMostExpr
public void setLeftMostExpr(String value)
-
getLeftMostExpr
public String getLeftMostExpr()
-
enableEditorInterface
public void enableEditorInterface()
-
disableEditorInterface
public void disableEditorInterface()
-
setHasOperator
public void setHasOperator(boolean hasOperator)
-
getHasOperator
public boolean getHasOperator()
-
beginSentence
public void beginSentence(DroolsSentenceType sentenceType)
-
getActiveSentence
public DroolsSentence getActiveSentence()
-
emit
public void emit(List<?> tokens, DroolsEditorType editorType)
-
emit
public void emit(org.antlr.runtime.Token token, DroolsEditorType editorType)
-
emit
public void emit(int activeContext)
-
getLastTokenOnList
public DroolsToken getLastTokenOnList(LinkedList<?> list)
-
retrieveLT
public String retrieveLT(int LTNumber)
-
validateLT
public boolean validateLT(int LTNumber, String text)
-
isPluggableEvaluator
public boolean isPluggableEvaluator(int offset, boolean negated)
-
isPluggableEvaluator
public boolean isPluggableEvaluator(boolean negated)
-
validateIdentifierKey
public boolean validateIdentifierKey(String text)
-
validateCEKeyword
public boolean validateCEKeyword(int index)
-
validateStatement
public boolean validateStatement(int index)
-
validateAttribute
public boolean validateAttribute(int index)
-
reportError
public void reportError(org.antlr.runtime.RecognitionException ex)
-
reportError
public void reportError(Exception e)
-
getErrors
public List<DroolsParserException> getErrors()
return the raw DroolsParserException errors
-
getErrorMessages
public List<String> getErrorMessages()
Return a list of pretty strings summarising the errors
-
hasErrors
public boolean hasErrors()
return true if any parser errors were accumulated
-
pushParaphrases
public void pushParaphrases(DroolsParaphraseTypes type)
Method that adds a paraphrase type into paraphrases stack.- Parameters:
type
- paraphrase type
-
popParaphrases
public Map<DroolsParaphraseTypes,String> popParaphrases()
-
setParaphrasesValue
public void setParaphrasesValue(DroolsParaphraseTypes type, String value)
Method that sets paraphrase value for a type into paraphrases stack.- Parameters:
type
- paraphrase typevalue
- paraphrase value
-
start
public <T extends DescrBuilder<?,?>> T start(DescrBuilder<?,?> ctxBuilder, Class<T> clazz, String param)
-
end
public <T extends DescrBuilder<?,?>> T end(Class<T> clazz, DescrBuilder<?,?> builder)
-
getStatementKeywords
public String[] getStatementKeywords()
-
-