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>editorInterfaceList<DroolsParserException>errorsbooleanisEditorInterfaceEnabledString[]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 voidbeginSentence(DroolsSentenceType sentenceType)voiddisableEditorInterface()voidemit(int activeContext)voidemit(List<?> tokens, DroolsEditorType editorType)voidemit(org.antlr.runtime.Token token, DroolsEditorType editorType)voidenableEditorInterface()<T extends DescrBuilder<?,?>>
Tend(Class<T> clazz, DescrBuilder<?,?> builder)DroolsSentencegetActiveSentence()LinkedList<DroolsSentence>getEditorInterface()List<String>getErrorMessages()Return a list of pretty strings summarising the errorsList<DroolsParserException>getErrors()return the raw DroolsParserException errorsbooleangetHasOperator()DroolsTokengetLastTokenOnList(LinkedList<?> list)StringgetLeftMostExpr()String[]getStatementKeywords()booleanhasErrors()return true if any parser errors were accumulatedbooleanisPluggableEvaluator(boolean negated)booleanisPluggableEvaluator(int offset, boolean negated)Map<DroolsParaphraseTypes,String>popParaphrases()voidpushParaphrases(DroolsParaphraseTypes type)Method that adds a paraphrase type into paraphrases stack.voidreportError(Exception e)voidreportError(org.antlr.runtime.RecognitionException ex)StringretrieveLT(int LTNumber)voidsetHasOperator(boolean hasOperator)voidsetLeftMostExpr(String value)voidsetParaphrasesValue(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)booleanvalidateAttribute(int index)booleanvalidateCEKeyword(int index)booleanvalidateIdentifierKey(String text)booleanvalidateLT(int LTNumber, String text)booleanvalidateStatement(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()
-
-