Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some parsing glitch with \term in a string #6286

Open
p6rt opened this issue May 28, 2017 · 1 comment
Open

Some parsing glitch with \term in a string #6286

p6rt opened this issue May 28, 2017 · 1 comment

Comments

@p6rt
Copy link

p6rt commented May 28, 2017

Migrated from rt.perl.org#131389 (status was 'new')

Searchable as RT131389$

@p6rt
Copy link
Author

p6rt commented May 28, 2017

From @zoffixznet

IRC​: https://irclog.perlgeek.de/perl6-dev/2017-05-28#i_14648548

The first eval uses emoji cat in a string and it works;
The second one tries to do the same in a bit more elaborate eval and it crashes with bogus term error;
The third one executes the same code, except swapping \term​:<😹> to \x, and it works fine;
The fourth one executes the same code, except swapping \term​:<😹> to \term​:<x>, and now it crashes with "undeclared routine x";
The last one uses \term​:<x>, except it works fine.

Seems in the problematic cases, the defined \term is not seen by the block inside the string.

09​:07 Zoffix m​: my \term​:<😹> = -42; say 😹; say 😹.abs; say "{😹}"; my $foo = ''; say "{😹.abs}​:$foo" for 😹.abs
09​:07 camelia rakudo-moar 87d0e0​: OUTPUT​: «-42␤42␤-42␤42​:␤»
09​:07 Zoffix m​: '/tmp/file1'.IO.spurt​: "a\nb\nc"; '/tmp/file2'.IO.spurt​: "d\ne\n"; '/tmp/file3'.IO.spurt​: "f\ng\nh\ni"; my $line; my \term​:<😹> = IO​::CatHandle.new('/tmp/file1', '/tmp/file2'.IO, '/tmp/file3'.IO.open, :on-switch{ $line = 1 }); say "{😹.path}​:$line $_" for 😹.lines
09​:07 camelia rakudo-moar 87d0e0​: OUTPUT​: «5===SORRY!5=== Error while compiling <tmp>␤Bogus statement␤at <tmp>​:1␤------> 3 :on-switch{ $line = 1 }); say "{7⏏5😹.path}​:$line $_" for 😹.lines␤ expecting any of​:␤ prefix␤ term␤»
09​:07 Zoffix m​: '/tmp/file1'.IO.spurt​: "a\nb\nc"; '/tmp/file2'.IO.spurt​: "d\ne\n"; '/tmp/file3'.IO.spurt​: "f\ng\nh\ni"; my $line; my \x = IO​::CatHandle.new('/tmp/file1', '/tmp/file2'.IO, '/tmp/file3'.IO.open, :on-switch{ $line = 1 }); say "{x.path}​:$line $_" for x.lines
09​:07 camelia rakudo-moar 87d0e0​: OUTPUT​: «/tmp/file1​:1 a␤/tmp/file1​:1 b␤/tmp/file1​:1 c␤/tmp/file2​:1 d␤/tmp/file2​:1 e␤/tmp/file3​:1 f␤/tmp/file3​:1 g␤/tmp/file3​:1 h␤/tmp/file3​:1 i␤»
09​:12 m​: '/tmp/file1'.IO.spurt​: "a\nb\nc"; '/tmp/file2'.IO.spurt​: "d\ne\n"; '/tmp/file3'.IO.spurt​: "f\ng\nh\ni"; my $line; my \term​:<x> = IO​::CatHandle.new('/tmp/file1', '/tmp/file2'.IO, '/tmp/file3'.IO.open, :on-switch{ $line = 1 }); say "{x.path}​:$line $_" for x.lines
09​:12 camelia rakudo-moar 87d0e0​: OUTPUT​: «5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine​:␤ x used at line 1␤␤»
09​:12 Zoffix m​: my \term​:<x> = 42; say x.path
09​:12 camelia rakudo-moar 87d0e0​: OUTPUT​: «"42".IO␤»

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant