summaryrefslogtreecommitdiff
path: root/x2p/a2p.y
diff options
context:
space:
mode:
authorAlbert Dvornik <bert@genscan.com>1998-10-30 12:50:04 -0500
committerGurusamy Sarathy <gsar@cpan.org>1998-10-31 09:39:13 +0000
commit2efaeb471b8b92d7180a656a22c05b363d242664 (patch)
tree917d020ac9accd086748ca08b8c8da3594844f8c /x2p/a2p.y
parentf4d63e4e7d78bcec478ee81b6381e3ffc03f7329 (diff)
downloadperl-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.y9
1 files changed, 7 insertions, 2 deletions
diff --git a/x2p/a2p.y b/x2p/a2p.y
index 2d3f23923e..3bb4e0998a 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); }