forked from lix-project/lix
Merge pull request #5984 from NixOS/5982-correctly-parse-__curPosFoo
Fix parsing of variable names that are a suffix of '__curPos'
This commit is contained in:
commit
a9a90b3c1f
|
@ -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));
|
||||||
|
|
1
tests/lang/eval-okay-regression-20220125.exp
Normal file
1
tests/lang/eval-okay-regression-20220125.exp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
3
|
2
tests/lang/eval-okay-regression-20220125.nix
Normal file
2
tests/lang/eval-okay-regression-20220125.nix
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
((__curPosFoo: __curPosFoo) 1) + ((__curPosBar: __curPosBar) 2)
|
||||||
|
|
Loading…
Reference in a new issue