Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'nom' into newio
  • Loading branch information
lizmat committed Feb 24, 2015
2 parents 9b00cce + 546000b commit 6ea2a6f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/Perl6/Grammar.nqp
Expand Up @@ -268,7 +268,7 @@ role STD {
);
}
method worryobs($old, $new, $when = 'in Perl 6') {
$*W.throw(self.MATCH(), ['X', 'Obsolete'],
self.typed_worry('X::Obsolete',
old => $old,
replacement => $new,
when => $when,
Expand Down Expand Up @@ -3243,11 +3243,12 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
$/.CURSOR.worry("Use of non-subscript <...> where postfix is expected; please use whitespace")
if $trap && nqp::substr($/.CURSOR.orig, $/.CURSOR.pos, 1) eq '<';
if $trap == 1 { # probably misused P5ism
$<longname>.CURSOR.sorryobs("bare '$name'", ".$name if you meant \$_, or use an explicit invocant or argument");
$<longname>.CURSOR.worryobs("bare '$name'", ".$name if you meant \$_, or use an explicit invocant or argument");
}
elsif $trap == 2 { # probably misused P6ism
$<longname>.CURSOR.sorry("The '$name' listop may not be called without arguments (please use () or whitespace to clarify)");
$<longname>.CURSOR.worry("The '$name' listop may not be called without arguments (please use () or whitespace to clarify)");
}
$<longname>.CURSOR.sorry("No valid term seen where one is required");
}
}
}
Expand Down
12 changes: 10 additions & 2 deletions src/Perl6/World.nqp
Expand Up @@ -2780,14 +2780,22 @@ class Perl6::World is HLL::World {
}
else {
my $expected_infix := 0;
my $expected_term := 0;
for @expected {
if nqp::index($_, "infix") >= 0 {
$expected_infix := 1;
last;
}
elsif nqp::index($_, "prefix or term") >= 0 {
$expected_term := 1;
}
}
if $expected_infix {
%opts<reason> := "Two terms in a row";
if $expected_term {
%opts<reason> := "Bogus term";
}
else {
%opts<reason> := "Two terms in a row";
}
}
}
}
Expand Down

0 comments on commit 6ea2a6f

Please sign in to comment.