Package groovy.console.ui.text

# Class StructuredSyntaxDocumentFilter.LexerNode

java.lang.Object
groovy.console.ui.text.StructuredSyntaxDocumentFilter.LexerNode

Enclosing class:
  StructuredSyntaxDocumentFilter

public final class StructuredSyntaxDocumentFilter.LexerNode extends Object
Regex-driven lexer node that applies styles and nested lexers.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Style`
  `getDefaultStyle()`
  Returns the fallback style for unmatched text.
  `boolean`
  `isInitialized()`
  `void`
  `parse(CharBuffer buffer, int offset, int length)`
  Parses the supplied buffer and applies styles to matching ranges.
  `void`
  `putChild(String[] regexps, StructuredSyntaxDocumentFilter.LexerNode node)`
  Registers a child lexer for matches of any supplied expression.
  `void`
  `putChild(String regexp, StructuredSyntaxDocumentFilter.LexerNode node)`
  Registers a child lexer for matches of the supplied expression.
  `void`
  `putStyle(String[] regexps, Style style)`
  Associates a style with matches of any supplied expression.
  `void`
  `putStyle(String regexp, Style style)`
  Associates a style with matches of the supplied expression.
  `void`
  `removeChild(String regexp)`
  Removes the child lexer registered for the supplied expression.
  `void`
  `removeStyle(String regexp)`
  Removes the style associated with the supplied expression.
  `void`
  `removeStyle(String[] regexps)`
  Removes the style associated with any of the supplied expressions.
  `void`
  `setDefaultStyle(Style style)`
  Sets the fallback style for unmatched text.

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

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

- ## Method Details

  - ### getDefaultStyle

    public Style getDefaultStyle()
    Returns the fallback style for unmatched text.
    Returns:
      the default style

  - ### isInitialized

    public boolean isInitialized()
    Returns:
      true if initialised

  - ### parse

    public void parse(CharBuffer buffer, int offset, int length) throws BadLocationException
    Parses the supplied buffer and applies styles to matching ranges.
    Parameters:
      `buffer` - the character buffer to parse
      `offset` - the starting offset
      `length` - the number of characters to parse
    Throws:
      `BadLocationException` - if document positions cannot be resolved

  - ### putChild

    public void putChild(String regexp, StructuredSyntaxDocumentFilter.LexerNode node)
    Registers a child lexer for matches of the supplied expression.
    Parameters:
      `regexp` - the expression to match
      `node` - the child lexer to apply within matching text

  - ### putChild

    public void putChild(String[] regexps, StructuredSyntaxDocumentFilter.LexerNode node)
    Registers a child lexer for matches of any supplied expression.
    Parameters:
      `regexps` - the expressions to match
      `node` - the child lexer to apply within matching text

  - ### putStyle

    public void putStyle(String regexp, Style style)
    Associates a style with matches of the supplied expression.
    Parameters:
      `regexp` - the expression to match
      `style` - the style to apply

  - ### putStyle

    public void putStyle(String[] regexps, Style style)
    Associates a style with matches of any supplied expression.
    Parameters:
      `regexps` - the expressions to match
      `style` - the style to apply

  - ### removeChild

    public void removeChild(String regexp)
    Removes the child lexer registered for the supplied expression.
    Parameters:
      `regexp` - the expression whose child lexer should be removed

  - ### removeStyle

    public void removeStyle(String regexp)
    Removes the style associated with the supplied expression.
    Parameters:
      `regexp` - the expression whose style should be removed

  - ### removeStyle

    public void removeStyle(String[] regexps)
    Removes the style associated with any of the supplied expressions.
    Parameters:
      `regexps` - the expressions whose combined style should be removed

  - ### setDefaultStyle

    public void setDefaultStyle(Style style)
    Sets the fallback style for unmatched text.
    Parameters:
      `style` - the default style to use