99 Commits

Author SHA1 Message Date
Felix Krause
3e2f92c753 Fixed a bug in float deserialization.
* fixes #124
2022-09-07 16:54:11 +02:00
Felix Krause
7942e0a650 Fixed a bug in uint deserialization.
* fixes #123
2022-09-07 16:50:45 +02:00
Felix Krause
4ca3239e14 Fixed error handling for previous feature
* ref #117
2022-09-07 16:38:11 +02:00
Felix Krause
7bd562e37e Fixes and improvements to DOM API.
* added loadFlattened. Fixes #117
 * fixed an error where recursive nodes were not loaded
   properly into YamlNodes.
 * made dump with asNone raise an error when a cycle is
   encountered, instead of running into an endless loop.
2022-09-07 16:23:50 +02:00
Felix Krause
741fd18047 Deprecated DOM API, YamlNode now supported by serialization API
* implements #48
 * also fixes #108
 * updated docs
2022-06-05 12:27:19 +02:00
Felix Krause
e33c448783 up Readme, +funding, v0.16.0 2021-10-22 18:36:29 +02:00
quantimnot
75ed8e5be4
Change serialization to omit none(T) fields of sparse objects (#100)
* Change serialization to omit `none(T)` fields of sparse objects

Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
2021-10-22 17:54:40 +02:00
Felix Krause
10cc4d3026 repaired raise annotations in serialization. Fixes #99 2021-09-06 12:37:19 +02:00
Felix Krause
1346467b42 fixes #93 2021-05-18 00:31:47 +02:00
Felix Krause
a72966374f fixes #90 2021-05-18 00:28:24 +02:00
Felix Krause
f123924d32 fix for --gc:orc; some memory improvements 2021-05-17 23:51:35 +02:00
Felix Krause
329e18e44c removed obsolete TagLibrary type. control tag directives when dumping. fixes #95 2021-03-23 18:51:05 +01:00
flyx
03ecab0075
fix bool serialization
output `true` or `false` instead of `y` and `n` to comply with the YAML 1.2 spec.
2021-03-23 13:20:48 +01:00
Felix Krause
f79774e766 updated raises annotations 2020-11-10 21:28:56 +01:00
Felix Krause
e3e810fce0 all tests green again 2020-11-10 19:07:46 +01:00
Felix Krause
9d92e8a2c5 all serialization tests green again 2020-11-10 15:40:01 +01:00
Felix Krause
4305bccbf0 made anchor resolution during deserialization safer 2020-11-10 14:48:19 +01:00
Felix Krause
aa65c066d5 changed TagId to Tag. removed JS stuff that wasn't working anyway. 2020-11-10 13:55:22 +01:00
Felix Krause
6238104622 started making serializationTests green again 2020-11-06 21:39:50 +01:00
Felix Krause
48d601d959 parser tests working, other tests compiling 2020-11-06 16:21:58 +01:00
Felix Krause
e2f8e6419e lots of fixes for parser, started updating serialization 2020-11-05 20:23:42 +01:00
Felix Krause
ae4c097a25 fixed parser test framework; started making parser tests green 2020-11-04 22:47:52 +01:00
Felix Krause
4c604b09df made lexer & parser tests compile (not succeed) again 2020-11-04 16:40:37 +01:00
Felix Krause
1d707b184e started updating other parts of the codebase 2020-11-03 22:08:21 +01:00
narimiran
c339661a6f fix deprecated stuff 2020-07-22 13:52:44 +02:00
Felix Krause
951efdf18e added {.sparse.}. fixes #82 2020-06-26 23:21:22 +02:00
Felix Krause
bce3981849 replaced field/object macros with annotations; fixes #66 2020-06-26 21:29:41 +02:00
flyx
1dfc2a3333 Implemented Option serialization. Fixes #78 2020-03-08 19:58:02 +01:00
Felix Krause
f8b264f992 Fixes #76 2019-11-30 13:16:40 +01:00
k0zmo
0336d06114 Disallow deserialization of object variants with multiple object branches 2019-07-06 11:14:34 +02:00
k0zmo
fd4a718586 Adhere to new rules of object variants (re)initialization 2019-07-06 11:14:34 +02:00
Marcus Eriksson
90f47e1043 Only include the type name in the error message 2019-07-06 11:14:34 +02:00
Marcus Eriksson
ef2b2e9ae7 Fixes for Nim v0.20.0
The breaking changes affecting this library are:

* Macro arguments of type typedesc are now passed to the macro as
  NimNode like every other type except static. Use typed for a behavior
  that is identical in new and old Nim. See the RFC Pass typedesc as
  NimNode to macros for more details.
  (https://github.com/nim-lang/RFCs/issues/148)

* case object branch transitions via system.reset are deprecated.
  Compile your code with -d:nimOldCaseObjects for a transition period.

  The solution here is to compile with '-d:nimOldCaseObjects' for the
  time being. I didn't understand how to modify the code to adhere to
  the new way of initializing/changing variant objects.

* The compiler now enforces range checking which exposed a bug in the
  fieldCount proc. For variant objects where one of the branches is
  given on one line, e.g.

    ...
    of akDog: barkometer: int
    ...

  the field wasn't counted and the total field count was not accurate.
2019-07-06 11:14:34 +02:00
Vindaar
407b10be66 do not construct empty seq for yamlScalar 2018-10-12 16:00:39 +02:00
Vindaar
446493ded8 replace newException by constructionError call if int too large
If an integer doesn't fit into the target type an exception is thrown.
2018-10-12 16:00:39 +02:00
Vindaar
53c476ce38 remove unnecessary if branch related too seq construction
Not needed anymore, since seqs can never be nil nowadays.
2018-10-12 16:00:39 +02:00
Vindaar
81e50d73d9 remove commented out old code 2018-10-12 16:00:39 +02:00
Vindaar
253a4623e4 circumvent RangeError, which will be wrongly caught
Converting an integer via `T(number)` to some integer will cause a
range error, if it doesn't fit. Maybe it didn't in the past, which is
why the code worked before? Some other error was thrown?
With this code anyway it crashed, because it threw an internal error.
2018-10-12 16:00:39 +02:00
Vindaar
4821ef95fb [soft] take out yTagNimNilString/Seq and related (?) nil tests 2018-10-12 16:00:39 +02:00
Vindaar
7ad13d98d9 force vals in quote do to bool due to compile time when changes 2018-10-12 16:00:39 +02:00
Vindaar
011c99270f fix regression in times.parse syntax due to changes in times module
Probably due to the changes in the times module, the old syntax throws
an error now.
2018-10-12 16:00:39 +02:00
Vindaar
890bbed5ed further nil fixes in tojson and serialization 2018-10-12 16:00:39 +02:00
Alexander Ivanov
566e28dcc5 Make it work with new not nil 2018-10-12 16:00:39 +02:00
Alexander Ivanov
ba53fc0494 Load 0 fix #60 2018-08-30 09:21:30 +02:00
Marcus Eriksson
2328289dba Fixes #54 2018-05-29 19:12:03 +02:00
Jacob MacDonald
4933194dd6 Fix for newer versions of compiler.
61720e0df9475af647de171f6b2964c36234961a in the Nim compiler introduced the bug
in this project. In brief, the upstream change flattens `nnkStmtList`s of one
item. Thus, `quote do:` followed by one statement is no longer a nnkStmtList
but whatever that one statement is. This breaks several macro implementations
where a `quote do:` form is initialized and then appended to. Based on Araq's
feedback (https://irclogs.nim-lang.org/02-10-2017.html#21:01:26), these
single-statement quotes are now converted into one-element statement lists as
necessary (behavior on old versions of the compiler is maintained).
2017-10-03 15:59:45 +02:00
Felix Krause
8d8464da71 Fixes #43 2017-09-20 18:58:09 +02:00
Felix Krause
37031c4c80 make tests green again 2017-08-30 18:11:18 +02:00
Felix Krause
ff86083461 Fixes #44 2017-08-30 18:04:52 +02:00
Felix Krause
f07cf173dc Fixed to previous JS adjustments 2017-03-30 17:58:53 +02:00