SPPTBranch

interface SPPTBranch : SPPTNode

A branch in a SharedPackedParseTree

Functions

branchChild
Link copied to clipboard
abstract fun branchChild(index: Int): SPPTBranch
contains
Link copied to clipboard
abstract fun contains(other: SPPTNode): Boolean
  • this leaf contains another leaf if they are equal
  • this branch contains another branch if all the children alternatives of the other are contained in this
nonSkipChild
Link copied to clipboard
abstract fun nonSkipChild(index: Int): SPPTNode

Properties

asBranch
Link copied to clipboard
abstract val asBranch: SPPTBranch
this node cast to an ISPPFBranch (or null if the node is not a branch)
asLeaf
Link copied to clipboard
abstract val asLeaf: SPPTLeaf
this node cast to an ILeaf (or null if the node is not a leaf)
branchNonSkipChildren
Link copied to clipboard
abstract val branchNonSkipChildren: List<SPPTBranch>
Filters out any children that are skip nodes or not branchesall children that are branches and non skip (in first one of the children alternatives)
children
Link copied to clipboard
abstract val children: List<SPPTNode>
the first one of the children alternatives of this branch.
childrenAlternatives
Link copied to clipboard
abstract val childrenAlternatives: Set<List<SPPTNode>>
the set of alternative children for this branch
identity
Link copied to clipboard
abstract val identity: SPPTNodeIdentity
the identity of this node
isBranch
Link copied to clipboard
abstract val isBranch: Boolean
true if this node is a branch
isEmptyLeaf
Link copied to clipboard
abstract val isEmptyLeaf: Boolean
an Empty Leaf is constructed by a parse by specifically matching nothing, caused by:
  • a rule with no items (for example 'rule = ;')
  • an optional item (for example 'rule = item?
isEmptyMatch
Link copied to clipboard
abstract val isEmptyMatch: Boolean
isLeaf
Link copied to clipboard
abstract val isLeaf: Boolean
true if this node is a Leaf
isSkip
Link copied to clipboard
abstract val isSkip: Boolean
a grammar can define some rules as 'skip' rules, for example a rule to match whitespace is commonly a skip rule.
lastLeaf
Link copied to clipboard
abstract val lastLeaf: SPPTLeaf
location
Link copied to clipboard
abstract val location: InputLocation
matchedText
Link copied to clipboard
abstract val matchedText: String
all text matched by this node
matchedTextLength
Link copied to clipboard
abstract val matchedTextLength: Int
the length of the text (in characters) matched by this node, derived from identity
name
Link copied to clipboard
abstract val name: String
the name of the runtime rule that caused this node to be constructed
nextInputPosition
Link copied to clipboard
abstract val nextInputPosition: Int
startPosition + matchedTextLength
nonSkipChildren
Link copied to clipboard
abstract val nonSkipChildren: List<SPPTNode>
the first one of the children alternatives of this branch with all skip nodes removed.
nonSkipMatchedText
Link copied to clipboard
abstract val nonSkipMatchedText: String
all text matched by this node excluding text that was matched by skip rules.
numberOfLines
Link copied to clipboard
abstract val numberOfLines: Int
the number of lines (end of line markers) covered by the text that this node matches
option
Link copied to clipboard
abstract val option: Int
parent
Link copied to clipboard
abstract var parent: SPPTBranch?
A parent might be null if the construction of the node has not set it (it is not required)the parent branch of this node.
priority
Link copied to clipboard
abstract val priority: Int
the priority of this node according to the grammar (0 if no priority defined by parent rule)
runtimeRuleNumber
Link copied to clipboard
abstract val runtimeRuleNumber: Int
the rule number from the runtime grammar that caused this node to be constructed, derived from identity
startPosition
Link copied to clipboard
abstract val startPosition: Int
the index position of the input text at which this node starts its match, derived from identity