Skip to content

Commit 9572f99

Browse files
committed
Update RegexSyntax.md
1 parent a443967 commit 9572f99

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

Documentation/Evolution/RegexSyntax.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ This is syntax specific to PCRE, and allows a set of global options to appear at
598598
### Callouts
599599

600600
```
601-
Callout -> PCRECallout | OnigurumaCallout
601+
Callout -> PCRECallout | NamedCallout | InterpolatedCallout
602602
603603
PCRECallout -> '(?C' CalloutBody ')'
604604
PCRECalloutBody -> '' | <Number>
@@ -611,20 +611,24 @@ PCRECalloutBody -> '' | <Number>
611611
| '$' <String> '$'
612612
| '{' <String> '}'
613613
614-
OnigurumaCallout -> OnigurumaNamedCallout | OnigurumaCalloutOfContents
614+
NamedCallout -> '(*' Identifier CalloutTag? CalloutArgs? ')'
615+
CalloutArgs -> '{' CalloutArgList '}'
616+
CalloutArgList -> CalloutArg (',' CalloutArgList)*
617+
CalloutArg -> [^,}]+
618+
CalloutTag -> '[' Identifier ']'
615619
616-
OnigurumaNamedCallout -> '(*' Identifier OnigurumaTag? OnigurumaCalloutArgs? ')'
617-
OnigurumaCalloutArgs -> '{' OnigurumaCalloutArgList '}'
618-
OnigurumaCalloutArgList -> OnigurumaCalloutArg (',' OnigurumaCalloutArgList)*
619-
OnigurumaCalloutArg -> [^,}]+
620-
OnigurumaTag -> '[' Identifier ']'
621-
622-
OnigurumaCalloutOfContents -> '(?' '{' OnigurumaCalloutContents '}' OnigurumaTag? Direction? ')'
623-
OnigurumaCalloutContents -> <String> | '{' OnigurumaCalloutContents '}'
624-
OnigurumaCalloutDirection -> 'X' | '<' | '>'
620+
InterpolatedCallout -> '(?' '{' Interpolation '}' CalloutTag? CalloutDirection? ')'
621+
Interpolation -> <String> | '{' Interpolation '}'
622+
CalloutDirection -> 'X' | '<' | '>'
625623
```
626624

627-
A callout is a feature that allows a user-supplied function to be called when matching reaches that point in the pattern. We supported parsing both the PCRE and Oniguruma callout syntax. The PCRE syntax accepts a string or numeric argument that is passed to the function. The Oniguruma syntax is more involved, and may accept an identifier with an optional tag and argument list. It may also accept an arbitrary program in the 'callout of contents' syntax. This is an expanded version of Perl's interpolation syntax, and allows an arbitrary nesting of delimiters in addition to an optional tag and direction.
625+
A callout is a feature that allows a user-supplied function to be called when matching reaches that point in the pattern. We supported parsing 3 types of callout:
626+
627+
- PCRE callout syntax, which accepts a string or numeric argument that is passed to the function.
628+
- Oniguruma named callout syntax, which accepts an identifier with an optional tag and argument list.
629+
- Interpolated callout syntax, which is equivalent to Oniguruma's "callout of contents". This callout accepts an arbitrary interpolated program. This is an expanded version of Perl's interpolation syntax, and allows an arbitrary nesting of delimiters in addition to an optional tag and direction.
630+
631+
While we propose parsing these for the purposes of issuing helpful diagnostics, we are deferring full support for the interpolated syntax for the future.
628632

629633
### Absent functions
630634

0 commit comments

Comments
 (0)