[BusyBox-cvs] svn commit: trunk/busybox/editors

landley at busybox.net landley at busybox.net
Tue Jun 7 02:43:53 UTC 2005


Author: landley
Date: 2005-06-06 20:43:52 -0600 (Mon, 06 Jun 2005)
New Revision: 10478

Log:
Patch from Dmitry Zakharov:

Charlie Brady wrote:
> Here's another awk parsing problem - unary post increment - pre is fine:
>
>bash-2.05a$ echo 2,3 | gawk -F , '{ $2++ }'
>bash-2.05a$ echo 2,3 | /tmp/busybox/busybox awk -F , '{ $2++ }'
>awk: cmd. line:1: Unexpected token
>
Here's a fix for this. There is another problem with constructions like 
"print (A+B) ++C", I don't
know whether somebody uses such constructions (fixing both these 
problems would require very
serious change in awk code).


Modified:
   trunk/busybox/editors/awk.c


Changeset:
Modified: trunk/busybox/editors/awk.c
===================================================================
--- trunk/busybox/editors/awk.c	2005-06-07 02:40:39 UTC (rev 10477)
+++ trunk/busybox/editors/awk.c	2005-06-07 02:43:52 UTC (rev 10478)
@@ -1084,7 +1084,7 @@
 			cn->a.n = vn;
 			xtc = TC_OPERAND | TC_UOPPRE | TC_REGEXP;
 			if (tc & (TC_OPERAND | TC_REGEXP)) {
-				xtc = TC_UOPPRE | TC_BINOP | TC_OPERAND | iexp;
+				xtc = TC_UOPPRE | TC_UOPPOST | TC_BINOP | TC_OPERAND | iexp;
 				/* one should be very careful with switch on tclass -
 				 * only simple tclasses should be used! */
 				switch (tc) {
@@ -1101,7 +1101,6 @@
 						cn->info |= xS;
 						cn->r.n = parse_expr(TC_ARRTERM);
 					}
-					xtc = TC_UOPPOST | TC_UOPPRE | TC_BINOP | TC_OPERAND | iexp;
 					break;
 				
 				  case TC_NUMBER:




More information about the busybox-cvs mailing list