Browse files

Fix parsing of <<+>>

  • Loading branch information...
1 parent 93cb7df commit beb5018a95bfe6e15aa240401640b9af65dc51d9 @sorear committed May 27, 2011
Showing with 33 additions and 0 deletions.
  1. +33 −0 src/niecza
View
33 src/niecza
@@ -30,6 +30,39 @@ use Sig;
# Operator::Method.meta, Op::CallMethod.ismeta now Str
+augment class STD::P6 { #OK
+constant %item_assignment = (:dba('item assignment') , :prec<i=>, :assoc<right>, :!pure);
+ token infixish ($in_meta?) {
+ :my ($infix, $O, $sym);
+ :temp $*IN_META;
+ :my $stub = ($*IN_META = $in_meta // $*IN_META); #OK not used
+ <!stdstopper>
+ <!infixstopper>
+ :dba('infix or meta-infix')
+ [
+ | <colonpair> $<fake> = {1} { $sym = ':' }
+ { $O = {:prec(%item_assignment<prec>), :assoc<unary>,
+ :dba<adverb> } }
+ # actual test is non-inclusive!
+ | [
+ | :dba('bracketed infix') '[' ~ ']' <infix=.infixish('[]')> { $O = $<infix><O>; $sym = $<infix><sym> }
+ [ <!before '='> { self.worry("Useless use of [] around infix op") unless $*IN_META; } ]?
+ | <infix=infix_circumfix_meta_operator> { $O = $<infix><O>; $sym = $<infix><sym>; }
+ | <infix=infix_prefix_meta_operator> { $O = $<infix><O>; $sym = $<infix><sym>; }
+ | <infix> { $O = $<infix><O>; $sym = $<infix><sym>; }
+ | {} <?dotty> <.panic: "Method call found where infix expected (omit whitespace?)">
+ | {} <?postfix> <.panic: "Postfix found where infix expected (omit whitespace?)">
+ ]
+ [ <?before '='> <assign_meta_operator($<infix>)>
+ {$O = $<assign_meta_operator>[0]<O>}
+ {$sym = $<assign_meta_operator>[0]<sym>}
+ ]?
+
+ ]
+ $<O> = { $O } $<sym> = { $sym }
+ }
+}
+
augment class Sig::Parameter { #OK
method bind_inline($body, @posr) {
my $get = $!full_parcel ?? self.parcel_get_inline(@posr) !!

0 comments on commit beb5018

Please sign in to comment.