Class ParserHelper


  • public class ParserHelper
    extends java.lang.Object
    This is a class to hold all the helper functions/methods used by the DRL parser
    • Field Detail

      • statementKeywords

        public final java.lang.String[] statementKeywords
      • editorInterface

        public java.util.LinkedList<DroolsSentence> editorInterface
      • isEditorInterfaceEnabled

        public boolean isEditorInterfaceEnabled
    • Constructor Detail

      • ParserHelper

        public ParserHelper​(org.antlr.runtime.TokenStream input,
                            org.antlr.runtime.RecognizerSharedState state,
                            org.kie.internal.builder.conf.LanguageLevelOption languageLevel)
    • Method Detail

      • getEditorInterface

        public java.util.LinkedList<DroolsSentence> getEditorInterface()
      • setLeftMostExpr

        public void setLeftMostExpr​(java.lang.String value)
      • getLeftMostExpr

        public java.lang.String getLeftMostExpr()
      • enableEditorInterface

        public void enableEditorInterface()
      • disableEditorInterface

        public void disableEditorInterface()
      • setHasOperator

        public void setHasOperator​(boolean hasOperator)
      • getHasOperator

        public boolean getHasOperator()
      • emit

        public void emit​(java.util.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​(java.util.LinkedList<?> list)
      • retrieveLT

        public java.lang.String retrieveLT​(int LTNumber)
      • validateLT

        public boolean validateLT​(int LTNumber,
                                  java.lang.String text)
      • isPluggableEvaluator

        public boolean isPluggableEvaluator​(int offset,
                                            boolean negated)
      • isPluggableEvaluator

        public boolean isPluggableEvaluator​(boolean negated)
      • validateIdentifierKey

        public boolean validateIdentifierKey​(java.lang.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​(java.lang.Exception e)
      • getErrors

        public java.util.List<DroolsParserException> getErrors()
        return the raw DroolsParserException errors
      • getErrorMessages

        public java.util.List<java.lang.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
      • setParaphrasesValue

        public void setParaphrasesValue​(DroolsParaphraseTypes type,
                                        java.lang.String value)
        Method that sets paraphrase value for a type into paraphrases stack.
        Parameters:
        type - paraphrase type
        value - paraphrase value
      • start

        public <T extends org.drools.drl.ast.dsl.DescrBuilder<?,​?>> T start​(org.drools.drl.ast.dsl.DescrBuilder<?,​?> ctxBuilder,
                                                                                  java.lang.Class<T> clazz,
                                                                                  java.lang.String param)
      • end

        public <T extends org.drools.drl.ast.dsl.DescrBuilder<?,​?>> T end​(java.lang.Class<T> clazz,
                                                                                org.drools.drl.ast.dsl.DescrBuilder<?,​?> builder)
      • getStatementKeywords

        public java.lang.String[] getStatementKeywords()