FoldParserManager
Date: 2017-02-11

org.fife.ui.rsyntaxtextarea.folding

## Class FoldParserManager

- java.lang.Object
- - org.fife.ui.rsyntaxtextarea.folding.FoldParserManager

- All Implemented Interfaces:
    SyntaxConstants

      public class FoldParserManager
      extends java.lang.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.

- - ### Field Summary

    - ### Fields inherited from interface org.fife.ui.rsyntaxtextarea.SyntaxConstants

      `SYNTAX_STYLE_ACTIONSCRIPT, SYNTAX_STYLE_ASSEMBLER_X86, SYNTAX_STYLE_BBCODE, SYNTAX_STYLE_C, SYNTAX_STYLE_CLOJURE, SYNTAX_STYLE_CPLUSPLUS, SYNTAX_STYLE_CSHARP, SYNTAX_STYLE_CSS, SYNTAX_STYLE_D, SYNTAX_STYLE_DART, SYNTAX_STYLE_DELPHI, SYNTAX_STYLE_DTD, SYNTAX_STYLE_FORTRAN, SYNTAX_STYLE_GROOVY, SYNTAX_STYLE_HTACCESS, SYNTAX_STYLE_HTML, SYNTAX_STYLE_JAVA, SYNTAX_STYLE_JAVASCRIPT, SYNTAX_STYLE_JSHINTRC, SYNTAX_STYLE_JSON, SYNTAX_STYLE_JSP, SYNTAX_STYLE_LATEX, SYNTAX_STYLE_LESS, SYNTAX_STYLE_LISP, SYNTAX_STYLE_LUA, SYNTAX_STYLE_MAKEFILE, SYNTAX_STYLE_MXML, SYNTAX_STYLE_NONE, SYNTAX_STYLE_NSIS, SYNTAX_STYLE_PERL, SYNTAX_STYLE_PHP, SYNTAX_STYLE_PROPERTIES_FILE, SYNTAX_STYLE_PYTHON, SYNTAX_STYLE_RUBY, SYNTAX_STYLE_SAS, SYNTAX_STYLE_SCALA, SYNTAX_STYLE_SQL, SYNTAX_STYLE_TCL, SYNTAX_STYLE_UNIX_SHELL, SYNTAX_STYLE_VISUAL_BASIC, SYNTAX_STYLE_WINDOWS_BATCH, SYNTAX_STYLE_XML`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addFoldParserMapping(java.lang.String syntaxStyle, FoldParser parser)` Adds a mapping from a syntax style to a fold parser.
    `static FoldParserManager` | `get()` Returns the singleton instance of this class.
    `FoldParser` | `getFoldParser(java.lang.String syntaxStyle)` Returns a fold parser to use for an editor highlighting code of a specific language.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### addFoldParserMapping

          public void addFoldParserMapping(java.lang.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(java.lang.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.