Skip to content

Commit

Permalink
Try harder to diagnose problem
Browse files Browse the repository at this point in the history
instead of reporting 'Malformed my'

Fixes RT #125902
  • Loading branch information
usev6 authored and AlexDaniel committed Oct 7, 2017
1 parent a09f5f2 commit c7a82d4
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/Perl6/Grammar.nqp
Expand Up @@ -2618,8 +2618,22 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
<DECL=multi_declarator>
| <DECL=multi_declarator>
]
|| <.ws>[<typename><.ws>]* <ident> <?before <.ws> [':'?':'?'=' | <.terminator> | $ ]> {}
<.malformed("$*SCOPE (did you mean to declare a sigilless \\{~$<ident>} or \${~$<ident>}?)")>
|| <.ws>[<typename><.ws>]* <ident>
<?before <.ws>
[
| ':'?':'?'='
| <.terminator>
| <trait>
| "where" <.ws> <EXPR>
| $
]
> {} <.malformed("$*SCOPE (did you mean to declare a sigilless \\{~$<ident>} or \${~$<ident>}?)")>
|| <.ws><typename><.ws> <?before "where" <.ws> <EXPR>> {}
<.malformed("$*SCOPE (found type followed by constraint; did you forget a variable in between?)")>
|| <.ws><typename><.ws> <?before <trait>> {}
<.malformed("$*SCOPE (found type followed by trait; did you forget a variable in between?)")>
|| <.ws><typename><.ws> <?before [ <.terminator> | $ ]> {}
<.malformed("$*SCOPE (did you forget a variable after type?)")>
|| <.ws><!typename> <typo_typename> <!>
|| <.malformed($*SCOPE)>
]
Expand Down

0 comments on commit c7a82d4

Please sign in to comment.