mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-13 01:36:15 +02:00
Fix parsing of variable names that are a prefix of '__curPos'
Fixes $ nix-instantiate --parse -E 'x: with x; _' (x: (with x; __curPos))
This commit is contained in:
parent
c4fc9b6a8d
commit
bed8270c0c
3 changed files with 4 additions and 1 deletions
|
@ -404,7 +404,8 @@ expr_select
|
||||||
|
|
||||||
expr_simple
|
expr_simple
|
||||||
: ID {
|
: ID {
|
||||||
if (strncmp($1.p, "__curPos", $1.l) == 0)
|
std::string_view s = "__curPos";
|
||||||
|
if (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-20220122.exp
Normal file
1
tests/lang/eval-okay-regression-20220122.exp
Normal file
|
@ -0,0 +1 @@
|
||||||
|
3
|
1
tests/lang/eval-okay-regression-20220122.nix
Normal file
1
tests/lang/eval-okay-regression-20220122.nix
Normal file
|
@ -0,0 +1 @@
|
||||||
|
((_: _) 1) + ((__: __) 2)
|
Loading…
Reference in a new issue