Skip to content

Instantly share code, notes, and snippets.

@conartist6
Last active March 22, 2022 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conartist6/0f00f4c4f8f956762995a72b64b10937 to your computer and use it in GitHub Desktop.
Save conartist6/0f00f4c4f8f956762995a72b64b10937 to your computer and use it in GitHub Desktop.
@iter-tools/regex data structure
┌───────────────┐
│ Expression │
│ root: true │
│ globalIdx: 1 │
└───────┬───────┘
parentSeq │ ▲
│ │ expr
┌──────────────┐ ┌───────┴─┴─────┐
│ State │ │ State │
│ type: cont │ │ type: success │
└──────────────┘ └───────┬───────┘
▲ │ ▲
│ state ▼ │ state
better ┌────────┴─────┐ better ┌─────────┴─────┐
null ◄──┤ Sequence │◄─────────┤ Sequence │
│ │ worse │ │ worse
└──────┬───────┴─────────►└───────────────┴──► null
parentExpr │ ▲
▼ │ best
┌────────┴─────┐
│ Expression │
│ │
└──────┬───────┘
parentSeq │ ▲
│ │ expr
┌──────────────┐ ┌──────┴─┴─────┐
│ State │ │ State │
│ type: cont │ │ type: expr │
└──────────────┘ └──────┬───────┘
▲ │ ▲
│ state ▼ │ state
better ┌────────┴─────┐ better ┌────────┴─────┐
null ◄──┤ Sequence │◄─────────┤ Sequence │
│ │ worse │ │ worse
└──────┬───────┴─────────►└──────────────┴──► null
parentExpr │ ▲
▼ │ best
┌────────┴─────┐
│ Expression │
│ root: true │
│ globalIdx: 0 │
└──────────────┘
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment