Permalink
Browse files

[CORE.setting] add Parameter type

[STD] enhance LTA messages about malformed defaults, invocants
[STD] allow infix operators to see the current precedence limiter


git-svn-id: http://svn.pugscode.org/pugs@28683 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 2957257 commit 3a968f48a542dff4bff12150eb257ef9c83c540e lwall committed Oct 9, 2009
Showing with 7 additions and 1 deletion.
  1. +1 −0 CORE.setting
  2. +6 −1 STD.pm
View
@@ -17,6 +17,7 @@ my class HyperWhatever { }
my class Capture { }
my class Match { }
my class Signature { }
+my class Parameter { }
my class Proxy { }
my class Matcher { }
my class Package { }
View
7 STD.pm
@@ -541,6 +541,7 @@ rule comp_unit {
:my $*QUASIMODO;
:my $*SCOPE = "";
:my $*LEFTSIGIL;
+ :my $*PRECLIM;
:my %*MYSTERY = ();
:my $*INVOCANT_OK;
:my $*INVOCANT_IS;
@@ -3228,7 +3229,10 @@ token parameter {
}
$kind = '?' if $kind eq '!';
}}
+ [<?before ':' > <.panic: "Can't put a default on the invocant parameter">]?
+ [<!before <[,)-]> > <.panic: "Default expression must come last">]?
]?
+ [<?before ':'> <?{ $kind ne '!' }> <.panic: "Invocant is too exotic">]?
{
$<quant> = $quant;
@@ -4089,7 +4093,7 @@ token infix:sym<,> ( --> Comma)
token infix:sym<:> ( --> Comma)
{ <sym> <?before \s | <terminator> >
- {.panic("Illegal use of colon as invocant marker") unless $*INVOCANT_OK--; }
+ {.panic("Illegal use of colon as invocant marker") unless $*INVOCANT_OK-- or $*PRECLIM ge $item_assignment_prec; }
}
token infix:sym« p5=> » ( --> Comma)
@@ -4306,6 +4310,7 @@ method EXPR ($preclvl) {
}
my $preclim = $preclvl ?? $preclvl.<prec> // $LOOSEST !! $LOOSEST;
my $*LEFTSIGIL = '';
+ my $*PRECLIM = $preclim;
my @termstack;
my @opstack;
my $termish = 'termish';

0 comments on commit 3a968f4

Please sign in to comment.