Class ParseIssue

    • Field Detail

      • SOURCE_DELIMITER

        private static final java.lang.String SOURCE_DELIMITER
        See Also:
        Constant Field Values
      • _lineNumber

        private java.lang.Integer _lineNumber
      • _lineOffset

        private java.lang.Integer _lineOffset
      • _tokenColumn

        private java.lang.Integer _tokenColumn
      • _tokenStart

        private java.lang.Integer _tokenStart
      • _tokenEnd

        private java.lang.Integer _tokenEnd
      • _messageArgs

        private java.lang.Object[] _messageArgs
      • _stateSource

        private java.lang.String _stateSource
    • Constructor Detail

      • ParseIssue

        protected ParseIssue​(java.lang.Integer lineNumber,
                             java.lang.Integer lineOffset,
                             java.lang.Integer tokenColumn,
                             java.lang.Integer tokenStart,
                             java.lang.Integer tokenEnd,
                             ISymbolTable symbolTable,
                             ResourceKey key,
                             java.lang.Object... msgArgs)
      • ParseIssue

        protected ParseIssue​(IParserState state,
                             java.lang.Throwable t)
    • Method Detail

      • debug

        private void debug()
      • fillInStackTrace

        public java.lang.Throwable fillInStackTrace()
        Don't fill in stack trace since parse issues are not really "exceptional" in terms of the parser's Java implementation; we don't care much about the Java stack trace when these are thrown. Rather parse issues provide a means to tag parsed elements with issues discovered during parsing, such as syntax warnings and errors. Hence, the ParseIssue interface.

        Note this method is otherwise very costly from a performance standpoint.

        Overrides:
        fillInStackTrace in class java.lang.Throwable
      • initFieldsFromParserState

        private void initFieldsFromParserState​(IParserState parserState)
      • normalizeMessageArgs

        private java.lang.Object[] normalizeMessageArgs​(java.lang.Object[] args)
        Normalize all non string & non number args to string types to prevent race conditions wrt/ the TypeSystem lock when the message is formatted.
      • formatError

        protected static java.lang.String formatError​(ResourceKey key,
                                                      java.lang.Object... msgArgs)
      • getLineNumber

        public java.lang.Integer getLineNumber()
      • getLineOffset

        public java.lang.Integer getLineOffset()
      • addLineOffset

        public void addLineOffset​(int offset)
      • getTokenColumn

        public java.lang.Integer getTokenColumn()
      • getContextString

        public java.lang.String getContextString()
      • getContextStringNoLineNumbers

        public java.lang.String getContextStringNoLineNumbers()
      • getStateSource

        public java.lang.String getStateSource()
      • setStateSource

        public void setStateSource​(java.lang.String parserSource)
      • getMyMessage

        private java.lang.String getMyMessage()
      • getPlainMessage

        public java.lang.String getPlainMessage()
        Specified by:
        getPlainMessage in interface IParseIssue
        Returns:
        the raw message for this parse issue, with no formatting
      • getConsoleMessage

        public java.lang.String getConsoleMessage()
        Specified by:
        getConsoleMessage in interface IParseIssue
        Returns:
        the message for this parse issue formatted for printing out to a console
      • makeContextString

        public static java.lang.String makeContextString​(int lineOfError,
                                                         java.lang.String source,
                                                         int lineReportingOffset)
      • makeContextString

        private static java.lang.String makeContextString​(int lineOfError,
                                                          java.lang.String source,
                                                          int lineReportingOffset,
                                                          boolean showLineNumbers)
      • getUIMessage

        public java.lang.String getUIMessage()
        Specified by:
        getUIMessage in interface IParseIssue
        Returns:
        the message formatted for use by an IDE
      • getLine

        public int getLine()
        Specified by:
        getLine in interface IParseIssue
        Returns:
        the line that this issue is on
      • getSource

        public IParsedElement getSource()
        Warning: Only valid if called from the parser thread. Otherwise we null it out.
        Specified by:
        getSource in interface IParseIssue
        Returns:
        the parsed element that this issue is associated with
      • getSymbolTable

        public ISymbolTable getSymbolTable()
        Warning: Only valid if called from the parser thread. Otherwise we null it out.
        Specified by:
        getSymbolTable in interface IParseIssue
        Returns:
        the symbol table state at the creation of this issue. Can return null if no symbol table is present.
      • appliesToPosition

        public boolean appliesToPosition​(int iPos)
        Description copied from interface: IParseIssue
        Returns true if this issue is relevant to the given position
        Specified by:
        appliesToPosition in interface IParseIssue
      • getMessageKey

        public ResourceKey getMessageKey()
        Specified by:
        getMessageKey in interface IParseIssue
        Returns:
        the resource key for this ParseIssue, which can be used as a kind of identifier for the type of issue.
      • adjustOffset

        public void adjustOffset​(int offset,
                                 int lineNumOffset,
                                 int columnOffset)
      • setMessage

        public void setMessage​(ResourceKey key,
                               java.lang.Object... args)
      • getLineReportingOffset

        public int getLineReportingOffset()