Tolerate spaces around =
in @foo = baz
This commit is contained in:
parent
c15b118bb4
commit
54b14a3557
@ -267,9 +267,9 @@ vm_op_t *bpeg_simplepattern(file_t *f, const char *str)
|
||||
case '@': {
|
||||
op->op = VM_CAPTURE;
|
||||
const char *a = *str == '!' ? &str[1] : after_name(str);
|
||||
if (a > str && a[0] == '=' && a[1] != '>') {
|
||||
if (a > str && after_spaces(a)[0] == '=' && after_spaces(a)[1] != '>') {
|
||||
op->args.capture.name = strndup(str, (size_t)(a-str));
|
||||
str = a + 1;
|
||||
str = after_spaces(a) + 1;
|
||||
}
|
||||
vm_op_t *pat = bpeg_simplepattern(f, str);
|
||||
check(pat, "Expected pattern after @");
|
||||
|
@ -49,7 +49,7 @@ Repeat: (
|
||||
Optional: `[ __ extended-pat (__`] / @!={=> "Expected closing square bracket here"})
|
||||
After: `< _ pat
|
||||
Before: `> _ pat
|
||||
Capture: `@ [_ @capture-name=(id/`!) !"=>" `=] _ (@capture=pat / @!={=> "Expected pattern to capture"})
|
||||
Capture: `@ [_ @capture-name=(id/`!) __ !"=>" `=] __ (@capture=pat / @!={=> "Expected pattern to capture"})
|
||||
Replace: `{ __ (
|
||||
[@replace-pat=extended-pat __] "=>" [__ @replacement=String]
|
||||
) __ (`} / @!={=> "Expected closing brace here"})
|
||||
|
Loading…
Reference in New Issue
Block a user