fix: consistent range syntax parsing, #791

This commit is contained in:
Harttle
2025-01-19 17:58:00 +08:00
committed by Jun Yang
parent a5070af3e4
commit a490a70da1
3 changed files with 28 additions and 7 deletions
+4 -2
View File
@@ -391,9 +391,11 @@ export class Tokenizer {
if (this.peek() !== '(') return
++this.p
const lhs = this.readValueOrThrow()
this.p += 2
this.skipBlank()
this.assert(this.read() === '.' && this.read() === '.', 'invalid range syntax')
const rhs = this.readValueOrThrow()
++this.p
this.skipBlank()
this.assert(this.read() === ')', 'invalid range syntax')
return new RangeToken(this.input, begin, this.p, lhs, rhs, this.file)
}