Commit Graph

191 Commits

Author SHA1 Message Date
Felix Krause 18fc8ba3f5 Reworked dumping API
* removed default value objects,
   use Nim2 default vaules for fields instead.
 * moved dump procs to yaml/dumping and introduced Dumper
 * modified serialization procs to use ctx as first argument,
   so that prefix calls can be used
 * changed defaults for presentation to be more like other
   YAML implementations, e.g. no directives by default.
 * Removed deprecated procs in DOM API
 * Removed PresentationStyle – use the setXStyle procs of Dumper
   instead.
 * Fixed some warnings emerging from transitioning to Nim2
2023-08-29 20:46:26 +02:00
Felix Krause 189844a72b Rewrote large parts of presenter
* PresentationOptions has gained more fine-tuning options:
   * directivesEnd: specifies when `---` is written. ref #135
   * containers: specifies whether containers use block or flow style
   * suppressAddrs: if set, suppresses output of attributes
   * quoting: specifies how strings should be quoted
   * condenseFlow: specifies whether flow sequences should be on a
     single line
   * explicitKeys: specifies whether mapping keys should always have '?'
 * PresentationStyle is now a list of presets that set
   multiple options in PresentationOptions.
 * Does not output trailing spaces anymore. ref #135
 * Writes compact notation, i.e. a mapping in a sequence starts on the
   line with the sequence's `-`, unless attributes are written
 * Added tests for the presenter
 * Existing code might change behavior because of whitespace, `---` and
   compact notation. The API has been extended so that existing code is
   affected as little as possible.
2023-07-31 19:16:24 +02:00
Felix Krause 84e59c16d4 fixed tjson to conform to new type hints 2023-04-10 17:18:14 +02:00
theamarin ee7dc11a90
Adapt type hinting to Yaml 1.2.2 (#132)
Updated type hinting for YAML 1.2.

 * previously outdated regexes from YAML 1.1 were used.
 * removed special cases for leading zeros that are not part of YAML 1.2.
 * updated literal regexes for infinity, NaN and boolean values.
 * added tests for type hinting

Co-authored-by: theamarin <theamarin@thecreation.de>
2023-04-10 17:17:03 +02:00
Felix Krause 576cf11d81 Can load fields of parent types. ref #131
* dumping fields of parent types not working yet
2023-04-04 19:29:20 +02:00
Felix Krause 39444f6536 Consolidated exceptions 2023-03-18 13:54:45 +01:00
Felix Krause 034b9b8453 Reworked some exceptions and compiler warnings
* LexerError is properly rewritten as YamlParserError in parser
 * updated some code to remove warnings and hints that got emitted
 * Fixes #129
2023-03-13 22:06:07 +01:00
Felix Krause 300dbce72a Updated test suite, fixed lexer issues 2023-03-10 22:21:18 +01:00
Felix Krause 5f7677d914 Improved presenter.
* added maxLineLength to PresentationOptions. Fixes #119
 * write a newline to the end of the document.
   required for the output files to be POSIX-compliant text files.
   also improves QoL when dumping to stdout.
2022-09-07 15:15:55 +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 c681498701 updated tests, fixed problems 2021-10-22 17:42:48 +02:00
Felix Krause c1cc0be3f3 fixed lexer errors discovered by new parser tests 2021-10-22 17:22:43 +02:00
Felix Krause 386d516770 updated yaml-test-suite 2021-10-21 17:37:51 +02:00
Felix Krause d20707c4e4 disable DOM API when using ARC (ref #85) 2021-05-18 00:42:58 +02:00
Felix Krause 329e18e44c removed obsolete TagLibrary type. control tag directives when dumping. fixes #95 2021-03-23 18:51:05 +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 2840d4d654 made lexer tests green again 2020-11-04 19:32:09 +01:00
Felix Krause 4c604b09df made lexer & parser tests compile (not succeed) again 2020-11-04 16:40:37 +01:00
Felix Krause 05b8528f3e translated parser from AdaYaml 2020-11-03 21:17:31 +01:00
Jakob Homan d173f2a7f6 Correct command is nim test rather than nim tests. 2020-10-05 10:38:04 +02: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
k0zmo fd4a718586 Adhere to new rules of object variants (re)initialization 2019-07-06 11:14:34 +02:00
Vindaar 8a7750cb6c make sure to also append '\0' for JS as well as C backend
Also remove now unnecessary `os` (was imported for internal
`assertStringEqual` test) module import in `tserialization`.
2018-10-12 16:00:39 +02:00
Vindaar 2d47de8c4e ignore yaml test suite case 'S98Z' 2018-10-12 16:00:39 +02:00
Vindaar a211eab2c6 whitespace removal to get rid of 'number of spaces around...'
Since whitespace wasn't aligning all `==` anyways, removal seems fine.
2018-10-12 16:00:39 +02:00
Vindaar da9396a2f3 remove internal string assert test 2018-10-12 16:00:39 +02:00
Vindaar ebe4201cbc replace `assertStringEqual` by version checking for content and len
Now check for content *and* length of the strings in
`tserialization`. Also adds a test case for the case with which the
old version would have failed (one string longer than the other, thus
being different).

This version tries to keep the error reporting mechanism the same as
the old version.
2018-10-12 16:00:39 +02:00
Vindaar 81e50d73d9 remove commented out old code 2018-10-12 16:00:39 +02:00
Vindaar 9a445c18bb fix `assertStringEqual` to make sure not to access null terminator 2018-10-12 16:00:39 +02:00
Vindaar f290876df7 replace `echo` + `quit(1)` by error call in `tquickstart.nim`
The call to `quit 1` failed on my machine. Hence use macros.error.
2018-10-12 16:00:39 +02:00
Vindaar fb13dc1627 further `isNil` checks in `tserialization` fixed 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
Felix Krause e7e532ccb8 Version 0.10.3 2017-09-20 19:04:57 +02:00
Felix Krause af58ab68de Version 0.10.2 2017-08-30 18:14:08 +02:00
Felix Krause 37031c4c80 make tests green again 2017-08-30 18:11:18 +02:00
Felix Krause 0f2dba1a65 make tests green again; final fix for 0.17.0 2017-07-10 20:31:40 +02:00
Felix Krause 2bb32139c4 Added `+DOC ---` event output. Fixed parserTests 2017-02-14 22:06:48 +01:00
Felix Krause 5ebde01ca5 Made tjson and tserialization compile for JS 2017-02-13 17:10:56 +01:00
Felix Krause acf9e32fab Finally fixed travis build
* Insulting comment on Travis and the universe in general here.
2017-02-06 21:41:43 +01:00
Felix Krause 0ef9cbf535 Moved private sources to yaml/private 2017-02-06 20:39:04 +01:00