Add optional (and unused) offset parameter to parse() signature
This commit is contained in:
parent
9acba7431f
commit
7c74c9e34f
1 changed files with 4 additions and 3 deletions
|
@ -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.
|
* Parse out a Notcl script into an easier-to-interpret representation.
|
||||||
* No script is actually executed yet.
|
* No script is actually executed yet.
|
||||||
*
|
*
|
||||||
* @param - code to parse
|
* @param code code to parse
|
||||||
* @returns - parsed list of commands, or error message on failure
|
* @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 */
|
/* Parse */
|
||||||
const [commands, errorPos, expected] = Script.match(code, 0);
|
const [commands, errorPos, expected] = Script.match(code, 0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue