Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add more mappings

  • Loading branch information...
commit 22d496347c58c3ecb77584f01a9d040d0712a122 1 parent 9276bae
@bacek bacek authored
View
12 compilers/opsc/src/Ops/Compiler/Grammar.pm
@@ -215,8 +215,8 @@ token infix:sym<-=> { <sym> <O('%assignment :pirop<-=>')> }
token infix:sym<*=> { <sym> <O('%assignment :pirop<*=>')> }
token infix:sym</=> { <sym> <O('%assignment :pirop</=>')> }
-token infix:sym«>>=» { <sym> <O('%assignment :pirop<>>=>')> }
-token infix:sym«<<=» { <sym> <O('%assignment :pirop<<<=>')> }
+token infix:sym«>>=» { <sym> <O('%assignment :pirop<shr_assign>')> }
+token infix:sym«<<=» { <sym> <O('%assignment :pirop<shl_assign>')> }
token infix:sym<,> { <sym> <O('%comma')> }
@@ -229,10 +229,10 @@ token infix:sym<-> { <sym> <!before '>' > <O('%additive :pirop<->')> }
token infix:sym«==» { <sym> <O('%relational :pirop<==>')> }
token infix:sym«!=» { <sym> <O('%relational :pirop<!=>')> }
-token infix:sym«<=» { <sym> <O('%relational :pirop<<=>')> }
-token infix:sym«>=» { <sym> <O('%relational :pirop<>=>')> }
-token infix:sym«<» { <sym> <O('%relational :pirop<<>')> }
-token infix:sym«>» { <sym> <O('%relational :pirop<>>')> }
+token infix:sym«<=» { <sym> <O('%relational :pirop<le>')> }
+token infix:sym«>=» { <sym> <O('%relational :pirop<ge>')> }
+token infix:sym«<» { <sym> <O('%relational :pirop<lt>')> }
+token infix:sym«>» { <sym> <O('%relational :pirop<gt>')> }
token infix:sym<&> { <sym> <O('%tight_and :pirop<&>')> }
token infix:sym<^> { <sym> <O('%tight_and :pirop<^>')> } # XXX Check precedence
View
18 compilers/opsc/src/Ops/Op.pm
@@ -302,11 +302,6 @@ our multi method process_body_chunk($trans, PAST::Val $val) {
$val.value;
}
-our %PIROP_MAPPING := hash(
- :shr('>>'),
- :shl('<<'),
-);
-
our multi method process_body_chunk($trans, PAST::Var $var) {
if ($var.isdecl) {
my $res := $var.vivibase ~ ' ' ~ $var.name;
@@ -330,6 +325,19 @@ our multi method process_body_chunk($trans, PAST::Var $var) {
}
}
+our %PIROP_MAPPING := hash(
+ :shr('>>'),
+ :shl('<<'),
+
+ :shr_assign('>>='),
+ :shl_assign('<<='),
+
+ :le('<='),
+ :ge('>='),
+ :lt('<'),
+ :gt('>'),
+);
+
our multi method process_body_chunk($trans, PAST::Op $chunk) {
my $type := $chunk.pasttype;
#say('OP ' ~ $type);

0 comments on commit 22d4963

Please sign in to comment.
Something went wrong with that request. Please try again.