summaryrefslogtreecommitdiffstats
path: root/lib/command_lex.l
diff options
context:
space:
mode:
Diffstat (limited to 'lib/command_lex.l')
-rw-r--r--lib/command_lex.l12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/command_lex.l b/lib/command_lex.l
index e245fc497..703596b43 100644
--- a/lib/command_lex.l
+++ b/lib/command_lex.l
@@ -24,6 +24,11 @@
%{
#include "command_parse.h"
+
+#define YY_USER_ACTION yylloc->last_column += yyleng;
+#define LOC_STEP \
+ yylloc->first_column = yylloc->last_column; \
+ yylloc->first_line = yylloc->last_line;
%}
WORD (\-|\+)?[a-z0-9\*][-+_a-zA-Z0-9\*]*
@@ -45,9 +50,14 @@ RANGE \({NUMBER}[ ]?\-[ ]?{NUMBER}\)
%option prefix="cmd_yy"
%option reentrant
%option bison-bridge
+%option bison-locations
%%
-[ \t] /* ignore whitespace */;
+%{
+ LOC_STEP;
+%}
+
+[ \t]+ LOC_STEP /* ignore whitespace */;
{WORD} {yylval->string = XSTRDUP(MTYPE_TMP, yytext); return WORD;}
{IPV4} {yylval->string = XSTRDUP(MTYPE_TMP, yytext); return IPV4;}
{IPV4_PREFIX} {yylval->string = XSTRDUP(MTYPE_TMP, yytext); return IPV4_PREFIX;}