Class FoldParserManager

  • All Implemented Interfaces:
    SyntaxConstants

    public class FoldParserManager
    extends Object
    implements SyntaxConstants
    Manages fold parsers. Instances of RSyntaxTextArea call into this class to retrieve fold parsers for whatever language they're editing. Folks implementing custom languages can add a FoldParser implementation for their language to this manager and it will be used by RSTA.
    • Method Detail

      • addFoldParserMapping

        public void addFoldParserMapping​(String syntaxStyle,
                                         FoldParser parser)
        Adds a mapping from a syntax style to a fold parser. The parser specified will be shared among all RSTA instances editing that language, so it should be stateless (which should not be difficult for a fold parser). You can also override the fold parser for built-in languages, such as SYNTAX_STYLE_JAVA, with your own parser implementations.
        Parameters:
        syntaxStyle - The syntax style.
        parser - The parser.
        See Also:
        SyntaxConstants
      • get

        public static FoldParserManager get()
        Returns the singleton instance of this class.
        Returns:
        The singleton instance.
      • getFoldParser

        public FoldParser getFoldParser​(String syntaxStyle)
        Returns a fold parser to use for an editor highlighting code of a specific language.
        Parameters:
        syntaxStyle - A value from SyntaxConstants, such as SYNTAX_STYLE_JAVA.
        Returns:
        A fold parser to use, or null if none is registered for the language.