CON: Add "defstate" token which functions identically as in M32script: synonymous with CON's "state" only at top-level (when defining a state). Useful for syntax highlighting.

git-svn-id: https://svn.eduke32.com/eduke32@5353 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-09-24 06:31:44 +00:00
parent a557eedf7e
commit f69f1e73df
4 changed files with 16 additions and 0 deletions

View file

@ -101,6 +101,7 @@ static struct { uint32_t keyw; uint32_t date; } g_keywdate[] =
{ CON_DEFINEVOLUMEFLAGS, 20150222 },
{ CON_RESETPLAYERFLAGS, 20150303 },
{ CON_APPENDEVENT, 20150325 },
{ CON_DEFSTATE, 20150923 },
};
#endif
@ -566,6 +567,7 @@ const char *keyw[] =
"definevolumeflags", // 380
"resetplayerflags", // 381
"appendevent", // 382
"defstate", // 383
"<null>"
};
#endif
@ -2783,9 +2785,18 @@ static int32_t C_ParseCommand(int32_t loop)
case -1:
case -2:
return 1; //End
case CON_DEFSTATE:
if (EDUKE32_PREDICT_FALSE(g_processingState || g_parsingActorPtr))
{
C_ReportError(ERROR_FOUNDWITHIN);
g_numCompilerErrors++;
continue;
}
goto DO_DEFSTATE;
case CON_STATE:
if (g_parsingActorPtr == NULL && g_processingState == 0)
{
DO_DEFSTATE:
C_GetNextLabelName();
g_scriptPtr--;
labelcode[g_numLabels] = g_scriptPtr-script;

View file

@ -1045,6 +1045,7 @@ enum ScriptKeywords_t
CON_DEFINEVOLUMEFLAGS, // 380
CON_RESETPLAYERFLAGS, // 381
CON_APPENDEVENT, // 382
CON_DEFSTATE, // 383
CON_END
};
// KEEPINSYNC with the keyword list in lunatic/con_lang.lua

View file

@ -1277,6 +1277,7 @@ lpeg.P(false) +
"displayrand" +
"digitalnumberz" +
"digitalnumber" +
"defstate" +
"definevolumename" +
"definevolumeflags" +
"definesound" +

View file

@ -3437,6 +3437,9 @@ local Cblock = {
state = POS() * sp1 * (lpeg.Cmt(tok.identifier, on.state_begin_Cmt))
* sp1 * stmt_list_or_eps * tok.state_ends
/ on.state_end,
defstate = POS() * sp1 * (lpeg.Cmt(tok.identifier, on.state_begin_Cmt))
* sp1 * stmt_list_or_eps * tok.state_ends
/ on.state_end,
}
for cmdname, cmdpat in pairs(Cblock) do