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

Parser confused when word-based conditionals are in a subroutine call with parentheses #5442

Closed
p6rt opened this issue Jul 10, 2016 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 10, 2016

Migrated from rt.perl.org#128589 (status was 'rejected')

Searchable as RT128589$

@p6rt
Copy link
Author

p6rt commented Jul 10, 2016

From @zoffixznet

The parse error occurs with alphabetic infix between the s/// but seems to be fine with a symbol-based infix​:

<Zoffix> m​: say(s/^// and s/^//)
<camelia> rakudo-moar 405519​: OUTPUT«===SORRY!=== Error while compiling <tmp>␤Unable to parse expression in argument list; couldn't find final ')' ␤at <tmp>​:1␤------> say(s/^//⏏ and s/^//)␤ expecting any of​:␤ infix␤ infix stopper␤»
<Zoffix> m​: say(s/^// andthen s/^//)
<camelia> rakudo-moar 405519​: OUTPUT«===SORRY!=== Error while compiling <tmp>␤Unable to parse expression in argument list; couldn't find final ')' ␤at <tmp>​:1␤------> say(s/^//⏏ andthen s/^//)␤ expecting any of​:␤ infix␤ infix stopper␤»
<Zoffix> m​: say(s/^// or s/^//)
<camelia> rakudo-moar 405519​: OUTPUT«===SORRY!=== Error while compiling <tmp>␤Unable to parse expression in argument list; couldn't find final ')' ␤at <tmp>​:1␤------> say(s/^//⏏ or s/^//)␤ expecting any of​:␤ infix␤ infix stopper␤»
<Zoffix> m​: say(S/^// or S/^//)
<camelia> rakudo-moar 405519​: OUTPUT«===SORRY!=== Error while compiling <tmp>␤Unable to parse expression in argument list; couldn't find final ')' ␤at <tmp>​:1␤------> say(S/^//⏏ or S/^//)␤ expecting any of​:␤ infix␤ infix stopper␤»

These are parsed fine​:
<Zoffix> m​: say(s/^// && s/^//)
<camelia> rakudo-moar 405519​: OUTPUT«Method 'match' not found for invocant of class 'Any'␤ in block <unit> at <tmp> line 1␤␤»
<Zoffix> m​: say(S/^// && S/^//)
<camelia> rakudo-moar 405519​: OUTPUT«Method 'match' not found for invocant of class 'Any'␤ in block <unit> at <tmp> line 1␤␤»

@p6rt
Copy link
Author

p6rt commented Jul 10, 2016

From @zoffixznet

The s/// appears not to be involved ( http://irclog.perlgeek.de/perl6-dev/2016-07-10#i_12816423 )​:

<lucasb> m​: sub f {}; f(1 or 2)
<camelia> rakudo-moar 89470a​: OUTPUT«===SORRY!=== Error while compiling <tmp>␤Unable to parse expression in argument list; couldn't find final ')' ␤at <tmp>​:1␤------> sub f {}; f(1⏏ or 2)␤ expecting any of​:␤ infix␤ infix stopper␤»

@p6rt
Copy link
Author

p6rt commented Jul 10, 2016

From @zoffixznet

Not a bug as per http://irclog.perlgeek.de/perl6-dev/2016-07-10#i_12816463

The or is lower precedence and the invocation parentheses aren't grouping parentheses so the `or` ends up or'ing the unclosed `sub-call(`

@p6rt
Copy link
Author

p6rt commented Jul 10, 2016

@zoffixznet - Status changed from 'new' to 'rejected'

@p6rt p6rt closed this as completed Jul 10, 2016
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant