From c36a8ab899a5c046caa6b9c56489dd5a812c3b6b Mon Sep 17 00:00:00 2001 From: rajeev Date: Fri, 20 Sep 2024 07:15:23 +0530 Subject: [PATCH 1/7] updating version and chnagelog file --- CHANGELOG.md | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4312456..cc83e87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,12 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how Fixed -- for any bug fixes. Security -- in case of vulnerabilities. --> +## [0.18.0] + +### Added +- Added language feature support for 2651A and 2657A models +- **tsp-toolkit-webhelp:** Added webhelp documents for 2651A and 2657A models + ## [0.16.0] ### Fixed diff --git a/package.json b/package.json index ae84ef7..2e9b887 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tektronix/keithley_instrument_libraries", - "version": "0.16.0", + "version": "0.18.0", "description": "", "main": "index.js", "scripts": { From 12bf1e5478b1f7b86ce79f7004ee66f8314f3dae Mon Sep 17 00:00:00 2001 From: rajeev Date: Fri, 20 Sep 2024 10:21:36 +0530 Subject: [PATCH 2/7] Adding support for 2601B-PULSE --- CHANGELOG.md | 4 +-- Configuration.py | 23 ++++++++++---- .../2601B-PULSE/digioTriggerModes.lua | 20 +++++++++++++ .../2601B-PULSE/statsVartype.lua | 30 +++++++++++++++++++ .../2601B-PULSE/tsplinkTriggerModes.lua | 20 +++++++++++++ main.py | 18 ++++++----- 6 files changed, 100 insertions(+), 15 deletions(-) create mode 100644 Json_parser/StaticLuaDefinations/2601B-PULSE/digioTriggerModes.lua create mode 100644 Json_parser/StaticLuaDefinations/2601B-PULSE/statsVartype.lua create mode 100644 Json_parser/StaticLuaDefinations/2601B-PULSE/tsplinkTriggerModes.lua diff --git a/CHANGELOG.md b/CHANGELOG.md index cc83e87..a793a9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,8 +18,8 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how ## [0.18.0] ### Added -- Added language feature support for 2651A and 2657A models -- **tsp-toolkit-webhelp:** Added webhelp documents for 2651A and 2657A models +- Added language feature support for 2651A, 2657A and 2601B-PULSE models +- **tsp-toolkit-webhelp:** Added webhelp documents for 2651A, 2657A and 2601B-PULSE models ## [0.16.0] diff --git a/Configuration.py b/Configuration.py index 856fca2..b4baf7f 100644 --- a/Configuration.py +++ b/Configuration.py @@ -21,13 +21,22 @@ class Confiurations: "2600B", "2651A", "2657A", + "2601B-PULSE" ] - MODEL_2650A_CHANNELS= {"2651A":["a"], - "2657A":["a"], - } + MODEL_2600B_MODELS = [ + "2601B", + "2611B", + "2635B", + "2604B", + "2614B", + "2602B", + "2612B", + "2634B", + "2636B" + ] - MODEL_2600B_CHANNELS= {"2601B":["a"], + MODEL_CHANNELS= {"2601B":["a"], "2611B":["a"], "2635B": ["a"], "2604B": ["a", "b"], @@ -35,5 +44,9 @@ class Confiurations: "2602B": ["a", "b"], "2612B": ["a", "b"], "2634B": ["a", "b"], - "2636B": ["a", "b"] + "2636B": ["a", "b"], + + "2651A":["a"], + "2657A":["a"], + "2601B-PULSE": ["a"] } \ No newline at end of file diff --git a/Json_parser/StaticLuaDefinations/2601B-PULSE/digioTriggerModes.lua b/Json_parser/StaticLuaDefinations/2601B-PULSE/digioTriggerModes.lua new file mode 100644 index 0000000..eacac84 --- /dev/null +++ b/Json_parser/StaticLuaDefinations/2601B-PULSE/digioTriggerModes.lua @@ -0,0 +1,20 @@ +digio.TRIG_BYPASS = nil +digio.TRIG_FALLING = nil +digio.TRIG_RISING = nil +digio.TRIG_EITHER = nil +digio.TRIG_SYNCHRONOUSA = nil +digio.TRIG_SYNCHRONOUS = nil +digio.TRIG_SYNCHRONOUSM = nil +digio.TRIG_RISINGA = nil +digio.TRIG_RISINGM = nil + +---@alias digioTriggerModes +---| `digio.TRIG_BYPASS` +---| `digio.TRIG_FALLING` +---| `digio.TRIG_RISING` +---| `digio.TRIG_EITHER` +---| `digio.TRIG_SYNCHRONOUSA` +---| `digio.TRIG_SYNCHRONOUS` +---| `digio.TRIG_SYNCHRONOUSM` +---| `digio.TRIG_RISINGA` +---| `digio.TRIG_RISINGM` \ No newline at end of file diff --git a/Json_parser/StaticLuaDefinations/2601B-PULSE/statsVartype.lua b/Json_parser/StaticLuaDefinations/2601B-PULSE/statsVartype.lua new file mode 100644 index 0000000..77d2c38 --- /dev/null +++ b/Json_parser/StaticLuaDefinations/2601B-PULSE/statsVartype.lua @@ -0,0 +1,30 @@ +---@meta + +---@class statsVar +---@field min min +---@field mean number +---@field stddev number +---@field n number +---@field max max + +---@class min +---@field measurefunction string +---@field measurerange number +---@field reading number +---@field sourcefunction string +---@field sourceoutputstate string +---@field sourcerange number +---@field sourcevalue number +---@field status number +---@field timestamp number + +---@class max +---@field measurefunction string +---@field measurerange number +---@field reading number +---@field sourcefunction string +---@field sourceoutputstate string +---@field sourcerange number +---@field sourcevalue number +---@field status number +---@field timestamp number diff --git a/Json_parser/StaticLuaDefinations/2601B-PULSE/tsplinkTriggerModes.lua b/Json_parser/StaticLuaDefinations/2601B-PULSE/tsplinkTriggerModes.lua new file mode 100644 index 0000000..54f05d6 --- /dev/null +++ b/Json_parser/StaticLuaDefinations/2601B-PULSE/tsplinkTriggerModes.lua @@ -0,0 +1,20 @@ +tsplink.TRIG_BYPASS = nil +tsplink.TRIG_FALLING = nil +tsplink.TRIG_RISING = nil +tsplink.TRIG_EITHER = nil +tsplink.TRIG_SYNCHRONOUSA = nil +tsplink.TRIG_SYNCHRONOUS = nil +tsplink.TRIG_SYNCHRONOUSM = nil +tsplink.TRIG_RISINGA = nil +tsplink.TRIG_RISINGM = nil + +---@alias tsplinkTriggerModes +---| `tsplink.TRIG_BYPASS` +---| `tsplink.TRIG_FALLING` +---| `tsplink.TRIG_RISING` +---| `tsplink.TRIG_EITHER` +---| `tsplink.TRIG_SYNCHRONOUSA` +---| `tsplink.TRIG_SYNCHRONOUS` +---| `tsplink.TRIG_SYNCHRONOUSM` +---| `tsplink.TRIG_RISINGA` +---| `tsplink.TRIG_RISINGM` \ No newline at end of file diff --git a/main.py b/main.py index 4fd1ff7..25a6468 100644 --- a/main.py +++ b/main.py @@ -24,17 +24,13 @@ def parse_web_help_files(webHelpFoldersDir): if dir in Confiurations.SUPPORTED_MODELS: Confiurations.HELP_FILE_FOLDER_PATH = folder if str(dir).find("2600B")!= -1: - for model in Confiurations.MODEL_2600B_CHANNELS.keys(): + for model in Confiurations.MODEL_2600B_MODELS: Confiurations.MODEL_NUMBER = model - Confiurations.CHANNELS = Confiurations.MODEL_2600B_CHANNELS.get(model) + Confiurations.CHANNELS = Confiurations.MODEL_CHANNELS.get(model) parse() - - elif str(dir).find("2651A")!= -1 or str(dir).find("2657A")!= -1: - Confiurations.CHANNELS = Confiurations.MODEL_2650A_CHANNELS.get(dir) - Confiurations.MODEL_NUMBER = dir - parse() - + else: + Confiurations.CHANNELS = Confiurations.MODEL_CHANNELS.get(dir) Confiurations.MODEL_NUMBER = dir parse() else: @@ -58,6 +54,12 @@ def parse(): except: command= "" + # for 2601B-PULSE the commands are already having smua. + # Making this to similar to other 2600 models + if Confiurations.MODEL_NUMBER == "2601B-PULSE" and command.startswith('smua.'): + command = command.replace("smua", "smuX") + + if command == "*CLS" or command == "*ESR?" or command == "*OPC" or command == "*OPC?" or command == "*ESE" or command == "*ESE?" or command == "*IDN?" or command == "*LANG?" or command == "*LANG" or command == "*RST" or command == "*SRE?" or command == "*SRE" or command == "*STB?" or command == "*TRG" or command == "*TST?" or command == "*WAI": continue From a5fe264d99111de06963d35505bdf1e9b29c76b9 Mon Sep 17 00:00:00 2001 From: rajeev Date: Fri, 20 Sep 2024 10:28:36 +0530 Subject: [PATCH 3/7] adding one more missing static file --- .../2601B-PULSE/lanTriggerMode.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Json_parser/StaticLuaDefinations/2601B-PULSE/lanTriggerMode.lua diff --git a/Json_parser/StaticLuaDefinations/2601B-PULSE/lanTriggerMode.lua b/Json_parser/StaticLuaDefinations/2601B-PULSE/lanTriggerMode.lua new file mode 100644 index 0000000..be4eb8c --- /dev/null +++ b/Json_parser/StaticLuaDefinations/2601B-PULSE/lanTriggerMode.lua @@ -0,0 +1,18 @@ +lan.TRIG_EITHER = nil +lan.TRIG_FALLING = nil +lan.TRIG_RISING = nil +lan.TRIG_RISINGA = nil +lan.TRIG_RISINGM = nil +lan.TRIG_SYNCHRONOUS = nil +lan.TRIG_SYNCHRONOUSA = nil +lan.TRIG_SYNCHRONOUSM = nil + +---@alias lanTriggerMode +---| `lan.TRIG_EITHER` +---| `lan.TRIG_FALLING` +---| `lan.TRIG_RISING` +---| `lan.TRIG_RISINGA` +---| `lan.TRIG_RISINGM` +---| `lan.TRIG_SYNCHRONOUS` +---| `lan.TRIG_SYNCHRONOUSA` +---| `lan.TRIG_SYNCHRONOUSM` \ No newline at end of file From 0b4496282d087de7808cc9f49415b80121b47f54 Mon Sep 17 00:00:00 2001 From: rajeev Date: Mon, 23 Sep 2024 20:52:53 +0530 Subject: [PATCH 4/7] fixing any type issue for few commands fixing command help link was broken for 2600B models --- Json_parser/Utility.cs | 15 +++++++- .../26xx-command_param_data_type.txt | 34 ++++++++++++++++++- main.py | 2 +- package-lock.json | 12 +++---- package.json | 2 +- 5 files changed, 55 insertions(+), 10 deletions(-) diff --git a/Json_parser/Utility.cs b/Json_parser/Utility.cs index 105a4e4..bd70c0c 100644 --- a/Json_parser/Utility.cs +++ b/Json_parser/Utility.cs @@ -9,6 +9,19 @@ namespace jsonToLuaParser class Utility { + private static readonly List MODEL_2600B_MODELS = new List + { + "2601B", + "2611B", + "2635B", + "2604B", + "2614B", + "2602B", + "2612B", + "2634B", + "2636B" + }; + public class Example_Info { public string example { get; set; } @@ -616,7 +629,7 @@ public static string get_command_header(CommandInfo cmd, string file_name) var command_header = "\n---**" + cmd.name + "**\n" + "----"; - var helpFilePath = $@"{file_name}/{cmd.webhelpfile}"; + var helpFilePath = $@"{(MODEL_2600B_MODELS.Contains(file_name)?"2600B": file_name )}/{cmd.webhelpfile}"; command_header += "\n--- **" + cmd.description + "**\n---\n" + "--- *Type:*  " + cmd.command_type + "\n---\n" + "--- *Details:*
\n--- " + cmd.details + "\n---\n" diff --git a/ParserGeneric/26xx-command_param_data_type.txt b/ParserGeneric/26xx-command_param_data_type.txt index 180336f..b3703d5 100644 --- a/ParserGeneric/26xx-command_param_data_type.txt +++ b/ParserGeneric/26xx-command_param_data_type.txt @@ -251,6 +251,7 @@ bits: number setup.poweron id: integer +N: integer tsplink.writeprotect mask: number @@ -331,6 +332,9 @@ sourceRangeLow: number smuX.source.offlimitY sourceLimit: number +smuX.source.protectv +limit: number + smuX.source.rangeY rangeValue: number @@ -868,6 +872,7 @@ model: string localnode.password password: string +passWord: string localnode.prompts prompting: localnodepromptsprompting @@ -2729,12 +2734,33 @@ adjustDate: number smuX.cal.date calDate: number -smua.cal.due +smuX.cal.due calDue: number smuX.cal.unlock() password: string +smuX.interlock.enable +interlockState: interlockState + +smuX.pulser.enable +enable: pulserState + +smuX.pulser.protect.sensev +level: number + +smuX.pulser.protect.tripped +tripped: boolean + +smuX.pulser.protect.sourcev +level: number + +smuX.pulser.measure.aperture +aperture: number + +smuX.pulser.measure.delay +delay: number + smuX.contact.calibratehi() cp1Measured: number cp1Reference: number @@ -2761,6 +2787,9 @@ bufferSize: integer smuX.nvbufferY bufferVar: bufferVar +smuX.measure.adc +adc: adcConverter + smuX.measure.calibrateY() range: number cp1Measured: number @@ -2834,6 +2863,9 @@ rbuffer: bufferVar ibuffer: bufferVar vbuffer: bufferVar +smuX.trigger.source.pulsewidth +pulsewidth: number + smuX.trigger.source.linearY() startValue: number endValue: number diff --git a/main.py b/main.py index 25a6468..210267b 100644 --- a/main.py +++ b/main.py @@ -56,7 +56,7 @@ def parse(): # for 2601B-PULSE the commands are already having smua. # Making this to similar to other 2600 models - if Confiurations.MODEL_NUMBER == "2601B-PULSE" and command.startswith('smua.'): + if Confiurations.MODEL_NUMBER == "2601B-PULSE" and command.find('smua.')!=-1: command = command.replace("smua", "smuX") diff --git a/package-lock.json b/package-lock.json index eedfc89..1883ce6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,19 +1,19 @@ { "name": "@tektronix/keithley_instrument_libraries", - "version": "0.16.0", + "version": "0.18.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@tektronix/keithley_instrument_libraries", - "version": "0.16.0", + "version": "0.18.1", "license": "ISC", "dependencies": { "node-fetch": "^2.7.0" }, "devDependencies": { "@octokit/rest": "20.1.1", - "@tektronix/web-help-documents": "0.15.3", + "@tektronix/web-help-documents": "0.18.0", "@types/node-fetch": "^2.6.11", "axios": "1.7.4", "decompress": "^4.2.1" @@ -175,9 +175,9 @@ } }, "node_modules/@tektronix/web-help-documents": { - "version": "0.15.3", - "resolved": "https://npm.pkg.github.com/download/@tektronix/web-help-documents/0.15.3/40050d721ba4c5abbd9605fd9bd0dddf3b0da886", - "integrity": "sha512-2i32yLk6Gh6DgRHtJYAyQPvnlOghNiS549fDk0CPUqY/pvCt1BbWPyp9Cr1D43I7BPPFq+7o8kRHtjMRu25LmQ==", + "version": "0.18.0", + "resolved": "https://npm.pkg.github.com/download/@tektronix/web-help-documents/0.18.0/3f155899227d34e7eccb1bf3183536cd2dc292e5", + "integrity": "sha512-ZHcoF8ZgaQhhJEv5qyYdghjah84Ijf/wNbBahxzyw6oS5IHZQVQBPBXQckKq4m0IX/2NUD8qAiaczCXAUTZlJA==", "dev": true }, "node_modules/@types/node": { diff --git a/package.json b/package.json index 2e9b887..e7e693c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tektronix/keithley_instrument_libraries", - "version": "0.18.0", + "version": "0.18.1", "description": "", "main": "index.js", "scripts": { From 80ab5f77c9795af528dcbe1444b607add554814e Mon Sep 17 00:00:00 2001 From: rajeev Date: Mon, 23 Sep 2024 21:03:52 +0530 Subject: [PATCH 5/7] Updating changelog file --- CHANGELOG.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a793a9b..196d2f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,13 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how Fixed -- for any bug fixes. Security -- in case of vulnerabilities. --> + +## [0.18.1] + +### Fixed +- Fixed any type issue for few commands +- Fixing command help link is broken for 2600B models + ## [0.18.0] ### Added @@ -37,7 +44,9 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how - workflow has been added for generaing json artifacts. -[Unreleased]: https://github.com/tektronix/tsp-toolkit-webhelp-to-json/compare/v0.16.0...HEAD +[Unreleased]: https://github.com/tektronix/tsp-toolkit-webhelp-to-json/compare/v0.18.1...HEAD +[0.18.1]: https://github.com/tektronix/tsp-toolkit-webhelp-to-json/releases/tag/v0.18.1 +[0.18.0]: https://github.com/tektronix/tsp-toolkit-webhelp-to-json/releases/tag/v0.18.0 [0.16.0]: https://github.com/tektronix/tsp-toolkit-webhelp-to-json/releases/tag/v0.16.0 [0.15.3]: https://github.com/tektronix/tsp-toolkit-webhelp-to-json/releases/tag/v0.15.3 [0.15.1]: https://github.com/tektronix/tsp-toolkit-webhelp-to-json/releases/tag/v0.15.1 From 13cd92c7807f128d7d14866b64a67dcba406bddf Mon Sep 17 00:00:00 2001 From: rajeev Date: Thu, 3 Oct 2024 16:18:25 +0530 Subject: [PATCH 6/7] include lua 5.0 definations --- Json_parser/Program.cs | 6 +- .../tsp-lua-5.0/basic.lua | 386 ++++++++++++++++++ .../tsp-lua-5.0/builtin.lua | 16 + .../tsp-lua-5.0/coroutine.lua | 64 +++ .../tsp-lua-5.0/debug.lua | 149 +++++++ .../StaticLuaDefinations/tsp-lua-5.0/io.lua | 229 +++++++++++ .../StaticLuaDefinations/tsp-lua-5.0/math.lua | 282 +++++++++++++ .../StaticLuaDefinations/tsp-lua-5.0/os.lua | 239 +++++++++++ .../tsp-lua-5.0/string.lua | 157 +++++++ .../tsp-lua-5.0/table.lua | 102 +++++ 10 files changed, 1629 insertions(+), 1 deletion(-) create mode 100644 Json_parser/StaticLuaDefinations/tsp-lua-5.0/basic.lua create mode 100644 Json_parser/StaticLuaDefinations/tsp-lua-5.0/builtin.lua create mode 100644 Json_parser/StaticLuaDefinations/tsp-lua-5.0/coroutine.lua create mode 100644 Json_parser/StaticLuaDefinations/tsp-lua-5.0/debug.lua create mode 100644 Json_parser/StaticLuaDefinations/tsp-lua-5.0/io.lua create mode 100644 Json_parser/StaticLuaDefinations/tsp-lua-5.0/math.lua create mode 100644 Json_parser/StaticLuaDefinations/tsp-lua-5.0/os.lua create mode 100644 Json_parser/StaticLuaDefinations/tsp-lua-5.0/string.lua create mode 100644 Json_parser/StaticLuaDefinations/tsp-lua-5.0/table.lua diff --git a/Json_parser/Program.cs b/Json_parser/Program.cs index ed0aa4b..5238f66 100644 --- a/Json_parser/Program.cs +++ b/Json_parser/Program.cs @@ -33,7 +33,11 @@ static void Main(string[] args) { parse_commands_josn(base_lib_dir, file); } - + + // Copy tsp-lua-5.0 definations + Directory.CreateDirectory(Path.Combine(base_lib_dir, "tsp-lua-5.0")); + var lua_definations_file_path = Path.Combine(base_lib_dir, "tsp-lua-5.0"); + CopyStaticFiles("tsp-lua-5.0", lua_definations_file_path); } static void parse_commands_josn(string base_lib_dir, string json_file_path) diff --git a/Json_parser/StaticLuaDefinations/tsp-lua-5.0/basic.lua b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/basic.lua new file mode 100644 index 0000000..6fe94b8 --- /dev/null +++ b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/basic.lua @@ -0,0 +1,386 @@ +---@meta _ + +--- +---Command-line arguments of Lua Standalone. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-arg"]) +--- +---@type string[] +arg = {} + +--- +---Raises an error if the value of its argument v is false (i.e., `nil` or `false`); otherwise, returns all its arguments. In case of error, `message` is the error object; when absent, it defaults to `"assertion failed!"` +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-assert"]) +--- +---@generic T +---@param v? T +---@param message? any +---@param ... any +---@return T +---@return any ... +function assert(v, message, ...) end + +---@alias gcoptions +---|>"collect" # Performs a full garbage-collection cycle. +---| "stop" # Stops automatic execution. +---| "restart" # Restarts automatic execution. +---| "count" # Returns the total memory in Kbytes. +---| "step" # Performs a garbage-collection step. +---| "isrunning" # Returns whether the collector is running. +---| "setpause" # Set `pause`. +---| "setstepmul" # Set `step multiplier`. + +--- +---This function is a generic interface to the garbage collector. It performs different functions according to its first argument, `opt`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-collectgarbage"]) +--- +---@param opt? gcoptions +---@param arg? integer +---@return any +function collectgarbage(opt, arg) end + +--- +---Opens the named file and executes its content as a Lua chunk. When called without arguments, `dofile` executes the content of the standard input (`stdin`). Returns all values returned by the chunk. In case of errors, `dofile` propagates the error to its caller. (That is, `dofile` does not run in protected mode.) +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-dofile"]) +--- +---@param filename? string +---@return any ... +function dofile(filename) end + +--- +---Terminates the last protected function called and returns message as the error object. +--- +---Usually, `error` adds some information about the error position at the beginning of the message, if the message is a string. +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-error"]) +--- +---@param message any +---@param level? integer +function error(message, level) end + +--- +---A global variable (not a function) that holds the global environment (see [§2.2](command:extension.lua.doc?["en-us/51/manual.html/2.2"])). Lua itself does not use this variable; changing its value does not affect any environment, nor vice versa. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-_G"]) +--- +---@class _G +_G = {} + +--- +---Returns the current environment in use by the function. `f` can be a Lua function or a number that specifies the function at that stack level. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-getfenv"]) +--- +---@param f? integer|async fun(...):... +---@return table +---@nodiscard +function getfenv(f) end + +--- +---If object does not have a metatable, returns nil. Otherwise, if the object's metatable has a __metatable field, returns the associated value. Otherwise, returns the metatable of the given object. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-getmetatable"]) +--- +---@param object any +---@return table metatable +---@nodiscard +function getmetatable(object) end + +---Returns two results: the number of Kbytes of dynamic memory that Lua is using and the current garbage collector threshold (also in Kbytes). +function gcinfo () end + +--- +---Returns three values (an iterator function, the table `t`, and `0`) so that the construction +---```lua +--- for i,v in ipairs(t) do body end +---``` +---will iterate over the key–value pairs `(1,t[1]), (2,t[2]), ...`, up to the first absent index. +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-ipairs"]) +--- +---@generic T: table, V +---@param t T +---@return fun(table: V[], i?: integer):integer, V +---@return T +---@return integer i +function ipairs(t) end + +--- +---Loads a file as a Lua chunk (without running it). If there are no errors, returns the compiled chunk as a function; otherwise, returns nil plus the error message. The environment of the returned function is the global environment. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-loadfile"]) +--- +---@param filename? string +---@return function? +---@return string? error_message +---@nodiscard +function loadfile(filename) end + +--- +---Links the program with the dynamic C library libname. Inside this library, looks for a function funcname and returns this function as a C function. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-loadfile"]) +--- +---@param libname? string +---@param funcname? string +---@return function? +---@return string? error_message +---@nodiscard +function loadlib(libname, funcname) end +--- +---Loads a chunk from the given string. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-loadstring"]) +--- +---@param text string +---@param chunkname? string +---@return function? +---@return string? error_message +---@nodiscard +function loadstring(text, chunkname) end + +--- +---Allows a program to traverse all fields of a table. Its first argument is a table and its second argument is an index in this table. A call to `next` returns the next index of the table and its associated value. When called with `nil` as its second argument, `next` returns an initial index and its associated value. When called with the last index, or with `nil` in an empty table, `next` returns `nil`. If the second argument is absent, then it is interpreted as `nil`. In particular, you can use `next(t)` to check whether a table is empty. +--- +---The order in which the indices are enumerated is not specified, *even for numeric indices*. (To traverse a table in numerical order, use a numerical `for`.) +--- +---The behavior of `next` is undefined if, during the traversal, you assign any value to a non-existent field in the table. You may however modify existing fields. In particular, you may set existing fields to nil. +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-next"]) +--- +---@generic K, V +---@param table table +---@param index? K +---@return K? +---@return V? +---@nodiscard +function next(table, index) end + +--- +---If `t` has a metamethod `__pairs`, calls it with t as argument and returns the first three results from the call. +--- +---Otherwise, returns three values: the [next](command:extension.lua.doc?["en-us/51/manual.html/pdf-next"]) function, the table `t`, and `nil`, so that the construction +---```lua +--- for k,v in pairs(t) do body end +---``` +---will iterate over all key–value pairs of table `t`. +--- +---See function [next](command:extension.lua.doc?["en-us/51/manual.html/pdf-next"]) for the caveats of modifying the table during its traversal. +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-pairs"]) +--- +---@generic T: table, K, V +---@param t T +---@return fun(table: table, index?: K):K, V +---@return T +function pairs(t) end + +--- +---Calls the function `f` with the given arguments in *protected mode*. This means that any error inside `f` is not propagated; instead, `pcall` catches the error and returns a status code. Its first result is the status code (a boolean), which is true if the call succeeds without errors. In such case, `pcall` also returns all results from the call, after this first result. In case of any error, `pcall` returns `false` plus the error object. +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-pcall"]) +--- +---@param f function +---@param arg1? any +---@param ... any +---@return boolean success +---@return any result +---@return any ... +function pcall(f, arg1, ...) end + +--- +---Receives any number of arguments and prints their values to `stdout`, converting each argument to a string following the same rules of [tostring](command:extension.lua.doc?["en-us/51/manual.html/pdf-tostring"]). +---The function print is not intended for formatted output, but only as a quick way to show a value, for instance for debugging. For complete control over the output, use [string.format](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.format"]) and [io.write](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.write"]). +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-print"]) +--- +---@param ... any +function print(...) end + +--- +---Checks whether v1 is equal to v2, without invoking the `__eq` metamethod. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-rawequal"]) +--- +---@param v1 any +---@param v2 any +---@return boolean +---@nodiscard +function rawequal(v1, v2) end + +--- +---Gets the real value of `table[index]`, without invoking the `__index` metamethod. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-rawget"]) +--- +---@param table table +---@param index any +---@return any +---@nodiscard +function rawget(table, index) end + + +--- +---Sets the real value of `table[index]` to `value`, without using the `__newindex` metavalue. `table` must be a table, `index` any value different from `nil` and `NaN`, and `value` any Lua value. +---This function returns `table`. +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-rawset"]) +--- +---@param table table +---@param index any +---@param value any +---@return table +function rawset(table, index, value) end + +--- +---Loads the given module, returns any value returned by the given module(`true` when `nil`). +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-require"]) +--- +---@param modname string +---@return unknown +function require(modname) end + +--- +---Sets the environment to be used by the given function. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-setfenv"]) +--- +---@param f (async fun(...):...)|integer +---@param table table +---@return function +function setfenv(f, table) end + + +---@class metatable +---@field __mode 'v'|'k'|'kv'|nil +---@field __metatable any|nil +---@field __tostring (fun(t):string)|nil +---@field __gc fun(t)|nil +---@field __add (fun(t1,t2):any)|nil +---@field __sub (fun(t1,t2):any)|nil +---@field __mul (fun(t1,t2):any)|nil +---@field __div (fun(t1,t2):any)|nil +---@field __mod (fun(t1,t2):any)|nil +---@field __pow (fun(t1,t2):any)|nil +---@field __unm (fun(t):any)|nil +---@field __concat (fun(t1,t2):any)|nil +---@field __len (fun(t):integer)|nil +---@field __eq (fun(t1,t2):boolean)|nil +---@field __lt (fun(t1,t2):boolean)|nil +---@field __le (fun(t1,t2):boolean)|nil +---@field __index table|(fun(t,k):any)|nil +---@field __newindex table|fun(t,k,v)|nil +---@field __call (fun(t,...):...)|nil + +--- +---Sets the metatable for the given table. If `metatable` is `nil`, removes the metatable of the given table. If the original metatable has a `__metatable` field, raises an error. +--- +---This function returns `table`. +--- +---To change the metatable of other types from Lua code, you must use the debug library ([§6.10](command:extension.lua.doc?["en-us/51/manual.html/6.10"])). +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-setmetatable"]) +--- +---@param table table +---@param metatable? metatable|table +---@return table +function setmetatable(table, metatable) end + +--- +---When called with no `base`, `tonumber` tries to convert its argument to a number. If the argument is already a number or a string convertible to a number, then `tonumber` returns this number; otherwise, it returns `fail`. +--- +---The conversion of strings can result in integers or floats, according to the lexical conventions of Lua (see [§3.1](command:extension.lua.doc?["en-us/51/manual.html/3.1"])). The string may have leading and trailing spaces and a sign. +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-tonumber"]) +--- +---@overload fun(e: string, base: integer):integer +---@param e any +---@return number? +---@nodiscard +function tonumber(e) end + +--- +---Receives a value of any type and converts it to a string in a human-readable format. +--- +---If the metatable of `v` has a `__tostring` field, then `tostring` calls the corresponding value with `v` as argument, and uses the result of the call as its result. Otherwise, if the metatable of `v` has a `__name` field with a string value, `tostring` may use that string in its final result. +--- +---For complete control of how numbers are converted, use [string.format](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.format"]). +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-tostring"]) +--- +---@param v any +---@return string +---@nodiscard +function tostring(v) end + +---@alias type +---| "nil" +---| "number" +---| "string" +---| "boolean" +---| "table" +---| "function" +---| "thread" +---| "userdata" + +--- +---Returns the type of its only argument, coded as a string. The possible results of this function are `"nil"` (a string, not the value `nil`), `"number"`, `"string"`, `"boolean"`, `"table"`, `"function"`, `"thread"`, and `"userdata"`. +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-type"]) +--- +---@param v any +---@return type type +---@nodiscard +function type(v) end + +--- +---A global variable (not a function) that holds a string containing the running Lua version. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-_VERSION"]) +--- +_VERSION = "Lua 5.0" + + +--- +---Calls function `f` with the given arguments in protected mode with a new message handler. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-xpcall"]) +--- +---@param f function +---@param err function +---@return boolean success +---@return any result +---@return any ... +function xpcall(f, err) end + + +--- +---Returns the elements from the given `list`. This function is equivalent to +---```lua +--- return list[i], list[i+1], ···, list[j] +---``` +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-unpack"]) +--- +---@generic T +---@param list T[] +---@return T ... +---@nodiscard +function unpack(list) end + diff --git a/Json_parser/StaticLuaDefinations/tsp-lua-5.0/builtin.lua b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/builtin.lua new file mode 100644 index 0000000..466a096 --- /dev/null +++ b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/builtin.lua @@ -0,0 +1,16 @@ +---@meta _ + +---@class unknown +---@class any +---@class nil +---@class boolean +---@class true: boolean +---@class false: boolean +---@class number +---@class integer: number +---@class thread +---@class table: { [K]: V } +---@class string: stringlib +---@class userdata +---@class lightuserdata +---@class function diff --git a/Json_parser/StaticLuaDefinations/tsp-lua-5.0/coroutine.lua b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/coroutine.lua new file mode 100644 index 0000000..002777f --- /dev/null +++ b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/coroutine.lua @@ -0,0 +1,64 @@ +---@meta coroutine + +--- +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-coroutine"]) +--- +---@class coroutinelib +coroutine = {} + +--- +---Creates a new coroutine, with body `f`. `f` must be a function. Returns this new coroutine, an object with type `"thread"`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-coroutine.create"]) +--- +---@param f async fun(...):... +---@return thread +---@nodiscard +function coroutine.create(f) end + +--- +---Starts or continues the execution of coroutine `co`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-coroutine.resume"]) +--- +---@param co thread +---@param val1? any +---@return boolean success +---@return any ... +function coroutine.resume(co, val1, ...) end + +--- +---Returns the status of coroutine `co`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-coroutine.status"]) +--- +---@param co thread +---@return +---| '"running"' # Is running. +---| '"suspended"' # Is suspended or not started. +---| '"dead"' # Has finished or stopped with an error. +---@nodiscard +function coroutine.status(co) end + +--- +---Creates a new coroutine, with body `f`; `f` must be a function. Returns a function that resumes the coroutine each time it is called. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-coroutine.wrap"]) +--- +---@param f async fun(...):... +---@return fun(...):... +---@nodiscard +function coroutine.wrap(f) end + +--- +---Suspends the execution of the calling coroutine. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-coroutine.yield"]) +--- +---@async +---@return any ... +function coroutine.yield(...) end + +return coroutine diff --git a/Json_parser/StaticLuaDefinations/tsp-lua-5.0/debug.lua b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/debug.lua new file mode 100644 index 0000000..0c20ac1 --- /dev/null +++ b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/debug.lua @@ -0,0 +1,149 @@ +---@meta debug + +--- +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug"]) +--- +---@class debuglib +debug = {} + +---@class debuginfo +---@field name string +---@field namewhat string +---@field source string +---@field short_src string +---@field linedefined integer +---@field lastlinedefined integer +---@field what string +---@field currentline integer +---@field istailcall boolean +---@field nups integer +---@field func function +---@field activelines table + +--- +---Enters an interactive mode with the user, running each string that the user enters. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug.debug"]) +--- +function debug.debug() end + +--- +---Returns the current hook settings of the thread. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug.gethook"]) +--- +---@param co? thread +---@return function hook +---@return string mask +---@return integer count +---@nodiscard +function debug.gethook(co) end + +---@alias infowhat string +---|+"n" # `name` and `namewhat` +---|+"S" # `source`, `short_src`, `linedefined`, `lastlinedefined`, and `what` +---|+"l" # `currentline` +---|+"t" # `istailcall` +---|+"u" # `nups` +---|+"f" # `func` +---|+"L" # `activelines` + +--- +---Returns a table with information about a function. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug.getinfo"]) +--- +---@overload fun(f: integer|function, what?: infowhat):debuginfo +---@param thread thread +---@param f integer|async fun(...):... +---@param what? infowhat +---@return debuginfo +---@nodiscard +function debug.getinfo(thread, f, what) end + +--- +---Returns the name and the value of the local variable with index `local` of the function at level `level` of the stack. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug.getlocal"]) +--- +---@overload fun(level: integer, index: integer):string, any +---@param thread thread +---@param level integer +---@param index integer +---@return string name +---@return any value +---@nodiscard +function debug.getlocal(thread, level, index) end + +--- +---Returns the name and the value of the upvalue with index `up` of the function. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug.getupvalue"]) +--- +---@param f async fun(...):... +---@param up integer +---@return string name +---@return any value +---@nodiscard +function debug.getupvalue(f, up) end + +--- +---Assigns the `value` to the local variable with index `local` of the function at `level` of the stack. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug.setlocal"]) +--- +---@overload fun(level: integer, index: integer, value: any):string +---@param thread thread +---@param level integer +---@param index integer +---@param value any +---@return string name +function debug.setlocal(thread, level, index, value) end + +--- +---Assigns the `value` to the upvalue with index `up` of the function. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug.setupvalue"]) +--- +---@param f async fun(...):... +---@param up integer +---@param value any +---@return string name +function debug.setupvalue(f, up, value) end + + +---@alias hookmask string +---|+"c" # Calls hook when Lua calls a function. +---|+"r" # Calls hook when Lua returns from a function. +---|+"l" # Calls hook when Lua enters a new line of code. + +--- +---Sets the given function as a hook. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug.sethook"]) +--- +---@overload fun(hook: (async fun(...):...), mask: hookmask, count?: integer) +---@overload fun(thread: thread):... +---@overload fun(...):... +---@param thread thread +---@param hook async fun(...):... +---@param mask hookmask +---@param count? integer +function debug.sethook(thread, hook, mask, count) end + +--- +---Returns a string with a traceback of the call stack. The optional message string is appended at the beginning of the traceback. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-debug.traceback"]) +--- +---@overload fun(message?: any, level?: integer): string +---@param thread thread +---@param message? any +---@param level? integer +---@return string message +---@nodiscard +function debug.traceback(thread, message, level) end + +return debug diff --git a/Json_parser/StaticLuaDefinations/tsp-lua-5.0/io.lua b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/io.lua new file mode 100644 index 0000000..50b08e4 --- /dev/null +++ b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/io.lua @@ -0,0 +1,229 @@ +---@meta io + +--- +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io"]) +--- +---@class iolib +--- +---standard input. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.stdin"]) +--- +---@field stdin file* +--- +---standard output. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.stdout"]) +--- +---@field stdout file* +--- +---standard error. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.stderr"]) +--- +---@field stderr file* +io = {} + +---@alias openmode +---|>"r" # Read mode. +---| "w" # Write mode. +---| "a" # Append mode. +---| "r+" # Update mode, all previous data is preserved. +---| "w+" # Update mode, all previous data is erased. +---| "a+" # Append update mode, previous data is preserved, writing is only allowed at the end of file. + +--- +---Close `file` or default output file. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.close"]) +--- +---@param file? file* +---@return boolean? suc +---@return exitcode? exitcode +---@return integer? code +function io.close(file) end + +--- +---Saves any written data to default output file. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.flush"]) +--- +function io.flush() end + +--- +---Sets `file` as the default input file. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.input"]) +--- +---@overload fun():file* +---@param file string|file* +function io.input(file) end + +--- +--------- +---```lua +---for c in io.lines(filename, ...) do +--- body +---end +---``` +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.lines"]) +--- +---@param filename string? +---@param ... readmode +---@return fun():any, ... +function io.lines(filename, ...) end + +--- +---Opens a file, in the mode specified in the string `mode`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.open"]) +--- +---@param filename string +---@param mode? openmode +---@return file*? +---@return string? errmsg +---@nodiscard +function io.open(filename, mode) end + +--- +---Sets `file` as the default output file. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.output"]) +--- +---@overload fun():file* +---@param file string|file* +function io.output(file) end + +--- +---Reads the `file`, according to the given formats, which specify what to read. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.read"]) +--- +---@param ... readmode +---@return any +---@return any ... +---@nodiscard +function io.read(...) end + +--- +---In case of success, returns a handle for a temporary file. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.tmpfile"]) +--- +---@return file* +---@nodiscard +function io.tmpfile() end + +---@alias filetype +---| "file" # Is an open file handle. +---| "closed file" # Is a closed file handle. +---| `nil` # Is not a file handle. + +--- +---Checks whether `obj` is a valid file handle. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.type"]) +--- +---@param file file* +---@return filetype +---@nodiscard +function io.type(file) end + +--- +---Writes the value of each of its arguments to default output file. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-io.write"]) +--- +---@return file* +---@return string? errmsg +function io.write(...) end + +--- +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-file"]) +--- +---@class file* +local file = {} + +---@alias readmode integer|string +---| "*n" # Reads a numeral and returns it as number. +---| "*a" # Reads the whole file. +---|>"*l" # Reads the next line skipping the end of line. + +---@alias exitcode "exit"|"signal" + +--- +---Close `file`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-file:close"]) +--- +---@return boolean? suc +---@return exitcode? exitcode +---@return integer? code +function file:close() end + +--- +---Saves any written data to `file`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-file:flush"]) +--- +function file:flush() end + +--- +--------- +---```lua +---for c in file:lines(...) do +--- body +---end +---``` +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-file:lines"]) +--- +---@param ... readmode +---@return fun():any, ... +function file:lines(...) end + +--- +---Reads the `file`, according to the given formats, which specify what to read. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-file:read"]) +--- +---@param ... readmode +---@return any +---@return any ... +---@nodiscard +function file:read(...) end + +---@alias seekwhence +---| "set" # Base is beginning of the file. +---|>"cur" # Base is current position. +---| "end" # Base is end of file. + +--- +---Sets and gets the file position, measured from the beginning of the file. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-file:seek"]) +--- +---@param whence? seekwhence +---@param offset? integer +---@return integer offset +---@return string? errmsg +function file:seek(whence, offset) end + +--- +---Writes the value of each of its arguments to `file`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-file:write"]) +--- +---@param ... string|number +---@return file*? +---@return string? errmsg +function file:write(...) end + +return io diff --git a/Json_parser/StaticLuaDefinations/tsp-lua-5.0/math.lua b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/math.lua new file mode 100644 index 0000000..f4391ee --- /dev/null +++ b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/math.lua @@ -0,0 +1,282 @@ +---@meta math + +--- +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math"]) +--- +---@class mathlib +--- +---A value larger than any other numeric value. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.huge"]) +--- +---@field huge number +--- +---The value of *π*. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.pi"]) +--- +---@field pi number +math = {} + +--- +---Returns the absolute value of `x`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.abs"]) +--- +---@generic Number: number +---@param x Number +---@return Number +---@nodiscard +function math.abs(x) end + +--- +---Returns the arc cosine of `x` (in radians). +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.acos"]) +--- +---@param x number +---@return number +---@nodiscard +function math.acos(x) end + +--- +---Returns the arc sine of `x` (in radians). +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.asin"]) +--- +---@param x number +---@return number +---@nodiscard +function math.asin(x) end + +--- +---Returns the arc tangent of `x` (in radians). +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.atan"]) +--- +---@param y number +---@return number +---@nodiscard +function math.atan(y) end + +---@version <5.2 +--- +---Returns the arc tangent of `y/x` (in radians). +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.atan2"]) +--- +---@param y number +---@param x number +---@return number +---@nodiscard +function math.atan2(y, x) end + +--- +---Returns the smallest integral value larger than or equal to `x`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.ceil"]) +--- +---@param x number +---@return integer +---@nodiscard +function math.ceil(x) end + +--- +---Returns the cosine of `x` (assumed to be in radians). +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.cos"]) +--- +---@param x number +---@return number +---@nodiscard +function math.cos(x) end + + +--- +---Converts the angle `x` from radians to degrees. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.deg"]) +--- +---@param x number +---@return number +---@nodiscard +function math.deg(x) end + +--- +---Returns the value `e^x` (where `e` is the base of natural logarithms). +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.exp"]) +--- +---@param x number +---@return number +---@nodiscard +function math.exp(x) end + +--- +---Returns the largest integral value smaller than or equal to `x`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.floor"]) +--- +---@param x number +---@return integer +---@nodiscard +function math.floor(x) end + + +--- +---Returns the natural logarithm of `x` . +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.log"]) +--- +---@param x number +---@return number +---@nodiscard +function math.log(x) end + +---@version <5.1 +--- +---Returns the base-10 logarithm of x. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.log10"]) +--- +---@param x number +---@return number +---@nodiscard +function math.log10(x) end + +--- +---Returns the argument with the maximum value, according to the Lua operator `<`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.max"]) +--- +---@generic Number: number +---@param x Number +---@param ... Number +---@return Number +---@nodiscard +function math.max(x, ...) end + +--- +---Returns the argument with the minimum value, according to the Lua operator `<`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.min"]) +--- +---@generic Number: number +---@param x Number +---@param ... Number +---@return Number +---@nodiscard +function math.min(x, ...) end + +--- +---Returns the remainder of the division of `x` by `y` that rounds the quotient towards zero. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.fmod"]) +--- +---@param x number +---@param y number +---@return number +---@nodiscard +function math.mod(x, y) end + +--- +---Returns `x ^ y` . +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.pow"]) +--- +---@param x number +---@param y number +---@return number +---@nodiscard +function math.pow(x, y) end + +--- +---Converts the angle `x` from degrees to radians. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.rad"]) +--- +---@param x number +---@return number +---@nodiscard +function math.rad(x) end + +--- +---Returns the sine of `x` (assumed to be in radians). +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.sin"]) +--- +---@param x number +---@return number +---@nodiscard +function math.sin(x) end + +--- +---Returns the square root of `x`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.sqrt"]) +--- +---@param x number +---@return number +---@nodiscard +function math.sqrt(x) end + +--- +---Returns the tangent of `x` (assumed to be in radians). +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.tan"]) +--- +---@param x number +---@return number +---@nodiscard +function math.tan(x) end + +--- +---Decompose `x` into tails and exponents. Returns `m` and `e` such that `x = m * (2 ^ e)`, `e` is an integer and the absolute value of `m` is in the range [0.5, 1) (or zero when `x` is zero). +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.frexp"]) +--- +---@param x number +---@return number m +---@return number e +---@nodiscard +function math.frexp(x) end + +--- +---Returns `m * (2 ^ e)` . +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.ldexp"]) +--- +---@param m number +---@param e number +---@return number +---@nodiscard +function math.ldexp(m, e) end + +--- +---* `math.random()`: Returns a float in the range [0,1). +---* `math.random(n)`: Returns a integer in the range [1, n]. +---* `math.random(m, n)`: Returns a integer in the range [m, n]. +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.random"]) +--- +---@overload fun():number +---@overload fun(m: integer):integer +---@param m integer +---@param n integer +---@return integer +---@nodiscard +function math.random(m, n) end + +--- +---Sets `x` as the "seed" for the pseudo-random generator. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-math.randomseed"]) +--- +---@param x integer +function math.randomseed(x) end + + +return math diff --git a/Json_parser/StaticLuaDefinations/tsp-lua-5.0/os.lua b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/os.lua new file mode 100644 index 0000000..b556f9b --- /dev/null +++ b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/os.lua @@ -0,0 +1,239 @@ +---@meta os + +--- +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os"]) +--- +---@class oslib +os = {} + +--- +---Returns an approximation of the amount in seconds of CPU time used by the program. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.clock"]) +--- +---@return number +---@nodiscard +function os.clock() end + +---@class osdate +--- +---four digits +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.year"]) +--- +---@field year integer|string +--- +---1-12 +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.month"]) +--- +---@field month integer|string +--- +---1-31 +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.day"]) +--- +---@field day integer|string +--- +---0-23 +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.hour"]) +--- +---@field hour integer|string +--- +---0-59 +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.min"]) +--- +---@field min integer|string +--- +---0-61 +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.sec"]) +--- +---@field sec integer|string +--- +---weekday, 1–7, Sunday is 1 +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.wday"]) +--- +---@field wday integer|string +--- +---day of the year, 1–366 +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.yday"]) +--- +---@field yday integer|string +--- +---daylight saving flag, a boolean +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.isdst"]) +--- +---@field isdst boolean + +--- +---Returns a string or a table containing date and time, formatted according to the given string `format`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.date"]) +--- +---@param format? string +---@param time? integer +---@return string|osdate +---@nodiscard +function os.date(format, time) end + +--- +---Returns the difference, in seconds, from time `t1` to time `t2`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.difftime"]) +--- +---@param t2 integer +---@param t1 integer +---@return integer +---@nodiscard +function os.difftime(t2, t1) end + +--- +---Passes `command` to be executed by an operating system shell. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.execute"]) +--- +---@param command? string +---@return integer code +function os.execute(command) end + +--- +---Calls the C function `exit` to terminate the host program. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.exit"]) +--- +---@param code? integer +function os.exit(code, close) end + +--- +---Returns the value of the process environment variable `varname`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.getenv"]) +--- +---@param varname string +---@return string? +---@nodiscard +function os.getenv(varname) end + +--- +---Deletes the file with the given name. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.remove"]) +--- +---@param filename string +---@return boolean suc +---@return string? errmsg +function os.remove(filename) end + +--- +---Renames the file or directory named `oldname` to `newname`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.rename"]) +--- +---@param oldname string +---@param newname string +---@return boolean suc +---@return string? errmsg +function os.rename(oldname, newname) end + +---@alias localecategory +---|>"all" +---| "collate" +---| "ctype" +---| "monetary" +---| "numeric" +---| "time" + +--- +---Sets the current locale of the program. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.setlocale"]) +--- +---@param locale string|nil +---@param category? localecategory +---@return string localecategory +function os.setlocale(locale, category) end + +---@class osdateparam +--- +---four digits +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.year"]) +--- +---@field year integer|string +--- +---1-12 +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.month"]) +--- +---@field month integer|string +--- +---1-31 +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.day"]) +--- +---@field day integer|string +--- +---0-23 +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.hour"]) +--- +---@field hour (integer|string)? +--- +---0-59 +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.min"]) +--- +---@field min (integer|string)? +--- +---0-61 +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.sec"]) +--- +---@field sec (integer|string)? +--- +---weekday, 1–7, Sunday is 1 +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.wday"]) +--- +---@field wday (integer|string)? +--- +---day of the year, 1–366 +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.yday"]) +--- +---@field yday (integer|string)? +--- +---daylight saving flag, a boolean +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-osdate.isdst"]) +--- +---@field isdst boolean? + +--- +---Returns the current time when called without arguments, or a time representing the local date and time specified by the given table. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.time"]) +--- +---@param date? osdateparam +---@return integer +---@nodiscard +function os.time(date) end + +--- +---Returns a string with a file name that can be used for a temporary file. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-os.tmpname"]) +--- +---@return string +---@nodiscard +function os.tmpname() end + +return os diff --git a/Json_parser/StaticLuaDefinations/tsp-lua-5.0/string.lua b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/string.lua new file mode 100644 index 0000000..9307829 --- /dev/null +++ b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/string.lua @@ -0,0 +1,157 @@ +---@meta string + +--- +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string"]) +--- +---@class stringlib +string = {} + +--- +---Returns the internal numeric codes of the characters `s[i], s[i+1], ..., s[j]`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.byte"]) +--- +---@param s string|number +---@param i? integer +---@param j? integer +---@return integer ... +---@nodiscard +function string.byte(s, i, j) end + +--- +---Returns a string with length equal to the number of arguments, in which each character has the internal numeric code equal to its corresponding argument. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.char"]) +--- +---@param byte integer +---@param ... integer +---@return string +---@nodiscard +function string.char(byte, ...) end + +--- +---Returns a string containing a binary representation (a *binary chunk*) of the given function. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.dump"]) +--- +---@param f async fun(...):... +---@return string +---@nodiscard +function string.dump(f) end + +--- +---Looks for the first match of `pattern` (see [§6.4.1](command:extension.lua.doc?["en-us/51/manual.html/6.4.1"])) in the string. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.find"]) +--- +---@param s string|number +---@param pattern string|number +---@param init? integer +---@param plain? boolean +---@return integer|nil start +---@return integer|nil end +---@return any|nil ... captured +---@nodiscard +function string.find(s, pattern, init, plain) end + +--- +---Returns its length. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.len"]) +--- +---@param s string|number +---@return integer +---@nodiscard +function string.len(s) end + +--- +---Returns a copy of this string with all uppercase letters changed to lowercase. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.lower"]) +--- +---@param s string|number +---@return string +---@nodiscard +function string.lower(s) end + +--- +---Returns a string that is the concatenation of `n` copies of the string `s` . +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.rep"]) +--- +---@param s string|number +---@param n integer +---@return string +---@nodiscard +function string.rep(s, n) end + +--- +---Returns the substring of the string that starts at `i` and continues until `j`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.sub"]) +--- +---@param s string|number +---@param i integer +---@param j? integer +---@return string +---@nodiscard +function string.sub(s, i, j) end + +--- +---Returns a copy of this string with all lowercase letters changed to uppercase. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.upper"]) +--- +---@param s string|number +---@return string +---@nodiscard +function string.upper(s) end + +--- +---Returns a formatted version of its variable number of arguments following the description given in its first argument. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.format"]) +--- +---@param s string|number +---@param ... any +---@return string +---@nodiscard +function string.format(s, ...) end + +--- +---Returns an iterator function that, each time it is called, returns the next captures from `pattern` (see [§6.4.1](command:extension.lua.doc?["en-us/51/manual.html/6.4.1"])) over the string s. +--- +---As an example, the following loop will iterate over all the words from string s, printing one per line: +---```lua +--- s = +---"hello world from Lua" +--- for w in string.gmatch(s, "%a+") do +--- print(w) +--- end +---``` +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.gmatch"]) +--- +---@param s string|number +---@param pattern string|number +---@return fun():string, ... +---@nodiscard +function string.gfind (s, pattern) end + +--- +---Returns a copy of s in which all (or the first `n`, if given) occurrences of the `pattern` (see [§6.4.1](command:extension.lua.doc?["en-us/51/manual.html/6.4.1"])) have been replaced by a replacement string specified by `repl`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-string.gsub"]) +--- +---@param s string|number +---@param pattern string|number +---@param repl string|number|table|function +---@param n? integer +---@return string +---@return integer count +function string.gsub(s, pattern, repl, n) end + +return string diff --git a/Json_parser/StaticLuaDefinations/tsp-lua-5.0/table.lua b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/table.lua new file mode 100644 index 0000000..34562db --- /dev/null +++ b/Json_parser/StaticLuaDefinations/tsp-lua-5.0/table.lua @@ -0,0 +1,102 @@ +---@meta table + +--- +--- +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-table"]) +--- +---@class tablelib +table = {} + +--- +---Given a list where all elements are strings or numbers, returns the string `list[i]..sep..list[i+1] ··· sep..list[j]`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-table.concat"]) +--- +---@param list table +---@param sep? string +---@param i? integer +---@param j? integer +---@return string +---@nodiscard +function table.concat(list, sep, i, j) end + +--- +---Executes the given f over all elements of table. For each element, f is called with the index and respective value as arguments. If f returns a non-nil value, then the loop is broken, and this value is returned as the final value of foreach. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-table.foreach"]) +--- +---@generic T +---@param list any +---@param callback fun(key: string, value: any):T|nil +---@return T|nil +---@deprecated +function table.foreach(list, callback) end + +--- +---Executes the given f over the numerical indices of table. For each index, f is called with the index and respective value as arguments. Indices are visited in sequential order, from 1 to n, where n is the size of the table. If f returns a non-nil value, then the loop is broken and this value is returned as the result of foreachi. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-table.foreachi"]) +--- +---@generic T +---@param list any +---@param callback fun(key: string, value: any):T|nil +---@return T|nil +---@deprecated +function table.foreachi(list, callback) end + +--- +---Returns the number of elements in the table. This function is equivalent to `#list`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-table.getn"]) +--- +---@generic T +---@param list T[] +---@return integer +---@nodiscard +---@deprecated +function table.getn(list) end + +--- +---Sorts list elements in a given order, *in-place*, from `list[1]` to `list[#list]`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-table.sort"]) +--- +---@generic T +---@param list T[] +---@param comp? fun(a: T, b: T):boolean +function table.sort(list, comp) end + +--- +---Inserts element `value` at position `pos` in `list`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-table.insert"]) +--- +---@overload fun(list: table, value: any) +---@param list table +---@param pos integer +---@param value any +function table.insert(list, pos, value) end + +--- +---Removes from `list` the element at position `pos`, returning the value of the removed element. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-table.remove"]) +--- +---@param list table +---@param pos? integer +---@return any +function table.remove(list, pos) end + +--- +---Returns the number of elements in the table. This function is equivalent to `#list`. +--- +---[View documents](command:extension.lua.doc?["en-us/51/manual.html/pdf-table.setn"]) +--- +---@generic T +---@param list T[] +---@param n number +function table.setn(list, n) end + + +return table From 4a4986a191908031bcdebc7c89f0c4bfc23cd05f Mon Sep 17 00:00:00 2001 From: rajeev Date: Thu, 3 Oct 2024 16:52:58 +0530 Subject: [PATCH 7/7] fixing node table name issue, removing any invalide character from model name so that it will give valide lua table name --- Json_parser/Program.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Json_parser/Program.cs b/Json_parser/Program.cs index 5238f66..d5df1c6 100644 --- a/Json_parser/Program.cs +++ b/Json_parser/Program.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text.RegularExpressions; //using static jsonToLuaParser.Utility; using static jsonToLuaParser.Utility; namespace jsonToLuaParser @@ -192,7 +193,8 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path) } var nodeTable_str = @"{" + string.Join(",\n ", nodeTable) + "\n}"; - var nodeTableDetails = $"---@meta\n\n---@class model{file_name}\nmodel{file_name} = {nodeTable_str}" + + var node_class_name = Regex.Replace(file_name, @"[^a-zA-Z0-9_]", ""); + var nodeTableDetails = $"---@meta\n\n---@class model{node_class_name}\nmodel{node_class_name} = {nodeTable_str}" + $"\n--#region node details\n--#endregion"; Directory.CreateDirectory(Path.Combine(base_lib_dir, model));