From 55182c42322d6e8d39660d5391f881934a0b8413 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sat, 13 Aug 2011 08:16:05 +0000 Subject: [PATCH] fixed a bug in parsing an expression like "1++b" in awk/parse.c --- qse/lib/awk/parse.c | 14 +++++++++++++- qse/regress/awk/lang-024.awk | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/qse/lib/awk/parse.c b/qse/lib/awk/parse.c index 4340a7f0..823df68c 100644 --- a/qse/lib/awk/parse.c +++ b/qse/lib/awk/parse.c @@ -1,5 +1,5 @@ /* - * $Id: parse.c 540 2011-08-11 15:11:02Z hyunghwan.chung $ + * $Id: parse.c 541 2011-08-12 14:16:05Z hyunghwan.chung $ * Copyright 2006-2011 Chung, Hyung-Hwan. This file is part of QSE. @@ -4171,11 +4171,13 @@ static qse_awk_nde_t* parse_increment ( type = QSE_AWK_NDE_EXP_INCPST; opcode = opcode2; + /* let's do it later if (get_token(awk) <= -1) { qse_awk_clrpt (awk, left); return QSE_NULL; } + */ } if (!is_var(left) && left->type != QSE_AWK_NDE_POS) @@ -4194,6 +4196,16 @@ static qse_awk_nde_t* parse_increment ( } } + if (type == QSE_AWK_NDE_EXP_INCPST) + { + /* consume the postfix operator */ + if (get_token(awk) <= -1) + { + qse_awk_clrpt (awk, left); + return QSE_NULL; + } + } + nde = (qse_awk_nde_exp_t*) QSE_AWK_ALLOC (awk, QSE_SIZEOF(qse_awk_nde_exp_t)); if (nde == QSE_NULL) diff --git a/qse/regress/awk/lang-024.awk b/qse/regress/awk/lang-024.awk index 2f198188..46bebd6b 100644 --- a/qse/regress/awk/lang-024.awk +++ b/qse/regress/awk/lang-024.awk @@ -8,5 +8,7 @@ BEGIN { print a; print b; print c; + + print 99++c; }