Skip to content

Commit 59ba12d

Browse files
committed
fix(pest): issue with closing braces in nested map extract_regex
1 parent d685f63 commit 59ba12d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/pipeline/template.pest

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,13 @@ regex_normal_char = {
119119
}
120120
regex_escaped_char = { "\\" ~ ANY }
121121

122-
// Regex arguments for map operations (stop at any })
123-
map_regex_arg = @{ (map_regex_escaped_char | map_regex_pipe_or_char)* }
122+
// Regex arguments for map operations (improved to handle braces in regex)
123+
map_regex_arg = @{ (map_regex_escaped_char | map_regex_balanced_brace | map_regex_pipe_or_char)* }
124124
map_regex_pipe_or_char = { map_regex_pipe | map_regex_normal_char }
125125
map_regex_pipe = { "|" ~ !operation_name }
126+
map_regex_balanced_brace = { "{" ~ (!("}" ~ &("|" | "}" | EOI | (":" ~ number))) ~ ANY)* ~ "}" }
126127
map_regex_normal_char = {
127-
!(":" ~ (operation_name | range_spec | number)) ~ !("|" ~ operation_name) ~ !("}" ~ ("|" | EOI)) ~ ANY
128+
!(":" ~ (operation_name | range_spec | number)) ~ !("|" ~ operation_name) ~ !("{" | ("}" ~ &("|" | "}" | EOI | (":" ~ number)))) ~ ANY
128129
}
129130
map_regex_escaped_char = { "\\" ~ ANY }
130131

0 commit comments

Comments
 (0)