mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 12:50:52 +00:00
Added: primitive support for ZScript in the script editor (all classes in the current file are listed)
This commit is contained in:
parent
1382d144fe
commit
7f2f51d48d
7 changed files with 83 additions and 11 deletions
25
Build/Scripting/ZDoom_ZSCRIPT.cfg
Executable file
25
Build/Scripting/ZDoom_ZSCRIPT.cfg
Executable file
|
@ -0,0 +1,25 @@
|
|||
/*******************************************************************\
|
||||
GZDoom Builder Script highlighting definitions for ZSCRIPT
|
||||
\*******************************************************************/
|
||||
|
||||
// Editor settings
|
||||
description = "ZDoom ZSCRIPT";
|
||||
codepage = 0;
|
||||
extensions = "txt";
|
||||
casesensitive = false;
|
||||
terminator = ";";
|
||||
insertcase = 1; // 0=Normal, 1=Lowercase, 2=Uppercase
|
||||
lexer = 35; // CPP-style, case-insensitive
|
||||
keywordhelp = "http://zdoom.org/wiki/ZScript";
|
||||
scripttype = "ZSCRIPT";
|
||||
|
||||
// todo
|
||||
keywords
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
constants
|
||||
{
|
||||
|
||||
}
|
|
@ -141,6 +141,7 @@
|
|||
<Compile Include="Data\FileImage.cs" />
|
||||
<Compile Include="Data\FlatImage.cs" />
|
||||
<Compile Include="Data\ImageLoadState.cs" />
|
||||
<Compile Include="Data\Scripting\ZScriptScriptHandler.cs" />
|
||||
<Compile Include="Data\UnknownImage.cs" />
|
||||
<Compile Include="Data\PatchNames.cs" />
|
||||
<Compile Include="Data\PK3Reader.cs" />
|
||||
|
@ -523,6 +524,7 @@
|
|||
<Compile Include="ZDoom\DecorateActorStructure.cs" />
|
||||
<Compile Include="ZDoom\DecorateStateGoto.cs" />
|
||||
<Compile Include="ZDoom\DecorateStateStructure.cs" />
|
||||
<Compile Include="ZDoom\Scripting\ZScriptParserSE.cs" />
|
||||
<Compile Include="ZDoom\ZScriptActorStructure.cs" />
|
||||
<Compile Include="ZDoom\ZScriptParser.cs" />
|
||||
<Compile Include="ZDoom\ZScriptStateGoto.cs" />
|
||||
|
|
|
@ -212,7 +212,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
terminator = cfg.ReadSetting("terminator", "");
|
||||
extrawordchars = cfg.ReadSetting("extrawordchars", ""); //mxd
|
||||
|
||||
//mxd. Get script type...
|
||||
//mxd. Get script type...
|
||||
string scripttypestr = cfg.ReadSetting("scripttype", string.Empty);
|
||||
if(!string.IsNullOrEmpty(scripttypestr))
|
||||
{
|
||||
|
@ -233,8 +233,8 @@ namespace CodeImp.DoomBuilder.Config
|
|||
scripttype = ScriptType.UNKNOWN;
|
||||
}
|
||||
|
||||
//mxd. Make braces array
|
||||
if(!string.IsNullOrEmpty(functionopen)) braces.Add(functionopen[0]);
|
||||
//mxd. Make braces array
|
||||
if (!string.IsNullOrEmpty(functionopen)) braces.Add(functionopen[0]);
|
||||
if(!string.IsNullOrEmpty(functionclose)) braces.Add(functionclose[0]);
|
||||
if(!string.IsNullOrEmpty(codeblockopen)) braces.Add(codeblockopen[0]);
|
||||
if(!string.IsNullOrEmpty(codeblockclose)) braces.Add(codeblockclose[0]);
|
||||
|
|
|
@ -30,6 +30,6 @@ using CodeImp.DoomBuilder;
|
|||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.3.0.2872")]
|
||||
[assembly: AssemblyVersion("2.3.0.2873")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
||||
[assembly: AssemblyHash("0d43a7b")]
|
||||
[assembly: AssemblyHash("1382d14")]
|
||||
|
|
|
@ -34,13 +34,13 @@ namespace CodeImp.DoomBuilder.ZDoom.Scripting
|
|||
// Continue until at the end of the stream
|
||||
while(SkipWhitespace(true))
|
||||
{
|
||||
string token = ReadToken();
|
||||
int startpos = (int)datastream.Position;
|
||||
string token = ReadToken();
|
||||
if(string.IsNullOrEmpty(token) || token.ToUpperInvariant() != "ACTOR") continue;
|
||||
|
||||
SkipWhitespace(true);
|
||||
int startpos = (int)datastream.Position;
|
||||
|
||||
List<string> definition = new List<string>();
|
||||
definition.Add(token); // actor ... ..., not just class name
|
||||
|
||||
do
|
||||
{
|
||||
|
|
|
@ -35,6 +35,7 @@ namespace CodeImp.DoomBuilder.ZDoom.Scripting
|
|||
while(SkipWhitespace(true))
|
||||
{
|
||||
string token = ReadToken();
|
||||
long cpos = datastream.Position;
|
||||
|
||||
if(!string.IsNullOrEmpty(token))
|
||||
{
|
||||
|
@ -70,7 +71,7 @@ namespace CodeImp.DoomBuilder.ZDoom.Scripting
|
|||
}
|
||||
|
||||
}
|
||||
else if(token == "ACTOR")
|
||||
else if(token == "ACTOR") // [ZZ] note: by the looks of it, this doesn't handle the case when we write actor with DoomEdNum.
|
||||
{
|
||||
SkipWhitespace(true);
|
||||
ReadToken(); //should be actor name
|
||||
|
@ -78,7 +79,8 @@ namespace CodeImp.DoomBuilder.ZDoom.Scripting
|
|||
SkipWhitespace(true);
|
||||
token = ReadToken();
|
||||
|
||||
if(token == ":" || token == "{" || token == "REPLACES")
|
||||
// [ZZ] note: original code compared token to REPLACES without doing ToUpper
|
||||
if(token == ":" || token == "{" || (token != null && token.ToUpperInvariant() == "REPLACES"))
|
||||
{
|
||||
scripttype = ScriptType.DECORATE;
|
||||
return true;
|
||||
|
@ -87,13 +89,56 @@ namespace CodeImp.DoomBuilder.ZDoom.Scripting
|
|||
SkipWhitespace(true);
|
||||
token = ReadToken(); //should be actor name
|
||||
|
||||
// [ZZ]
|
||||
if (token != "{") // actor bla : bla2 10666 {
|
||||
{
|
||||
SkipWhitespace(true);
|
||||
token = ReadToken();
|
||||
}
|
||||
|
||||
if(token == "{")
|
||||
{
|
||||
scripttype = ScriptType.DECORATE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if(token == "CLASS" || token == "STRUCT" || token == "ENUM" || token == "EXTEND")
|
||||
{
|
||||
if (token == "EXTEND")
|
||||
{
|
||||
SkipWhitespace(true);
|
||||
token = ReadToken();
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
token = token.ToUpperInvariant();
|
||||
}
|
||||
|
||||
string otoken = token; // original token
|
||||
|
||||
SkipWhitespace(true);
|
||||
ReadToken(); //should be actor name
|
||||
|
||||
SkipWhitespace(true);
|
||||
token = ReadToken();
|
||||
|
||||
if ((otoken != "ENUM" && token == ":") || token == "{" || (otoken == "CLASS" && (token != null && token.ToUpperInvariant() == "REPLACES")))
|
||||
{
|
||||
scripttype = ScriptType.ZSCRIPT;
|
||||
return true;
|
||||
}
|
||||
|
||||
SkipWhitespace(true);
|
||||
token = ReadToken(); //should be actor name
|
||||
|
||||
if (token == "{")
|
||||
{
|
||||
scripttype = ScriptType.ZSCRIPT;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
datastream.Position = cpos; // [ZZ] read next token, not whatever is left after possibly unsuccessful parsing.
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -29,5 +29,5 @@ using System.Resources;
|
|||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.3.0.2872")]
|
||||
[assembly: AssemblyVersion("2.3.0.2873")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
||||
|
|
Loading…
Reference in a new issue