Re: Multiline/embedded comments
[email protected] (Vadim Belman) Tue, 22 Dec 2020 22:12:18 -0500
| Newsgroups | perl.perl6.language |
|---|---|
| Message-ID | <[email protected]> |
You interpret it incorrectly. The problem is in your '#`{' comment. You =
have a space between the backtick and the opening brace. Therefore it's =
interpreted as a single line comment. Though even if you remove the =
space the compiler will complain because it wouldn't find closing } due =
to unbalanced opening one at line 13. Note that comments treated as-is =
literally, backslash doesn't escape the brace. To get what you want you =
might use '#`{{ ... }}` form of opening/closing braces. In this case =
Rakudo will not try to balance the sinlge opening one inside the =
comment.
Best regards,
Vadim Belman
> On Dec 22, 2020, at 7:59 PM, Parrot Raiser <[email protected]> wrote:
>=20
> While playing around with the bounding characters for the #` form, I
> encountered an unexpected feature, which may or may not be a bug. If
> the left bounding character (e.g. the { in #`{ occurs unbalanced in
> the commented text, the compiler apparently treats it as code,
> searches for the right bounder, and generates an error if it can't
> find one. e.g.
>=20
> 1 #! /home/guru/bin/raku
> 2
> 3 # comment_test
> 4
> 5 # Input
> 6 # Purpose of program - test multi-line comments
> 7
> 8 #`(
> 9 put " () fails";
> 10 )
> 11
> 12 #` {
> 13 put "\{ fails";
> 14 }
> 15
> 16 put "Done";
> 17
> 18 # End comment_test Last changed: 2020-12-22 19:40:07
>=20
> produces
>=20
> =3D=3D=3DSORRY!=3D=3D=3D Error while compiling =
/home/guru/bin/comment_test
> Unexpected closing bracket
> at /home/guru/bin/comment_test:14
> ------> <BOL>=E2=8F=8F}
>=20
> Removing the escape \ on line 13 generates a different but related =
error.
>=20
> Is this a limitation that should be mentioned in the description of
> the form, or the compiler mistakienly working on something it's just
> been told to ignore?
>=20