diff --git a/CHANGELOG.md b/CHANGELOG.md index 734c487..5a63155 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +### 0.6.2 + +Bugfixes: + + * Fixed problem when serializing a type that overloads the `==` operator (#19) + * Fixed type hints for floats (`0` digit was not processed properly) + ### 0.6.1 Bugfixes: diff --git a/private/hints.nim b/private/hints.nim index ab141e7..f3bf71e 100644 --- a/private/hints.nim +++ b/private/hints.nim @@ -14,18 +14,18 @@ type ythOF, ythOFF, ythT, ythTR, ythTRU, ythTRUE, ythY, ythYE, ythYES, - + ythPoint, ythPointI, ythPointIN, ythPointINF, ythPointN, ythPointNA, ythPointNAN, - + ythLowerFA, ythLowerFAL, ythLowerFALS, ythLowerNU, ythLowerNUL, ythLowerOF, ythLowerTR, ythLowerTRU, ythLowerYE, - + ythPointLowerIN, ythPointLowerN, ythPointLowerNA, - + ythMinus, yth0, ythInt, ythDecimal, ythNumE, ythNumEPlusMinus, ythExponent macro typeHintStateMachine(c: untyped, content: untyped): stmt = @@ -33,7 +33,7 @@ macro typeHintStateMachine(c: untyped, content: untyped): stmt = result = newNimNode(nnkCaseStmt, content).add(copyNimNode(c)) for branch in content.children: assert branch.kind == nnkOfBranch - var + var charBranch = newNimNode(nnkOfBranch, branch) i = 0 stateBranches = newNimNode(nnkCaseStmt, branch).add( @@ -77,6 +77,7 @@ template advanceTypeHint(ch: char) {.dirty.} = of '0': [ythInitial, ythMinus] => yth0 [ythNumE, ythNumEPlusMinus] => ythExponent + [ythInt, ythDecimal, ythExponent] => nil of '1'..'9': [ythInitial, ythMinus] => ythInt [ythNumE, ythNumEPlusMinus] => ythExponent diff --git a/private/serialization.nim b/private/serialization.nim index 2ea7eb3..3d47c08 100644 --- a/private/serialization.nim +++ b/private/serialization.nim @@ -729,7 +729,7 @@ proc representChild*[T](value: seq[T], ts: TagStyle, c: SerializationContext): proc representChild*[O](value: ref O, ts: TagStyle, c: SerializationContext): RawYamlStream = - if value == nil: + if isNil(value): result = iterator(): YamlStreamEvent = yield scalarEvent("~", yTagNull) elif c.style == asNone: result = representChild(value[], ts, c) diff --git a/yaml.nimble b/yaml.nimble index b45bf68..eb5f80f 100644 --- a/yaml.nimble +++ b/yaml.nimble @@ -1,6 +1,6 @@ # Package -version = "0.6.1" +version = "0.6.2" author = "Felix Krause" description = "YAML 1.2 implementation for Nim" license = "MIT"