Add optional (and unused) offset parameter to parse() signature

This commit is contained in:
Tangent Wantwight 2024-06-05 00:32:04 -04:00
parent 9acba7431f
commit 7c74c9e34f

View file

@ -137,10 +137,11 @@ const ERROR_CONTEXT = /(?<=([^\n]{0,50}))([^\n]{0,50})/y;
* Parse out a Notcl script into an easier-to-interpret representation.
* No script is actually executed yet.
*
* @param - code to parse
* @returns - parsed list of commands, or error message on failure
* @param code code to parse
* @param offset source position of code, if embedded in a larger source document
* @returns parsed list of commands, or error message on failure
*/
export function parse(code: string): [true, Script] | [false, string] {
export function parse(code: string, offset = 0): [true, Script] | [false, string] {
/* Parse */
const [commands, errorPos, expected] = Script.match(code, 0);