Package org.drools.drl.parser.antlr4
Class ParserHelper
java.lang.Object
org.drools.drl.parser.antlr4.ParserHelper
This is a class to hold all the helper functions/methods used
by the DRL parser
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionParserHelper(org.antlr.v4.runtime.TokenStream input, LanguageLevelOption languageLevel) -
Method Summary
Modifier and TypeMethodDescriptionvoidbeginSentence(DroolsSentenceType sentenceType) voidvoidemit(int activeContext) voidemit(List<?> tokens, DroolsEditorType editorType) voidemit(org.antlr.v4.runtime.Token token, DroolsEditorType editorType) void<T extends DescrBuilder<?,?>>
Tend(Class<T> clazz, DescrBuilder<?, ?> builder) Return a list of pretty strings summarising the errorsreturn the raw DroolsParserException errorsbooleangetLastTokenOnList(LinkedList<?> list) String[]booleanreturn true if any parser errors were accumulatedbooleanisPluggableEvaluator(boolean negated) Check if the next token is a registered operator.booleanisPluggableEvaluator(int offset, boolean negated) voidMethod that adds a paraphrase type into paraphrases stack.voidvoidreportError(Object offendingSymbol, int line, int charPositionInLine, String message, org.antlr.v4.runtime.RecognitionException ex) retrieveLT(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 Details
-
statementKeywords
-
errors
-
editorInterface
-
isEditorInterfaceEnabled
public boolean isEditorInterfaceEnabled
-
-
Constructor Details
-
ParserHelper
-
-
Method Details
-
getEditorInterface
-
setLeftMostExpr
-
getLeftMostExpr
-
enableEditorInterface
public void enableEditorInterface() -
disableEditorInterface
public void disableEditorInterface() -
setHasOperator
public void setHasOperator(boolean hasOperator) -
getHasOperator
public boolean getHasOperator() -
beginSentence
-
getActiveSentence
-
emit
-
emit
-
emit
public void emit(int activeContext) -
getLastTokenOnList
-
retrieveLT
-
validateLT
-
isPluggableEvaluator
public boolean isPluggableEvaluator(int offset, boolean negated) -
isPluggableEvaluator
public boolean isPluggableEvaluator(boolean negated) Check if the next token is a registered operator. The registry is dynamic, so we can add custom operators dynamically.- Parameters:
negated- true if the operator needs to support negation- Returns:
- true if the next token is a registered operator
- See Also:
-
validateIdentifierKey
-
validateCEKeyword
public boolean validateCEKeyword(int index) -
validateStatement
public boolean validateStatement(int index) -
validateAttribute
public boolean validateAttribute(int index) -
reportError
-
reportError
-
getErrors
return the raw DroolsParserException errors -
getErrorMessages
Return a list of pretty strings summarising the errors -
hasErrors
public boolean hasErrors()return true if any parser errors were accumulated -
pushParaphrases
Method that adds a paraphrase type into paraphrases stack.- Parameters:
type- paraphrase type
-
popParaphrases
-
setParaphrasesValue
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
-
getStatementKeywords
-