mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-12-02 02:16:15 +02:00
reset yylloc when yyless(0) is called
This commit is contained in:
parent
fd01c48d34
commit
f14660d5e2
1 changed files with 6 additions and 0 deletions
|
@ -28,6 +28,8 @@ using namespace nix;
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
// backup to recover from yyless(0)
|
||||||
|
YYLTYPE prev_yylloc;
|
||||||
|
|
||||||
static void initLoc(YYLTYPE * loc)
|
static void initLoc(YYLTYPE * loc)
|
||||||
{
|
{
|
||||||
|
@ -38,6 +40,8 @@ static void initLoc(YYLTYPE * loc)
|
||||||
|
|
||||||
static void adjustLoc(YYLTYPE * loc, const char * s, size_t len)
|
static void adjustLoc(YYLTYPE * loc, const char * s, size_t len)
|
||||||
{
|
{
|
||||||
|
prev_yylloc = *loc;
|
||||||
|
|
||||||
loc->first_line = loc->last_line;
|
loc->first_line = loc->last_line;
|
||||||
loc->first_column = loc->last_column;
|
loc->first_column = loc->last_column;
|
||||||
|
|
||||||
|
@ -210,6 +214,7 @@ or { return OR_KW; }
|
||||||
{HPATH_START}\$\{ {
|
{HPATH_START}\$\{ {
|
||||||
PUSH_STATE(PATH_START);
|
PUSH_STATE(PATH_START);
|
||||||
yyless(0);
|
yyless(0);
|
||||||
|
*yylloc = prev_yylloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
<PATH_START>{PATH_SEG} {
|
<PATH_START>{PATH_SEG} {
|
||||||
|
@ -265,6 +270,7 @@ or { return OR_KW; }
|
||||||
context (it may be ')', ';', or something of that sort) */
|
context (it may be ')', ';', or something of that sort) */
|
||||||
POP_STATE();
|
POP_STATE();
|
||||||
yyless(0);
|
yyless(0);
|
||||||
|
*yylloc = prev_yylloc;
|
||||||
return PATH_END;
|
return PATH_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue