Instances of this struct represent a match state of a node type's content expression, and can be used to find out whether further content matches here, and whether a given position is a valid end of the node.
Ported from ProseMirror's content.ts.
Because DFA states can form cycles (e.g., image* creates a state
with a self-loop), we use an ETS-backed registry to store the actual
edge lists. Each ContentMatch holds an id that indexes into this
registry. The next field is populated lazily from the registry.
Summary
Functions
Whether this match state is compatible with another.
Compute wrapping using BFS.
Get the first matching node type that can be generated.
Get the nth outgoing edge as {type, next_match}.
The number of outgoing edges.
The empty content match (matches only empty content).
Try to match the given fragment, and if that fails, see if it can
be made to match by inserting nodes in front of it. When successful,
return a fragment of inserted nodes (which may be empty if nothing
had to be inserted). When to_end is true, only return a fragment
if the resulting match goes to the end of the content expression.
Find a set of wrapping node types that would allow a node of the given type to appear at this position.
Whether the match state has inline content.
Try to match a fragment. Returns the resulting match when successful.
Match a node type, returning a match after that node if successful.
Parse a content expression string into a ContentMatch DFA.
Update the node types stored in this content match's DFA edges. Takes a map of name => updated_node_type. This is needed because during schema construction, content expressions are parsed before all node types have their content_match set, so the DFA edges reference stale types.
Functions
Whether this match state is compatible with another.
Compute wrapping using BFS.
Get the first matching node type that can be generated.
Get the nth outgoing edge as {type, next_match}.
The number of outgoing edges.
The empty content match (matches only empty content).
Try to match the given fragment, and if that fails, see if it can
be made to match by inserting nodes in front of it. When successful,
return a fragment of inserted nodes (which may be empty if nothing
had to be inserted). When to_end is true, only return a fragment
if the resulting match goes to the end of the content expression.
Find a set of wrapping node types that would allow a node of the given type to appear at this position.
Whether the match state has inline content.
Try to match a fragment. Returns the resulting match when successful.
Match a node type, returning a match after that node if successful.
Parse a content expression string into a ContentMatch DFA.
node_types is a map of name => %NodeType{}.
Update the node types stored in this content match's DFA edges. Takes a map of name => updated_node_type. This is needed because during schema construction, content expressions are parsed before all node types have their content_match set, so the DFA edges reference stale types.