mirror of https://github.com/status-im/NimYAML.git
Revert "fix internal `IndexError` in `lex.nim` due to null term n.a."
This reverts commit e147df31718bb5bcd27c4067314dc40c2ecc9348.
This commit is contained in:
parent
e104dc351d
commit
06ddc9eb13
|
@ -218,31 +218,19 @@ proc lineWithMarker(lex: YamlLexer, pos: tuple[line, column: int],
|
||||||
lineStartIndex = lex.sSource.pos
|
lineStartIndex = lex.sSource.pos
|
||||||
lineEndIndex: int
|
lineEndIndex: int
|
||||||
curLine = lex.sSource.line
|
curLine = lex.sSource.line
|
||||||
let srcHigh = lex.sSource.src.high
|
|
||||||
if pos.line == curLine:
|
if pos.line == curLine:
|
||||||
lineEndIndex = lex.sSource.pos
|
lineEndIndex = lex.sSource.pos
|
||||||
if lineEndIndex < srcHigh:
|
while lex.sSource.src[lineEndIndex] notin lineEnd: inc(lineEndIndex)
|
||||||
while lineEndIndex < srcHigh and
|
|
||||||
lex.sSource.src[lineEndIndex] notin lineEnd:
|
|
||||||
inc(lineEndIndex)
|
|
||||||
while true:
|
while true:
|
||||||
while lineStartIndex >= 0 and
|
while lineStartIndex >= 0 and lex.sSource.src[lineStartIndex] notin lineEnd:
|
||||||
lineStartIndex < srcHigh and
|
|
||||||
lex.sSource.src[lineStartIndex] notin lineEnd:
|
|
||||||
dec(lineStartIndex)
|
dec(lineStartIndex)
|
||||||
if curLine == pos.line and lineStartIndex < srcHigh:
|
if curLine == pos.line:
|
||||||
inc(lineStartIndex)
|
inc(lineStartIndex)
|
||||||
break
|
break
|
||||||
let wasLF = if lineStartIndex > srcHigh or lineStartIndex < 0: false
|
let wasLF = lex.sSource.src[lineStartIndex] == '\l'
|
||||||
else: lex.sSource.src[lineStartIndex] == '\l'
|
|
||||||
lineEndIndex = lineStartIndex
|
lineEndIndex = lineStartIndex
|
||||||
if lineStartIndex > 0:
|
|
||||||
dec(lineStartIndex)
|
dec(lineStartIndex)
|
||||||
else:
|
if lex.sSource.src[lineStartIndex] == '\c' and wasLF:
|
||||||
break
|
|
||||||
if lineStartIndex > 0 and
|
|
||||||
lineStartIndex <= srcHigh and
|
|
||||||
lex.sSource.src[lineStartIndex] == '\c' and wasLF:
|
|
||||||
dec(lineStartIndex)
|
dec(lineStartIndex)
|
||||||
dec(lineEndIndex)
|
dec(lineEndIndex)
|
||||||
dec(curLine)
|
dec(curLine)
|
||||||
|
|
Loading…
Reference in New Issue