diff --git a/src/parser/parser2.ts b/src/parser/parser2.ts index f57bbfe..57ea905 100644 --- a/src/parser/parser2.ts +++ b/src/parser/parser2.ts @@ -60,7 +60,7 @@ export class Parser { if (stmt) node.add(stmt) if (this.pos === prevPos && !this.isEOF()) - throw "parser didn't advance - you need to call next()\n\n ${this.input}\n" + throw `parser didn't advance - you need to call next()\n\n ${this.input}\n` } return node @@ -517,7 +517,7 @@ export class Parser { if (this.is($T.Keyword, 'finally')) finalNode = this.finally() - let end = this.keyword('end') + const end = this.keyword('end') let last = block.at(-1) if (finalNode) last = finalNode.children.at(-1)! @@ -687,7 +687,7 @@ export class Parser { const ifWord = this.keyword('if') const elseIfTest = this.testExpr() const elseIfBlock = this.block() - const elseIfNode = new SyntaxNode('ElseIfExpr', ifBlock.at(-1)!.from, elseIfBlock.at(-1)!.to) + const elseIfNode = new SyntaxNode('ElseIfExpr', elseWord.from, elseIfBlock.at(-1)!.to) elseIfNode.push(elseWord, ifWord, elseIfTest) elseIfNode.push(...elseIfBlock) node.push(elseIfNode) @@ -696,7 +696,7 @@ export class Parser { if (this.is($T.Keyword, 'else') && this.nextIs($T.Colon)) { const elseWord = this.keyword('else') const elseBlock = this.block() - const elseNode = new SyntaxNode('ElseExpr', ifBlock.at(-1)!.from, elseBlock.at(-1)!.to) + const elseNode = new SyntaxNode('ElseExpr', elseWord.from, elseBlock.at(-1)!.to) elseNode.push(elseWord) elseNode.push(...elseBlock) node.push(elseNode) diff --git a/src/parser/stringParser.ts b/src/parser/stringParser.ts index d5e125c..4218b54 100644 --- a/src/parser/stringParser.ts +++ b/src/parser/stringParser.ts @@ -244,7 +244,7 @@ const findIdentifierEnd = (input: string, pos: number, maxPos: number): number = let end = pos while (end < maxPos) { - const char = input[end] + const char = input[end]! // Stop at non-identifier characters if (!/[a-z0-9\-?]/.test(char)) {