Skip to content

Commit bbe06be

Browse files
committed
Rearranging for #1729
1 parent 2d276d1 commit bbe06be

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

doc/Language/grammars.pod6

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -207,16 +207,6 @@ methods.
207207
X<|ws>
208208
=head3 C<ws>
209209
210-
When C<rule> instead of C<token> is used, any whitespace after terms and closing
211-
parenthesis/brackets is turned into a non-capturing call to C<ws>,
212-
written as C«<.ws>» where C<.> means non-capturing. That is to say:
213-
214-
rule entry { <key> '=' <value> }
215-
216-
Is the same as:
217-
218-
token entry { <key> <.ws> '=' <.ws> <value> <.ws> }
219-
220210
The default C<ws> matches zero or more whitespace characters, as long as that
221211
point is not within a word (in code form, that's C«regex ws { <!ww> \s* }»):
222212
@@ -231,6 +221,20 @@ point is not within a word (in code form, that's C«regex ws { <!ww> \s* }»):
231221
# Successful match: there is a word boundary between ')' and 'b'
232222
say ')b' ~~ /. <.ws> b/; # OUTPUT: «「)b」␤»
233223
224+
Please bear in mind that we're preceding C<ws> with a dot to avoid capturing,
225+
which we are not interested in. Since in general whitespace is a separator, this
226+
is how it's mostly found.
227+
228+
When C<rule> instead of C<token> is used, any whitespace after terms and closing
229+
parenthesis/brackets is turned into a non-capturing call to C<ws>,
230+
written as C«<.ws>» where C<.> means non-capturing. That is to say:
231+
232+
rule entry { <key> '=' <value> }
233+
234+
Is the same as:
235+
236+
token entry { <key> <.ws> '=' <.ws> <value> <.ws> }
237+
234238
You can also redefine the default C<ws> token:
235239
236240
grammar Foo {

0 commit comments

Comments
 (0)