From 7c0633a3e97551472ad3ef87fca505e577ad4264 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 11 Jan 2019 17:44:45 +0200 Subject: [PATCH] - fixed script line numbers after multi-line raw string literal https://forum.zdoom.org/viewtopic.php?t=63210 --- src/sc_man_scanner.re | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/sc_man_scanner.re b/src/sc_man_scanner.re index c4fcf6399..9d0171e12 100644 --- a/src/sc_man_scanner.re +++ b/src/sc_man_scanner.re @@ -93,7 +93,7 @@ std2: ("#region"|"#endregion") (any\"\n")* "\n" { goto newline; } /* Region blocks [mxd] */ - (["](([\\]["])|[^"])*["]) { RET(TK_StringConst); } + (["](([\\]["])|[^"])*["]) { goto string_const; } 'stop' { RET(TK_Stop); } 'wait' { RET(TK_Wait); } 'fail' { RET(TK_Fail); } @@ -234,7 +234,7 @@ std2: { RET(TK_FloatConst); } (["](([\\]["])|[^"])*["]) - { RET(TK_StringConst); } + { goto string_const; } (['] (any\[\n'])* [']) { RET(TK_NameConst); } @@ -465,6 +465,13 @@ normal_token: return_val = true; goto end; +string_const: + for (const char *c = tok; c < YYCURSOR; ++c) + { + if (*c == '\n') ++Line; + } + RET(TK_StringConst); + string: if (YYLIMIT != ScriptEndPtr) {