package core:text/regex/parser
⌘K
Ctrl+K
or
/
Overview
package regex_parser implements a Pratt parser, also known as a Top-Down Operator Precedence parser, for parsing tokenized regular expression patterns.
References: https://dl.acm.org/doi/10.1145/512927.512931 https://tdop.github.io/ http://crockford.com/javascript/tdop/tdop.html
Index
Types (30)
- Error
- Expected_Token
- Invalid_Repetition
- Invalid_Token
- Invalid_Unicode
- Node
- Node_Alternation
- Node_Anchor
- Node_Concatenation
- Node_Group
- Node_Match_All_And_Escape
- Node_Optional
- Node_Optional_Non_Greedy
- Node_Repeat_N
- Node_Repeat_One
- Node_Repeat_One_Non_Greedy
- Node_Repeat_Zero
- Node_Repeat_Zero_Non_Greedy
- Node_Rune
- Node_Rune_Class
- Node_Wildcard
- Node_Word_Boundary
- Parser
- Rune_Class_Data
- Rune_Class_Range
- Token
- Token_Kind
- Tokenizer
- Too_Many_Capture_Groups
- Unexpected_EOF
Constants (0)
This section is empty.
Variables (0)
This section is empty.
Procedure Groups (0)
This section is empty.
Types
Error ¶
Error :: union { Expected_Token, Invalid_Repetition, Invalid_Token, Invalid_Unicode, Too_Many_Capture_Groups, Unexpected_EOF, }
Related Procedures With Returns
Expected_Token ¶
Expected_Token :: struct { pos: int, kind: regex_tokenizer.Token_Kind, }
Invalid_Repetition ¶
Invalid_Repetition :: struct { pos: int, }
Invalid_Token ¶
Invalid_Token :: struct { pos: int, kind: regex_tokenizer.Token_Kind, }
Invalid_Unicode ¶
Invalid_Unicode :: struct { pos: int, }
Node ¶
Node :: union { ^Node_Rune, ^Node_Rune_Class, ^Node_Wildcard, ^Node_Concatenation, ^Node_Alternation, ^Node_Repeat_Zero, ^Node_Repeat_Zero_Non_Greedy, ^Node_Repeat_One, ^Node_Repeat_One_Non_Greedy, ^Node_Repeat_N, ^Node_Optional, ^Node_Optional_Non_Greedy, ^Node_Group, ^Node_Anchor, ^Node_Word_Boundary, ^Node_Match_All_And_Escape, }
Related Procedures With Parameters
Related Procedures With Returns
Node_Anchor ¶
Node_Anchor :: struct { start: bool, }
Node_Concatenation ¶
Node_Concatenation :: struct { nodes: [dynamic]Node, }
Node_Match_All_And_Escape ¶
Node_Match_All_And_Escape :: struct {}
Node_Optional ¶
Node_Optional :: struct { inner: Node, }
Node_Optional_Non_Greedy ¶
Node_Optional_Non_Greedy :: struct { inner: Node, }
Node_Repeat_One ¶
Node_Repeat_One :: struct { inner: Node, }
Node_Repeat_One_Non_Greedy ¶
Node_Repeat_One_Non_Greedy :: struct { inner: Node, }
Node_Repeat_Zero ¶
Node_Repeat_Zero :: struct { inner: Node, }
Node_Repeat_Zero_Non_Greedy ¶
Node_Repeat_Zero_Non_Greedy :: struct { inner: Node, }
Node_Rune ¶
Node_Rune :: struct { data: rune, }
Node_Rune_Class ¶
Node_Rune_Class :: struct { negating: bool, using data: Rune_Class_Data, }
Node_Wildcard ¶
Node_Wildcard :: struct {}
Node_Word_Boundary ¶
Node_Word_Boundary :: struct { non_word: bool, }
Parser ¶
Parser :: struct { flags: bit_set[regex_common.Flag; u8], t: regex_tokenizer.Tokenizer, cur_token: regex_tokenizer.Token, groups: int, }
Related Procedures With Parameters
Rune_Class_Data ¶
Rune_Class_Data :: struct { runes: [dynamic]rune, ranges: [dynamic]Rune_Class_Range, }
Token_Kind ¶
Token_Kind :: regex_tokenizer.Token_Kind
Tokenizer ¶
Tokenizer :: regex_tokenizer.Tokenizer
Too_Many_Capture_Groups ¶
Too_Many_Capture_Groups :: struct { pos: int, }
Unexpected_EOF ¶
Unexpected_EOF :: struct { pos: int, }
Constants
This section is empty.
Variables
This section is empty.
Procedures
expect ¶
expect :: proc(p: ^Parser, kind: regex_tokenizer.Token_Kind) -> (err: Error) {…}
left_binding_power ¶
left_binding_power :: proc(kind: regex_tokenizer.Token_Kind) -> int {…}
Procedure Groups
This section is empty.
Source Files
Generation Information
Generated with odin version dev-2024-12 (vendor "odin") Windows_amd64 @ 2024-12-17 21:11:02.078568200 +0000 UTC