This is a live mirror of the Perl 5 development currently hosted at
https://github.com/perl/perl5
https://perl5.git.perl.org
/
perl5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
The non-unix parts for localtime_r_needs_tzset
[perl5.git]
/
x2p
/
a2p.y
diff --git
a/x2p/a2p.y
b/x2p/a2p.y
index
2d3f239
..
74c42d8
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 $
*
%{
/* $RCSfile: a2p.y,v $$Revision: 4.1 $$Date: 92/08/07 18:29:12 $
*
- * Copyright (c) 1991-1997, 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.
*
* 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 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
%token IF ELSE WHILE FOR IN
%token EXIT NEXT BREAK CONTINUE RET
%token GETLINE DO SUB GSUB MATCH
@@
-43,7
+44,7
@@
int ends = Nullop;
%left NOT
%right '^'
%left INCR DECR
%left NOT
%right '^'
%left INCR DECR
-%left FIELD VFIELD
+%left FIELD VFIELD
SVFIELD
%%
%%
@@
-136,14
+137,18
@@
expr : term
| expr '?' expr ':' expr
{ $$ = oper3(OCOND,$1,$3,$5); }
| variable ASGNOP cond
| expr '?' expr ':' expr
{ $$ = oper3(OCOND,$1,$3,$5); }
| variable ASGNOP cond
- { $$ = oper3(OASSIGN,$2,$1,$3);
- if ((ops[$1].ival & 255) == OFLD)
- lval_field = TRUE;
- if ((ops[$1].ival & 255) == OVFLD)
- lval_field = TRUE;
+ {
+ $$ = oper3(OASSIGN,$2,$1,$3);
+ if ((ops[$1].ival & 255) == OFLD)
+ lval_field = TRUE;
+ else if ((ops[$1].ival & 255) == OVFLD)
+ lval_field = TRUE;
}
;
}
;
+sprintf : SPRINTF_NEW
+ | SPRINTF_OLD ;
+
term : variable
{ $$ = $1; }
| NUMBER
term : variable
{ $$ = $1; }
| NUMBER
@@
-165,13
+170,37
@@
term : variable
| term IN VAR
{ $$ = oper2(ODEFINED,aryrefarg($3),$1); }
| variable INCR
| term IN VAR
{ $$ = oper2(ODEFINED,aryrefarg($3),$1); }
| variable INCR
- { $$ = oper1(OPOSTINCR,$1); }
+ {
+ $$ = oper1(OPOSTINCR,$1);
+ if ((ops[$1].ival & 255) == OFLD)
+ lval_field = TRUE;
+ else if ((ops[$1].ival & 255) == OVFLD)
+ lval_field = TRUE;
+ }
| variable DECR
| variable DECR
- { $$ = oper1(OPOSTDECR,$1); }
+ {
+ $$ = oper1(OPOSTDECR,$1);
+ if ((ops[$1].ival & 255) == OFLD)
+ lval_field = TRUE;
+ else if ((ops[$1].ival & 255) == OVFLD)
+ lval_field = TRUE;
+ }
| INCR variable
| INCR variable
- { $$ = oper1(OPREINCR,$2); }
+ {
+ $$ = oper1(OPREINCR,$2);
+ if ((ops[$2].ival & 255) == OFLD)
+ lval_field = TRUE;
+ else if ((ops[$2].ival & 255) == OVFLD)
+ lval_field = TRUE;
+ }
| DECR variable
| DECR variable
- { $$ = oper1(OPREDECR,$2); }
+ {
+ $$ = oper1(OPREDECR,$2);
+ if ((ops[$2].ival & 255) == OFLD)
+ lval_field = TRUE;
+ else if ((ops[$2].ival & 255) == OVFLD)
+ lval_field = TRUE;
+ }
| '-' term %prec UMINUS
{ $$ = oper1(OUMINUS,$2); }
| '+' term %prec UMINUS
| '-' term %prec UMINUS
{ $$ = oper1(OUMINUS,$2); }
| '+' term %prec UMINUS
@@
-204,7
+233,9
@@
term : variable
{ $$ = oper1($1,$3); }
| USERFUN '(' expr_list ')'
{ $$ = oper2(OUSERFUN,$1,$3); }
{ $$ = 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); }
{ $$ = oper1(OSPRINTF,$2); }
| SUBSTR '(' expr ',' expr ',' expr ')'
{ $$ = oper3(OSUBSTR,$3,$5,$7); }
@@
-246,6
+277,8
@@
variable: VAR
{ $$ = oper2(OVAR,aryrefarg($1),$3); }
| FIELD
{ $$ = oper1(OFLD,$1); }
{ $$ = oper2(OVAR,aryrefarg($1),$3); }
| FIELD
{ $$ = oper1(OFLD,$1); }
+ | SVFIELD
+ { $$ = oper1(OVFLD,oper1(OVAR,$1)); }
| VFIELD term
{ $$ = oper1(OVFLD,$2); }
;
| VFIELD term
{ $$ = oper1(OVFLD,$2); }
;
@@
-394,6
+427,6
@@
compound
%%
%%
-int yyparse
_((void)
);
+int yyparse
(void
);
#include "a2py.c"
#include "a2py.c"