diff options
author | Albert Dvornik <bert@genscan.com> | 1998-10-30 12:50:04 -0500 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-10-31 09:39:13 +0000 |
commit | 2efaeb471b8b92d7180a656a22c05b363d242664 (patch) | |
tree | 917d020ac9accd086748ca08b8c8da3594844f8c /x2p/a2p.y | |
parent | f4d63e4e7d78bcec478ee81b6381e3ffc03f7329 (diff) | |
download | perl-2efaeb471b8b92d7180a656a22c05b363d242664.tar.gz |
] a2p: make sprintf less greedy without -o
Message-Id: <tqd879vf4z.fsf@puma.genscan.com>
p4raw-id: //depot/perl@2161
Diffstat (limited to 'x2p/a2p.y')
-rw-r--r-- | x2p/a2p.y | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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); } |