Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
better messages on loose precedence inside ??!!
(And fix off-by-one limit error; we don't allow assignment
in there either, since it's looser than ternary.)
  • Loading branch information
TimToady committed Mar 29, 2015
1 parent 91958cf commit 225a7e3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Perl6/Grammar.nqp
Expand Up @@ -4200,12 +4200,13 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
:my $*GOAL := '!!';
'??'
<.ws>
<EXPR('i=')>
<EXPR('j=')>
[ '!!'
|| <?before '::'<-[=]>> <.panic: "Please use !! rather than ::">
|| <?before ':' <-[=]>> <.panic: "Please use !! rather than :">
|| <?{ ~$<EXPR> ~~ / '!!' / }> <.panic("Your !! was gobbled by the expression in the middle; please use parens")>
|| <?before \N*? [\n\N*?]?> '!!' <.sorry("Bogus code found before the !!")> <.panic("Confused")>
|| <infixish> {} <.panic("Precedence of $<infixish> is too low to use inside ?? !!; please parenthesize")>
|| <?{ ~$<EXPR> ~~ / '!!' / }> <.panic("Your !! was gobbled by the expression in the middle; please parenthesize")>
|| <?before \N*? [\n\N*?]? '!!'> <.sorry("Bogus code found before the !!")> <.panic("Confused")>
|| <.sorry("Found ?? but no !!")> <.panic("Confused")>
]
<O('%conditional, :reducecheck<ternary>, :pasttype<if>')>
Expand Down

0 comments on commit 225a7e3

Please sign in to comment.