Groovy Documentation

## groovy.ui.text
[Java] Class StructuredSyntaxDocumentFilter

    java.lang.Object
      javax.swing.text.DocumentFilter
          groovy.ui.text.StructuredSyntaxDocumentFilter

    public class StructuredSyntaxDocumentFilter
    extends javax.swing.text.DocumentFilter

Authors:
  Evan "Hippy" Slatis

Nested Class Summary
`class` | `StructuredSyntaxDocumentFilter.LexerNode`
`protected class` | `StructuredSyntaxDocumentFilter.MultiLineRun`

Field Summary
`static java.lang.String` | `TAB_REPLACEMENT`
`protected StructuredSyntaxDocumentFilter.LexerNode` | `lexer` The root of the lexical parsing tree.
`protected java.util.SortedSet` | `mlTextRunSet` The position tree of multi-line comments.
`protected javax.swing.text.DefaultStyledDocument` | `styledDocument`

Constructor Summary
`StructuredSyntaxDocumentFilter(javax.swing.text.DefaultStyledDocument document)` Creates a new instance of StructuredSyntaxDocumentFilter

Method Summary
`StructuredSyntaxDocumentFilter.LexerNode` | `createLexerNode()` Create a new LexerNode for adding to root.
`StructuredSyntaxDocumentFilter.LexerNode` | `getRootNode()` Get the root node for lexing the document.
`void` | `insertString(javax.swing.text.DocumentFilter$FilterBypass fb, int offset, java.lang.String text, javax.swing.text.AttributeSet attrs)`
`protected void` | `parseDocument(int offset, int length)` Parse the Document to update the character styles given an initial start position.
`void` | `remove(javax.swing.text.DocumentFilter$FilterBypass fb, int offset, int length)` Remove a string from the document, and then parse it if the parser has been set.
`void` | `replace(javax.swing.text.DocumentFilter$FilterBypass fb, int offset, int length, java.lang.String text, javax.swing.text.AttributeSet attrs)` Replace a string in the document, and then parse it if the parser has been set.

Methods inherited from class javax.swing.text.DocumentFilter

javax.swing.text.DocumentFilter#replace(javax.swing.text.DocumentFilter$FilterBypass, int, int, java.lang.String, javax.swing.text.AttributeSet), javax.swing.text.DocumentFilter#remove(javax.swing.text.DocumentFilter$FilterBypass, int, int), javax.swing.text.DocumentFilter#insertString(javax.swing.text.DocumentFilter$FilterBypass, int, java.lang.String, javax.swing.text.AttributeSet), javax.swing.text.DocumentFilter#wait(long), javax.swing.text.DocumentFilter#wait(long, int), javax.swing.text.DocumentFilter#wait(), javax.swing.text.DocumentFilter#equals(java.lang.Object), javax.swing.text.DocumentFilter#toString(), javax.swing.text.DocumentFilter#hashCode(), javax.swing.text.DocumentFilter#getClass(), javax.swing.text.DocumentFilter#notify(), javax.swing.text.DocumentFilter#notifyAll()

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Field Detail

### TAB_REPLACEMENT

    public static final java.lang.String TAB_REPLACEMENT

### lexer

    protected StructuredSyntaxDocumentFilter.LexerNode lexer

  The root of the lexical parsing tree.

### mlTextRunSet

    protected java.util.SortedSet mlTextRunSet

  The position tree of multi-line comments.

### styledDocument

    protected javax.swing.text.DefaultStyledDocument styledDocument

Constructor Detail

### StructuredSyntaxDocumentFilter

    public StructuredSyntaxDocumentFilter(javax.swing.text.DefaultStyledDocument document)

  Creates a new instance of StructuredSyntaxDocumentFilter
  Parameters:
    `document` - the styled document to parse

Method Detail

### createLexerNode

    public StructuredSyntaxDocumentFilter.LexerNode createLexerNode()

  Create a new LexerNode for adding to root.
  Returns:
    a new LexerNode

### getRootNode

    public StructuredSyntaxDocumentFilter.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.

### insertString

    public void insertString(javax.swing.text.DocumentFilter$FilterBypass fb, int offset, java.lang.String text, javax.swing.text.AttributeSet attrs)

### parseDocument

    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

### remove

    public void remove(javax.swing.text.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

### replace

    public void replace(javax.swing.text.DocumentFilter$FilterBypass fb, int offset, int length, java.lang.String text, javax.swing.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

Groovy Documentation