By grabbing the length, we can use sv_setpvn here.
[p5sagit/p5-mst-13.2.git] / x2p / a2p.y
index 4b81f30..8ae8953 100644 (file)
--- a/x2p/a2p.y
+++ b/x2p/a2p.y
@@ -1,7 +1,8 @@
 %{
 /* $RCSfile: a2p.y,v $$Revision: 4.1 $$Date: 92/08/07 18:29:12 $
  *
- *    Copyright (c) 1991, Larry Wall
+ *    Copyright (C) 1991, 1992, 1993, 1994, 1996, 1997, 1999, 2000,
+ *    by Larry Wall and others
  *
  *    You may distribute under the terms of either the GNU General Public
  *    License or the Artistic License, as specified in the README file.
@@ -21,7 +22,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 +145,9 @@ expr        : term
                }
        ;
 
+sprintf        : SPRINTF_NEW
+       | SPRINTF_OLD ;
+
 term   : variable
                { $$ = $1; }
        | NUMBER
@@ -204,7 +208,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); }
@@ -394,6 +400,6 @@ compound
 
 %%
 
-int yyparse _((void));
+int yyparse (void);
 
 #include "a2py.c"