X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=x2p%2Fa2p.y;h=3bb4e0998ab3f536a0b609faa49c506dbb2fe132;hb=7509b6572737d9774c4d9688c4edf46238aa95f2;hp=2d3f23923e540227af7485b500ef67b6ef61b28a;hpb=9607fc9c489d4095e3baa795d7ead7acba96137d;p=p5sagit%2Fp5-mst-13.2.git diff --git a/x2p/a2p.y b/x2p/a2p.y index 2d3f239..3bb4e09 100644 --- a/x2p/a2p.y +++ b/x2p/a2p.y @@ -21,7 +21,7 @@ int ends = Nullop; %token REGEX %token SEMINEW NEWLINE COMMENT %token FUN1 FUNN GRGR -%token PRINT PRINTF SPRINTF SPLIT +%token PRINT PRINTF SPRINTF_OLD SPRINTF_NEW SPLIT %token IF ELSE WHILE FOR IN %token EXIT NEXT BREAK CONTINUE RET %token GETLINE DO SUB GSUB MATCH @@ -144,6 +144,9 @@ expr : term } ; +sprintf : SPRINTF_NEW + | SPRINTF_OLD ; + term : variable { $$ = $1; } | NUMBER @@ -204,7 +207,9 @@ term : variable { $$ = oper1($1,$3); } | USERFUN '(' expr_list ')' { $$ = oper2(OUSERFUN,$1,$3); } - | SPRINTF expr_list + | SPRINTF_NEW '(' expr_list ')' + { $$ = oper1(OSPRINTF,$3); } + | sprintf expr_list { $$ = oper1(OSPRINTF,$2); } | SUBSTR '(' expr ',' expr ',' expr ')' { $$ = oper3(OSUBSTR,$3,$5,$7); }