File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -437,6 +437,32 @@ class NQP::Actions is HLL::Actions {
437
437
method statement_mod_loop :sym <while >($/ ) { make $ < cond > . ast; }
438
438
method statement_mod_loop :sym <until >($/ ) { make $ < cond > . ast; }
439
439
440
+ # # Expression handling.
441
+
442
+ method EXPR ($/ , $ key ? ) {
443
+ unless $ key { return 0 ; }
444
+ my $ past := $/ . ast // $ < OPER > . ast;
445
+ unless $ past {
446
+ $ past := QAST ::Op. new ( : node($/ ) );
447
+ if $ < OPER >< O >< op > {
448
+ $ past . op( ~ $ < OPER >< O >< op > );
449
+ }
450
+ unless $ past . op {
451
+ if $ key eq ' LIST' { $ key := ' infix' ; }
452
+ my $ name := nqp :: lc ($ key ) ~ ' :<' ~ $ < OPER >< sym > ~ ' >' ;
453
+ $ past . op(' call' ),
454
+ $ past . name (' &' ~ $ name );
455
+ }
456
+ }
457
+ if $ key eq ' POSTFIX' {
458
+ $ past . unshift ($/ [0 ]. ast);
459
+ }
460
+ else {
461
+ for $/ . list { if nqp :: defined ($ _ . ast) { $ past . push ($ _ . ast); } }
462
+ }
463
+ make $ past ;
464
+ }
465
+
440
466
# # Terms
441
467
442
468
method term :sym <fatarrow >($/ ) { make $ < fatarrow > . ast; }
You can’t perform that action at this time.
0 commit comments