Fix endOfStream impementation
This commit is contained in:
@@ -193,13 +193,14 @@ func str*(s: string): (Parser -> ParserResult) {.inline.} =
|
||||
return p
|
||||
|
||||
proc endOfStream*(parser: Parser): ParserResult =
|
||||
if parser.state.position == parser.state.stream.len - 1:
|
||||
let index = parser.state.position + 1
|
||||
if index == parser.state.stream.len:
|
||||
ok(parser)
|
||||
else:
|
||||
err(ParserError(
|
||||
kind: endOfStringErr,
|
||||
expected: &"EndOfString",
|
||||
index: parser.state.position,
|
||||
index: index,
|
||||
parser: parser,
|
||||
))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user