Class TaskTagParser

  • All Implemented Interfaces:
    Parser

    public class TaskTagParser
    extends AbstractParser
    Parser that identifies "task tags," such as "TODO", "FIXME", etc. in source code comments.
    Version:
    1.0
    • Field Detail

      • DEFAULT_TASK_PATTERN

        private static final java.lang.String DEFAULT_TASK_PATTERN
        See Also:
        Constant Field Values
      • taskPattern

        private java.util.regex.Pattern taskPattern
      • COLOR

        private static final java.awt.Color COLOR
    • Constructor Detail

      • TaskTagParser

        public TaskTagParser()
        Creates a new task parser. The default parser treats the following identifiers in comments as task definitions: "TODO", "FIXME", and "HACK".
    • Method Detail

      • getTaskPattern

        public java.lang.String getTaskPattern()
        Returns the regular expression used to search for tasks.
        Returns:
        The regular expression. This may be null if no regular expression was specified (or an empty string was specified).
        See Also:
        setTaskPattern(String)
      • parse

        public ParseResult parse​(RSyntaxDocument doc,
                                 java.lang.String style)
        Description copied from interface: Parser
        Parses input from the specified document.
        Parameters:
        doc - The document to parse. This document is in a read lock, so it cannot be modified while parsing is occurring.
        style - The language being rendered, such as SyntaxConstants.SYNTAX_STYLE_JAVA.
        Returns:
        An object describing the section of the document parsed and the results. This is guaranteed to be non-null.
      • setTaskPattern

        public void setTaskPattern​(java.lang.String pattern)
        Sets the pattern of task identifiers. You will usually want this to be a list of words "or'ed" together, such as "TODO|FIXME|HACK|REMIND".
        Parameters:
        pattern - The pattern. A value of null or an empty string effectively disables task parsing.
        Throws:
        java.util.regex.PatternSyntaxException - If pattern is an invalid regular expression.
        See Also:
        getTaskPattern()