mirror of https://github.com/status-im/NimYAML.git
Merge branch 'devel'
This commit is contained in:
commit
0f4f13cee5
|
@ -1,3 +1,10 @@
|
|||
### 0.6.1
|
||||
|
||||
Bugfixes:
|
||||
|
||||
* Fixed deserialization of floats (#17)
|
||||
* Handle IndexError from queues properly
|
||||
|
||||
### 0.6.0
|
||||
|
||||
Features:
|
||||
|
|
|
@ -321,6 +321,14 @@ proc writeTagAndAnchor(target: Stream, tag: TagId, tagLib: TagLibrary,
|
|||
e.parent = getCurrentException()
|
||||
raise e
|
||||
|
||||
proc nextItem(c: var Queue, s: var YamlStream):
|
||||
YamlStreamEvent {.raises: [YamlStreamError].} =
|
||||
if c.len > 0:
|
||||
try: result = c.dequeue
|
||||
except IndexError: assert false
|
||||
else:
|
||||
result = s.next()
|
||||
|
||||
proc present*(s: var YamlStream, target: Stream, tagLib: TagLibrary,
|
||||
options: PresentationOptions = defaultPresentationOptions) =
|
||||
var
|
||||
|
@ -330,7 +338,7 @@ proc present*(s: var YamlStream, target: Stream, tagLib: TagLibrary,
|
|||
let newline = if options.newlines == nlLF: "\l"
|
||||
elif options.newlines == nlCRLF: "\c\l" else: "\n"
|
||||
while cached.len > 0 or not s.finished():
|
||||
let item = if cached.len > 0: cached.dequeue else: s.next()
|
||||
let item = nextItem(cached, s)
|
||||
case item.kind
|
||||
of yamlStartDoc:
|
||||
if options.style != psJson:
|
||||
|
|
|
@ -140,7 +140,8 @@ proc constructObject*[T: float|float32|float64](
|
|||
constructScalarItem(s, item, T):
|
||||
let hint = guessType(item.scalarContent)
|
||||
case hint
|
||||
of yTypeFloat: result = T(parseBiggestFloat(item.scalarContent))
|
||||
of yTypeFloat:
|
||||
discard parseBiggestFloat(item.scalarContent, result)
|
||||
of yTypeFloatInf:
|
||||
if item.scalarContent[0] == '-': result = NegInf
|
||||
else: result = Inf
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Package
|
||||
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
author = "Felix Krause"
|
||||
description = "YAML 1.2 implementation for Nim"
|
||||
license = "MIT"
|
||||
|
|
Loading…
Reference in New Issue