diff --git a/src/parser.ts b/src/parser.ts index d9dc4d4..3f7ad78 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -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);