mirror of
https://github.com/SikongJueluo/cc-utils.git
synced 2025-11-05 03:37:50 +08:00
move package and add tab component for tui famework
This commit is contained in:
84
thirdparty/toml2lua/index.d.ts
vendored
Normal file
84
thirdparty/toml2lua/index.d.ts
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
/** @noResolution */
|
||||
|
||||
/**
|
||||
* Represents a date-time value in TOML.
|
||||
* The object can have various combinations of year, month, day, hour, min, sec, and zone properties.
|
||||
*/
|
||||
interface TomlDate {
|
||||
year?: number;
|
||||
month?: number;
|
||||
day?: number;
|
||||
hour?: number;
|
||||
min?: number;
|
||||
sec?: number;
|
||||
zone?: number; // timezone offset
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for TOML parsing
|
||||
*/
|
||||
interface ParseOptions {
|
||||
/** Whether to follow the TOML spec strictly (default: true) */
|
||||
strict?: boolean;
|
||||
}
|
||||
|
||||
/** The current supported TOML version */
|
||||
export const version: string;
|
||||
|
||||
/** Whether the parser should follow the TOML spec strictly */
|
||||
export const strict: boolean;
|
||||
|
||||
/**
|
||||
* Creates a date object with proper validation and string representation
|
||||
* @param tab Date components to validate and create a date object from
|
||||
* @returns Validated date object or nil with error message
|
||||
*/
|
||||
export function datefy(tab: TomlDate): TomlDate | [undefined, string];
|
||||
|
||||
/**
|
||||
* Checks if a table is a date object
|
||||
* @param tab The table to check
|
||||
* @returns True if the table is a date object, false otherwise
|
||||
*/
|
||||
export function isdate(tab: unknown): boolean;
|
||||
|
||||
/**
|
||||
* Creates a multi-step parser for streaming TOML data
|
||||
* @param options Parsing options
|
||||
* @returns A coroutine-based parser function that can be called with data chunks
|
||||
* and then called without arguments to get the result
|
||||
*/
|
||||
export function multistep_parser(options?: ParseOptions): {
|
||||
(data: string): void; // Provide data chunk
|
||||
(): [any, string] | any; // Get final result (call without arguments)
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses TOML data into a Lua table
|
||||
* @param data The TOML string to parse
|
||||
* @param options Parsing options
|
||||
* @returns The parsed data as a Lua table, or [null, error_message] on failure
|
||||
*/
|
||||
export function parse(
|
||||
data: string,
|
||||
options?: ParseOptions,
|
||||
): [undefined, string] | any;
|
||||
|
||||
/**
|
||||
* Parse TOML and return values in toml-test intermediate format
|
||||
* Useful for debugging or when you need explicit type information
|
||||
* @param data The TOML string to parse
|
||||
* @param options Parsing options
|
||||
* @returns The parsed data in toml-test format, or [null, error_message] on failure
|
||||
*/
|
||||
export function parseToTestFormat(
|
||||
data: string,
|
||||
options?: ParseOptions,
|
||||
): [undefined, string] | any;
|
||||
|
||||
/**
|
||||
* Encodes a Lua table to TOML format
|
||||
* @param tbl The Lua table to encode
|
||||
* @returns The TOML string representation of the table
|
||||
*/
|
||||
export function encode(tbl: any): string;
|
||||
1767
thirdparty/toml2lua/index.lua
vendored
Normal file
1767
thirdparty/toml2lua/index.lua
vendored
Normal file
File diff suppressed because it is too large
Load Diff
12
thirdparty/toml2lua/package.json
vendored
Normal file
12
thirdparty/toml2lua/package.json
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "@sikongjueluo/toml2lua-types",
|
||||
"version": "1.0.0",
|
||||
"description": "TypeScript type definitions for library toml2lua APIs.",
|
||||
"types": "./index.d.ts",
|
||||
"files": [
|
||||
"./*.d.ts",
|
||||
"./index.lua"
|
||||
],
|
||||
"author": "SikongJueluo",
|
||||
"license": "MIT"
|
||||
}
|
||||
Reference in New Issue
Block a user