Package: groovy.console.ui.text

## [Java] Class StructuredSyntaxDocumentFilter

- groovy.console.ui.text.StructuredSyntaxDocumentFilter

-     public class StructuredSyntaxDocumentFilter
      extends DocumentFilter

- - ### Nested Class Summary

    Nested classes
    Modifiers | Name | Description
    --- | --- | ---
    `class` | `StructuredSyntaxDocumentFilter.LexerNode` |
    `protected class` | `StructuredSyntaxDocumentFilter.MultiLineRun` |

  - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static String` | `TAB_REPLACEMENT` |
    `protected LexerNode` | `lexer` | The root of the lexical parsing tree.
    `protected SortedSet` | `mlTextRunSet` | The position tree of multi-line comments.
    `protected DefaultStyledDocument` | `styledDocument` |

  - ### Constructor Summary

    Constructors
    Constructor and description
    `StructuredSyntaxDocumentFilter (DefaultStyledDocument document)` Creates a new instance of StructuredSyntaxDocumentFilter

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public LexerNode` | `createLexerNode()` Create a new LexerNode for adding to root.
    `` | `public LexerNode` | `getRootNode()` Get the root node for lexing the document.
    `` | `public void` | `insertString(DocumentFilter.FilterBypass fb, int offset, String text, AttributeSet attrs)` Insert a string into the document, and then parse it if the parser has been set.
    `` | `protected void` | `parseDocument(int offset, int length)` Parse the Document to update the character styles given an initial start position.
    `` | `public void` | `remove(DocumentFilter.FilterBypass fb, int offset, int length)` Remove a string from the document, and then parse it if the parser has been set.
    `` | `public void` | `replace(DocumentFilter.FilterBypass fb, int offset, int length, String text, AttributeSet attrs)` Replace a string in the document, and then parse it if the parser has been set.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class DocumentFilter` | `remove, replace, insertString, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Field Detail

    - #### public static final String TAB_REPLACEMENT

    - #### protected LexerNode lexer

      The root of the lexical parsing tree.

    - #### protected SortedSet mlTextRunSet

      The position tree of multi-line comments.

    - #### protected DefaultStyledDocument styledDocument

  - ### Constructor Detail

    - #### public StructuredSyntaxDocumentFilter(DefaultStyledDocument document)

      Creates a new instance of StructuredSyntaxDocumentFilter

      Parameters:
        `document` - the styled document to parse

  - ### Method Detail

    - #### public LexerNode createLexerNode()

      Create a new LexerNode for adding to root.

      Returns:
        a new LexerNode

    - #### public LexerNode getRootNode()

      Get the root node for lexing the document. Children can be added such that matching patterns can be further parsed if required.

      Returns:
        the root lexing node.

    - #### public void insertString(DocumentFilter.FilterBypass fb, int offset, String text, AttributeSet attrs)

      Insert a string into the document, and then parse it if the parser has been set.

      throws:
        BadLocationException
      Parameters:
        fb
        offset
        text
        attrs

    - #### protected void parseDocument(int offset, int length)

      Parse the Document to update the character styles given an initial start position. Called by the filter after it has updated the text.

      throws:
        BadLocationException
      Parameters:
        offset
        length

    - #### public void remove(DocumentFilter.FilterBypass fb, int offset, int length)

      Remove a string from the document, and then parse it if the parser has been set.

      throws:
        BadLocationException
      Parameters:
        fb
        offset
        length

    - #### public void replace(DocumentFilter.FilterBypass fb, int offset, int length, String text, AttributeSet attrs)

      Replace a string in the document, and then parse it if the parser has been set.

      throws:
        BadLocationException
      Parameters:
        fb
        offset
        length
        text
        attrs