tabscript
tabscript(
inData,options?):object
Defined in: .work/repos/tabscript/src/tabscript.ts:71
Transpiles TabScript to TypeScript or JavaScript.
Parameters
Section titled “Parameters”inData
Section titled “inData”string
The input TabScript.
options?
Section titled “options?”Options = {}
An optional object containing the following optional properties:
debugWhentrue, each consumed token is logged. If it’s a function, that function will be called instead ofconsole.debug.recoverWhentrue, the function will attempt to continue transpilation when it encounters an error in the input (or unsupported syntax), instead of throwing. Errors are logged toconsole.error.- ‘js’ When
true, we’ll transpile to JavaScript instead of TypeScript. Note that TabScript will not perform any type checking, just strip out the type info. transformImportAn async function that gets animportURI, and returns the URI to be include included in the transpiled output.whitespaceWhen"preserve"(the default), output is made to closely align with input line/column positions. When"pretty", output is formatted with human-friendly indentation and spacing.loadPluginFunction to load plugin modules from a path.
Returns
Section titled “Returns”object
An object containing:
code: The transpiled TypeScript/JavaScript code.errors: An array of errors encountered during transpilation (if any) of the form:{ message: string, line: number, column: number, offset: number }. Ifrecoveris not set, this array will contain at most one error.map: An object mapping input offsets to output offsets, of the form:{ in: number[], out: number[] }, where each index corresponds to a mapping pair.
code:
string
errors
Section titled “errors”errors:
ParseError[]
map:
object
map.in
Section titled “map.in”in:
number[]
map.out
Section titled “map.out”out:
number[]
Throws
Section titled “Throws”ParserError, if there’s a compilation error and recover is not set.