Nodes

Nodes represent some text to be rendered, optionally with styles

Creating a node

The node DSL is what we recommend for most people, it offers an extremely simple way to create a node

If you desire a more manual method you can extend the Node class

Non-terminal nodes are nodes that can have child nodes. These are typically used to layer styles.

Name
Arguments
Returns

nonTerminalNode

  • startIndex: Int

  • endIndex: Int

  • renderer: StyledTextBuilder.(context: Any) -> Unit

ParseSpec

nonTerminalNode

  • range: IntRange

  • renderer: StyledTextBuilder.(context: Any) -> Unit

ParseSpec

nodeWithChildren

  • startIndex: Int

  • endIndex: Int

  • renderer: StyledTextBuilder.(context: Any) -> Unit

ParseSpec

nodeWithChildren

  • range: IntRange

  • renderer: StyledTextBuilder.(context: Any) -> Unit

ParseSpec

nodeWithChildren(result.groups[1]!!.range) {
    append(result.groupValues[1])
}

Terminal nodes are used to append some text with any chosen styles, they cannot have any children.

Name
Arguments
Returns

node

  • startIndex: Int

  • endIndex: Int

  • renderer: StyledTextBuilder.(context: Any) -> Unit

ParseSpec

node

  • range: IntRange

  • renderer: StyledTextBuilder.(context: Any) -> Unit

ParseSpec

terminalNode

  • startIndex: Int

  • endIndex: Int

  • renderer: StyledTextBuilder.(context: Any) -> Unit

ParseSpec

terminalNode

  • range: IntRange

  • renderer: StyledTextBuilder.(context: Any) -> Unit

ParseSpec

node(result.groups[1]!!.range) {
    append(result.groupValues[1]) {
        color = Color.Blue
    }
}

Last updated