aboutsummaryrefslogtreecommitdiff
path: root/editors/awk.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2005-06-07 02:43:52 +0000
committerRob Landley <rob@landley.net>2005-06-07 02:43:52 +0000
commited830e8693941b8e54869ef4e68353ca2d71224e (patch)
tree33bdff8ca5390fb4be5ff64815b170d151f19517 /editors/awk.c
parentf3133c414989a1409d79db43a426f122dc06cbed (diff)
downloadbusybox-w32-ed830e8693941b8e54869ef4e68353ca2d71224e.tar.gz
busybox-w32-ed830e8693941b8e54869ef4e68353ca2d71224e.tar.bz2
busybox-w32-ed830e8693941b8e54869ef4e68353ca2d71224e.zip
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).
Diffstat (limited to 'editors/awk.c')
-rw-r--r--editors/awk.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/editors/awk.c b/editors/awk.c
index c1cb2a2e2..ed8b0f20f 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -1084,7 +1084,7 @@ static node *parse_expr(unsigned long iexp) {
1084 cn->a.n = vn; 1084 cn->a.n = vn;
1085 xtc = TC_OPERAND | TC_UOPPRE | TC_REGEXP; 1085 xtc = TC_OPERAND | TC_UOPPRE | TC_REGEXP;
1086 if (tc & (TC_OPERAND | TC_REGEXP)) { 1086 if (tc & (TC_OPERAND | TC_REGEXP)) {
1087 xtc = TC_UOPPRE | TC_BINOP | TC_OPERAND | iexp; 1087 xtc = TC_UOPPRE | TC_UOPPOST | TC_BINOP | TC_OPERAND | iexp;
1088 /* one should be very careful with switch on tclass - 1088 /* one should be very careful with switch on tclass -
1089 * only simple tclasses should be used! */ 1089 * only simple tclasses should be used! */
1090 switch (tc) { 1090 switch (tc) {
@@ -1101,7 +1101,6 @@ static node *parse_expr(unsigned long iexp) {
1101 cn->info |= xS; 1101 cn->info |= xS;
1102 cn->r.n = parse_expr(TC_ARRTERM); 1102 cn->r.n = parse_expr(TC_ARRTERM);
1103 } 1103 }
1104 xtc = TC_UOPPOST | TC_UOPPRE | TC_BINOP | TC_OPERAND | iexp;
1105 break; 1104 break;
1106 1105
1107 case TC_NUMBER: 1106 case TC_NUMBER: