Skip to content

Commit 5aab3f8

Browse files
authored
Task/tsp 836 include Lua 5.0 library definitions (#11)
include Lua 5.0 library definitions
1 parent 369e2c2 commit 5aab3f8

File tree

10 files changed

+1632
-2
lines changed

10 files changed

+1632
-2
lines changed

Json_parser/Program.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Collections.Generic;
44
using System.IO;
55
using System.Linq;
6+
using System.Text.RegularExpressions;
67
//using static jsonToLuaParser.Utility;
78
using static jsonToLuaParser.Utility;
89
namespace jsonToLuaParser
@@ -33,7 +34,11 @@ static void Main(string[] args)
3334
{
3435
parse_commands_josn(base_lib_dir, file);
3536
}
36-
37+
38+
// Copy tsp-lua-5.0 definations
39+
Directory.CreateDirectory(Path.Combine(base_lib_dir, "tsp-lua-5.0"));
40+
var lua_definations_file_path = Path.Combine(base_lib_dir, "tsp-lua-5.0");
41+
CopyStaticFiles("tsp-lua-5.0", lua_definations_file_path);
3742
}
3843

3944
static void parse_commands_josn(string base_lib_dir, string json_file_path)
@@ -188,7 +193,8 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path)
188193
}
189194

190195
var nodeTable_str = @"{" + string.Join(",\n ", nodeTable) + "\n}";
191-
var nodeTableDetails = $"---@meta\n\n---@class model{file_name}\nmodel{file_name} = {nodeTable_str}" +
196+
var node_class_name = Regex.Replace(file_name, @"[^a-zA-Z0-9_]", "");
197+
var nodeTableDetails = $"---@meta\n\n---@class model{node_class_name}\nmodel{node_class_name} = {nodeTable_str}" +
192198
$"\n--#region node details\n--#endregion";
193199

194200
Directory.CreateDirectory(Path.Combine(base_lib_dir, model));

0 commit comments

Comments
 (0)