Skip to content

Commit

Permalink
Merge pull request #280 from peschwa/nom
Browse files Browse the repository at this point in the history
Added X::Syntax::BlockTaken and use it from the Grammar.
  • Loading branch information
lizmat committed Jun 16, 2014
2 parents 6ca805d + ec27142 commit 09134a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Perl6/Grammar.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -1183,13 +1183,13 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
if $*BORG<name> {
$/.CURSOR.'!clear_highwater'();
$/.CURSOR.'!cursor_pos'($*BORG<block>.CURSOR.pos);
$/.CURSOR.sorry("Function '" ~ $*BORG<name> ~ "' needs parens to avoid taking the block");
$/.CURSOR.typed_sorry('X::Syntax::BlockTaken', what => ~$*BORG<name>);
$/.CURSOR.'!cursor_pos'($pos);
$/.CURSOR.missing("block (apparently taken by '" ~ $*BORG<name> ~ "')");
} else {
$/.CURSOR.'!clear_highwater'();
$/.CURSOR.'!cursor_pos'($*BORG<block>.CURSOR.pos);
$/.CURSOR.sorry("Expression needs parens to avoid taking the block");
$/.CURSOR.typed_sorry('X::Syntax::BlockTaken');
$/.CURSOR.'!cursor_pos'($pos);
$/.CURSOR.missing("block (apparently taken by expression)");
}
Expand Down
4 changes: 4 additions & 0 deletions src/core/Exception.pm
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,10 @@ my class X::Syntax::Missing does X::Syntax {
has $.what;
method message() { "Missing $.what" }
}
my class X::Syntax::BlockTaken does X::Syntax {
has $.what;
method message() { "{ $.what ?? 'Function ' ~ $.what !! 'Expression' } needs parens to avoid taking the block." };
}

my class X::Syntax::Perl5Var does X::Syntax {
has $.name;
Expand Down

0 comments on commit 09134a7

Please sign in to comment.