Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
throw for P5ish use of "?? :" without upsetting adverbs
  • Loading branch information
FROGGS committed Apr 17, 2015
1 parent e55c80b commit a95107d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Perl6/Grammar.nqp
Expand Up @@ -4264,6 +4264,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
<EXPR('j=')>
[ '!!'
|| <?before '::' <-[=]>> { self.typed_panic: "X::Syntax::ConditionalOperator::SecondPartInvalid", second-part => "::" }
|| <?before ':' <-[=\w]>> { self.typed_panic: "X::Syntax::ConditionalOperator::SecondPartInvalid", second-part => ":" }
|| <infixish> { self.typed_panic: "X::Syntax::ConditionalOperator::PrecedenceTooLoose", operator => ~$<infixish> }
|| <?{ ~$<EXPR> ~~ / '!!' / }> { self.typed_panic: "X::Syntax::ConditionalOperator::SecondPartGobbled" }
|| <?before \N*? [\n\N*?]? '!!'> { self.typed_panic: "X::Syntax::Confused", reason => "Confused: Bogus code found before the !! of conditional operator" }
Expand Down Expand Up @@ -4353,6 +4354,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
{ $*INVOCANT_OK := 0 }
}
token infix:sym<:> {
<?{ $*INVOCANT_OK && $*GOAL ne '!!' }>
<.unsp>? <sym> <?before \s | <.terminator> >
<O('%comma, :fiddly<0>')>
[ <?{ $*INVOCANT_OK }> || <.panic: "Invocant colon not allowed here"> ]
Expand Down

0 comments on commit a95107d

Please sign in to comment.