Create a new node prop type.
Optionalconfig: {Optionalcombine?: (a: T, b: T) => TIf configuring another value for this prop when it already exists on a node should combine the old and new values, rather than overwrite the old value, you can pass a function that does the combining here.
Optionaldeserialize?: (str: string) => TThe deserialize function to use for this prop, used for example when directly providing the prop from a grammar file. Defaults to a function that raises an error.
OptionalperNode?: booleanA method that deserializes a value of this prop from a string. Can be used to allow a prop to be directly written in a grammar file.
StaticclosedProp that is used to describe matching delimiters. For opening delimiters, this holds an array of node names (written as a space-separated string when declaring this prop in a grammar) for the node types of closing delimiters that match it.
StaticcontextThe hash of the context that the node was parsed in, if any. Used to limit reuse of contextual nodes.
StaticgroupUsed to assign node types to groups (for example, all node
types that represent an expression could be tagged with an
"Expression" group).
StaticisolateAttached to nodes to indicate these should be
displayed
in a bidirectional text isolate, so that direction-neutral
characters on their sides don't incorrectly get associated with
surrounding text. You'll generally want to set this for nodes
that contain arbitrary text, like strings and comments, and for
nodes that appear inside arbitrary text, like HTML tags. When
not given a value, in a grammar declaration, defaults to
"auto".
StaticlookThe distance beyond the end of the node that the tokenizer looked ahead for any of the tokens inside the node. (The LR parser only stores this when it is larger than 25, for efficiency reasons.)
StaticmountedThis per-node prop is used to replace a given node, or part of a node, with another tree. This is useful to include trees from different languages in mixed-language parsers.
StaticopenedThe inverse of closedBy. This is
attached to closing delimiters, holding an array of node names
of types of matching opening delimiters.
This is meant to be used with
NodeSet.extend or
LRParser.configure to compute
prop values for each node type in the set. Takes a match
object or function that returns undefined
if the node type doesn't get this prop, and the prop's value if
it does.
Each node type or individual tree can have metadata associated with it in props. Instances of this class represent prop names.