Export more procs useful in low-level deserializers

This commit is contained in:
Zahary Karadjov 2019-07-18 21:20:06 +03:00
parent 73d9e0d458
commit 95bdb8acc1
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
1 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@ export
type type
JsonReader* = object JsonReader* = object
lexer: JsonLexer lexer*: JsonLexer
JsonReaderError* = object of JsonError JsonReaderError* = object of JsonError
line*, col*: int line*, col*: int
@ -88,7 +88,7 @@ proc init*(T: type JsonReader, stream: AsciiStreamVar, mode = defaultJsonMode):
proc setParsed[T: enum](e: var T, s: string) = proc setParsed[T: enum](e: var T, s: string) =
e = parseEnum[T](s) e = parseEnum[T](s)
proc requireToken(r: JsonReader, tk: TokKind) = proc requireToken*(r: JsonReader, tk: TokKind) =
if r.lexer.tok != tk: if r.lexer.tok != tk:
r.raiseUnexpectedToken case tk r.raiseUnexpectedToken case tk
of tkString: etString of tkString: etString
@ -100,7 +100,7 @@ proc requireToken(r: JsonReader, tk: TokKind) =
of tkCurlyLe: etCurrlyLe of tkCurlyLe: etCurrlyLe
else: (doAssert false; etBool) else: (doAssert false; etBool)
proc skipToken(r: var JsonReader, tk: TokKind) = proc skipToken*(r: var JsonReader, tk: TokKind) =
r.requireToken tk r.requireToken tk
r.lexer.next() r.lexer.next()