Export more procs useful in low-level deserializers
This commit is contained in:
parent
73d9e0d458
commit
95bdb8acc1
|
@ -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()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue