60 lines
1.8 KiB
Diff
60 lines
1.8 KiB
Diff
From b652c8a14c3cda433cd8d3ebe8290ee7907e4815 Mon Sep 17 00:00:00 2001
|
|
From: Phil Sutter <phil@nwl.cc>
|
|
Date: Mon, 18 Jun 2018 10:23:22 +0200
|
|
Subject: [PATCH] scanner: Do not convert tabs into spaces
|
|
|
|
Commit 2f86dd5a43baf ("erec: Review erec_print()") changed erec_print()
|
|
function to expect tabs in input by replacing the whitespace character
|
|
in the marker line at the same offset with a tab character so that the
|
|
marker aligns with the offending part of input.
|
|
|
|
The need for that came from JSON input not having its tabs converted to
|
|
spaces, which erec_print() didn't expect.
|
|
|
|
Above change though has a shortcoming: When reading standard syntax
|
|
input from a file, Flex code converts tabs into spaces. Location
|
|
information is taken from this converted input, but when printing an
|
|
error message, the offending input line is read from the input file
|
|
directly (which still contains tabs).
|
|
|
|
The solution is to simply drop said tab conversion from scanner.l.
|
|
|
|
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
(cherry picked from commit 7f8d28105c8caeae7af5bccbe4a6d79f1f73e205)
|
|
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
|
---
|
|
src/scanner.l | 16 +---------------
|
|
1 file changed, 1 insertion(+), 15 deletions(-)
|
|
|
|
diff --git a/src/scanner.l b/src/scanner.l
|
|
index 416bd27af1427..3551fbf80df6e 100644
|
|
--- a/src/scanner.l
|
|
+++ b/src/scanner.l
|
|
@@ -613,21 +613,7 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr})
|
|
return NEWLINE;
|
|
}
|
|
|
|
-{tab} {
|
|
- /*
|
|
- * Compensate difference between visible length
|
|
- * and real length.
|
|
- */
|
|
- struct parser_state *state = yyget_extra(yyscanner);
|
|
- unsigned int diff;
|
|
-
|
|
- diff = TABSIZE - strlen("\t");
|
|
- diff -= (state->indesc->column -
|
|
- strlen("\t") - 1) % TABSIZE;
|
|
-
|
|
- update_pos(state, yylloc, diff);
|
|
- }
|
|
-
|
|
+{tab}+
|
|
{space}+
|
|
{comment}
|
|
|
|
--
|
|
2.21.0
|
|
|