fixed a bug in parsing an expression like "1++b" in awk/parse.c
This commit is contained in:
parent
f843a6e003
commit
55182c4232
@ -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.
|
Copyright 2006-2011 Chung, Hyung-Hwan.
|
||||||
This file is part of QSE.
|
This file is part of QSE.
|
||||||
@ -4171,11 +4171,13 @@ static qse_awk_nde_t* parse_increment (
|
|||||||
type = QSE_AWK_NDE_EXP_INCPST;
|
type = QSE_AWK_NDE_EXP_INCPST;
|
||||||
opcode = opcode2;
|
opcode = opcode2;
|
||||||
|
|
||||||
|
/* let's do it later
|
||||||
if (get_token(awk) <= -1)
|
if (get_token(awk) <= -1)
|
||||||
{
|
{
|
||||||
qse_awk_clrpt (awk, left);
|
qse_awk_clrpt (awk, left);
|
||||||
return QSE_NULL;
|
return QSE_NULL;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_var(left) && left->type != QSE_AWK_NDE_POS)
|
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*)
|
nde = (qse_awk_nde_exp_t*)
|
||||||
QSE_AWK_ALLOC (awk, QSE_SIZEOF(qse_awk_nde_exp_t));
|
QSE_AWK_ALLOC (awk, QSE_SIZEOF(qse_awk_nde_exp_t));
|
||||||
if (nde == QSE_NULL)
|
if (nde == QSE_NULL)
|
||||||
|
@ -8,5 +8,7 @@ BEGIN {
|
|||||||
print a;
|
print a;
|
||||||
print b;
|
print b;
|
||||||
print c;
|
print c;
|
||||||
|
|
||||||
|
print 99++c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user