- fixed script line numbers after multi-line raw string literal

https://forum.zdoom.org/viewtopic.php?t=63210
This commit is contained in:
alexey.lysiuk 2019-01-11 17:44:45 +02:00 committed by Christoph Oelckers
parent f7489976ec
commit 7c0633a3e9

View file

@ -93,7 +93,7 @@ std2:
("#region"|"#endregion") (any\"\n")* "\n" ("#region"|"#endregion") (any\"\n")* "\n"
{ goto newline; } /* Region blocks [mxd] */ { goto newline; } /* Region blocks [mxd] */
(["](([\\]["])|[^"])*["]) { RET(TK_StringConst); } (["](([\\]["])|[^"])*["]) { goto string_const; }
'stop' { RET(TK_Stop); } 'stop' { RET(TK_Stop); }
'wait' { RET(TK_Wait); } 'wait' { RET(TK_Wait); }
'fail' { RET(TK_Fail); } 'fail' { RET(TK_Fail); }
@ -234,7 +234,7 @@ std2:
{ RET(TK_FloatConst); } { RET(TK_FloatConst); }
(["](([\\]["])|[^"])*["]) (["](([\\]["])|[^"])*["])
{ RET(TK_StringConst); } { goto string_const; }
(['] (any\[\n'])* [']) (['] (any\[\n'])* ['])
{ RET(TK_NameConst); } { RET(TK_NameConst); }
@ -465,6 +465,13 @@ normal_token:
return_val = true; return_val = true;
goto end; goto end;
string_const:
for (const char *c = tok; c < YYCURSOR; ++c)
{
if (*c == '\n') ++Line;
}
RET(TK_StringConst);
string: string:
if (YYLIMIT != ScriptEndPtr) if (YYLIMIT != ScriptEndPtr)
{ {