@@ -170,12 +170,12 @@ Ways to match whitespace:
170
170
171
171
= head2 Ambiguities in Parsing
172
172
173
- While some languages will let get away with removing as much whitespace
174
- as possible between tokens, Perl 6 is less forgiving. The overarching
173
+ While some languages will let you get away with removing as much whitespace
174
+ between tokens as possible , Perl 6 is less forgiving. The overarching
175
175
mantra is we discourage code golf, so don't scrimp on whitespace (the
176
176
more serious underlying reason behind these restrictions is
177
177
single-pass parsing and ability to parse Perl 6 programs with virtually
178
- no L < backtracking|https://en.wikipedia.org/wiki/Backtracking > )) .
178
+ no L < backtracking|https://en.wikipedia.org/wiki/Backtracking > ).
179
179
180
180
The common areas you should watch out for are:
181
181
@@ -188,20 +188,20 @@ The common areas you should watch out for are:
188
188
# RIGHT:
189
189
while ($++ > 5) { .say }
190
190
191
- # EVEN BETTER; Perl 6 does not require parentheses there
191
+ # EVEN BETTER; Perl 6 does not require parentheses there:
192
192
while $++ > 5 { .say }
193
193
= end code
194
194
195
195
= head3 Reduction vs. Array constructor ambiguity
196
196
197
197
= begin code :skip-test
198
- # WRONG; ambiguity with `[<]` meta op
198
+ # WRONG; ambiguity with `[<]` meta op:
199
199
my @a = [[<foo>],];
200
200
201
- # RIGHT; reductions cannot have spaces in them, so put one in
201
+ # RIGHT; reductions cannot have spaces in them, so put one in:
202
202
my @a = [[ <foo>],];
203
203
204
- # No ambiguity here, natural spaces between items suffice to resolve it
204
+ # No ambiguity here, natural spaces between items suffice to resolve it:
205
205
my @a = [[<foo bar ber>],];
206
206
= end code
207
207
@@ -210,23 +210,23 @@ The common areas you should watch out for are:
210
210
= begin code :skip-test
211
211
my $foo = 'bar ber';
212
212
213
- # WRONG; ambiguity whether `$foo»` means end of quoter or to hyper a postfix
213
+ # WRONG; ambiguity whether `$foo»` means end of quoter or to hyper a postfix:
214
214
my @a = «foo $foo»;
215
215
216
- # RIGHT; put a space in to resolve ambiguity
216
+ # RIGHT; put a space in to resolve ambiguity:
217
217
my @a = «foo $foo »;
218
218
219
- # Also good; use different delimiters
219
+ # Also good; use different delimiters:
220
220
my @a = qqww|foo $foo|;
221
221
222
222
223
- # WRONG; is it a hyper in the middle or end of quoters?
223
+ # WRONG; is it a hyper in the middle or end of quoters?:
224
224
my @a = «foo $foo».uc() Perl»;
225
225
226
- # RIGHT; simply use Texas version of hyper
226
+ # RIGHT; simply use Texas version of hyper:
227
227
my @a = «foo $foo>>.uc() Perl»;
228
228
229
- # Also good; use different delimiters
229
+ # Also good; use different delimiters:
230
230
my @a = qqww|foo $foo».uc() Perl|;
231
231
= end code
232
232
0 commit comments