aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/lexer.l
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/lexer.l')
-rw-r--r--src/libexpr/lexer.l10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l
index a3a8608d9..df2cbd06f 100644
--- a/src/libexpr/lexer.l
+++ b/src/libexpr/lexer.l
@@ -1,4 +1,5 @@
%option reentrant bison-bridge bison-locations
+%option align
%option noyywrap
%option never-interactive
%option stack
@@ -35,9 +36,6 @@ static inline PosIdx makeCurPos(const YYLTYPE & loc, ParseData * data)
#define CUR_POS makeCurPos(*yylloc, data)
-// backup to recover from yyless(0)
-thread_local YYLTYPE prev_yylloc;
-
static void initLoc(YYLTYPE * loc)
{
loc->first_line = loc->last_line = 1;
@@ -46,7 +44,7 @@ static void initLoc(YYLTYPE * loc)
static void adjustLoc(YYLTYPE * loc, const char * s, size_t len)
{
- prev_yylloc = *loc;
+ loc->stash();
loc->first_line = loc->last_line;
loc->first_column = loc->last_column;
@@ -230,7 +228,7 @@ or { return OR_KW; }
{HPATH_START}\$\{ {
PUSH_STATE(PATH_START);
yyless(0);
- *yylloc = prev_yylloc;
+ yylloc->unstash();
}
<PATH_START>{PATH_SEG} {
@@ -286,7 +284,7 @@ or { return OR_KW; }
context (it may be ')', ';', or something of that sort) */
POP_STATE();
yyless(0);
- *yylloc = prev_yylloc;
+ yylloc->unstash();
return PATH_END;
}