mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-23 00:38:33 +02:00
feat(rules): support multiline or |
treat lines ending with unquoted `|` or `&` as continued conditions in `do` block headers so nested blocks parse correctly across line breaks. update `on` condition splitting to avoid breaking on newlines that follow an unescaped trailing pipe, while still respecting quotes, escapes, and bracket nesting. add coverage for multiline `|`/`&` continuations in `do` parsing, `splitAnd`, `parseOn`, and HTTP flow nested block behavior.
This commit is contained in:
@@ -309,7 +309,8 @@ nested_block := on_expr ws* '{' do_body '}'
|
||||
|
||||
Notes:
|
||||
|
||||
- A nested block is recognized when a line ends with an unquoted `{` (ignoring trailing whitespace).
|
||||
- A nested block is recognized when a logical header ends with an unquoted `{`.
|
||||
- Logical headers can continue to the next line when the current line ends with `|` or `&`.
|
||||
- `on_expr` uses the same syntax as rule `on` (supports `|`, `&`, quoting/backticks, matcher functions, etc.).
|
||||
- The nested block executes **in sequence**, at the point where it appears in the parent `do` list.
|
||||
- Nested blocks are evaluated in the same phase the parent rule runs (no special phase promotion).
|
||||
@@ -424,6 +425,15 @@ path !glob("/public/*")
|
||||
|
||||
# OR within a line
|
||||
method GET | method POST
|
||||
|
||||
# OR across multiple lines (line continuation)
|
||||
method GET |
|
||||
method POST |
|
||||
method PUT
|
||||
|
||||
# AND across multiple lines
|
||||
header Connection Upgrade &
|
||||
header Upgrade websocket
|
||||
```
|
||||
|
||||
### Variable Substitution
|
||||
|
||||
Reference in New Issue
Block a user