diff options
author | Oleksandr Koval <oleksandr.koval.dev@gmail.com> | 2020-09-09 12:49:35 (GMT) |
---|---|---|
committer | Oleksandr Koval <oleksandr.koval.dev@gmail.com> | 2020-09-09 12:49:35 (GMT) |
commit | 62d7acc6d4f2e4563b5a71d6e5c90352bf732c79 (patch) | |
tree | 8da5b452aeb392d31f817a4b1655f671d7534d26 /Source/LexerParser/cmCommandArgumentLexer.in.l | |
parent | 9a0a5f84208f652d3ce84e141adf7e9b304574cb (diff) | |
download | CMake-62d7acc6d4f2e4563b5a71d6e5c90352bf732c79.zip CMake-62d7acc6d4f2e4563b5a71d6e5c90352bf732c79.tar.gz CMake-62d7acc6d4f2e4563b5a71d6e5c90352bf732c79.tar.bz2 |
cmCommandArgumentParserHelper: rework input handling
Old implementation uses involved Flex input management technique that
requires usage of obsolete YY_INPUT macro. This causes a lot of useless
allocations and byte-by-byte scanning. New implementation avoids those
hacks, it uses yy_scan_string() API to setup Flex input. Also it fixes
reporting of syntax error position and corresponding tests.
Diffstat (limited to 'Source/LexerParser/cmCommandArgumentLexer.in.l')
-rw-r--r-- | Source/LexerParser/cmCommandArgumentLexer.in.l | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/Source/LexerParser/cmCommandArgumentLexer.in.l b/Source/LexerParser/cmCommandArgumentLexer.in.l index 010d54b..8ad2335 100644 --- a/Source/LexerParser/cmCommandArgumentLexer.in.l +++ b/Source/LexerParser/cmCommandArgumentLexer.in.l @@ -7,7 +7,7 @@ This file must be translated to C++ and modified to build everywhere. Run flex >= 2.6 like this: - flex --nounistd -DFLEXINT_H --noline --header-file=cmCommandArgumentLexer.h -ocmCommandArgumentLexer.cxx cmCommandArgumentLexer.in.l + flex --nounistd --never-interactive --batch -DFLEXINT_H --noline --header-file=cmCommandArgumentLexer.h -ocmCommandArgumentLexer.cxx cmCommandArgumentLexer.in.l Modify cmCommandArgumentLexer.cxx: - remove trailing whitespace: sed -i 's/\s*$//' cmCommandArgumentLexer.h cmCommandArgumentLexer.cxx @@ -22,10 +22,7 @@ Modify cmCommandArgumentLexer.cxx: #include "cmCommandArgumentParserHelper.h" -/* Replace the lexer input function. */ -#undef YY_INPUT -#define YY_INPUT(buf, result, max_size) \ - do { result = yyextra->LexInput(buf, max_size); } while (0) +#define YY_USER_ACTION yyextra->UpdateInputPosition(yyleng); /* Include the set of tokens from the parser. */ #include "cmCommandArgumentParserTokens.h" |