Fix parsing of variable names that are a suffix of '__curPos'

Follow-up from #5969
Fix #5982
This commit is contained in:
regnat 2022-01-25 10:49:27 +01:00
parent 0a70b37b56
commit f113ea6c73
3 changed files with 4 additions and 1 deletions

View file

@ -405,7 +405,7 @@ expr_select
expr_simple expr_simple
: ID { : ID {
std::string_view s = "__curPos"; std::string_view s = "__curPos";
if (strncmp($1.p, s.data(), s.size()) == 0) if ($1.l == s.size() && strncmp($1.p, s.data(), s.size()) == 0)
$$ = new ExprPos(CUR_POS); $$ = new ExprPos(CUR_POS);
else else
$$ = new ExprVar(CUR_POS, data->symbols.create($1)); $$ = new ExprVar(CUR_POS, data->symbols.create($1));

View file

@ -0,0 +1 @@
3

View file

@ -0,0 +1,2 @@
((__curPosFoo: __curPosFoo) 1) + ((__curPosBar: __curPosBar) 2)