Commit Graph

20 Commits

Author SHA1 Message Date
Felix Krause f60725fc93 Made loading work at compile time
* dumping doesn't work at CT
 * timestamps don't work at CT
 * aliases don't work at CT
 * renamed tserialization -> tnative to mirror rename of native.nim file
 * added comptime tests to tnative, currently only execute when doing
   nim nativeTests, because of compiler bug
 * Fixes #70, #91
2023-08-30 21:14:31 +02:00
Felix Krause 940675a52e Reworked loading API
* moved load procs to yaml/loading.nim
 * moved input YamlStream into ConstructionContext
 * made ConstructionContext a non-ref object
 * harmonized code style & comments
 * renamed yaml/serialization.nim to yaml/native.nim
2023-08-29 23:23:15 +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
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 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 d20707c4e4 disable DOM API when using ARC (ref #85) 2021-05-18 00:42:58 +02:00
Felix Krause bce3981849 replaced field/object macros with annotations; fixes #66 2020-06-26 21:29:41 +02:00
Felix Krause 846b836e92 Integrated parser and quickstart tests
* Now executed when calling `nim tests`
 * Refactored parser tests to use unittest
 * Fixed some pwd issues in tests
2016-10-09 15:05:18 +02:00
Felix Krause 8b3f8f5282 Made test names more consistent 2016-09-20 19:22:31 +02:00
Felix Krause 2bb7f45354 Improved tests, benchs, shallowCopies 2016-09-14 18:31:09 +02:00
Felix Krause 16d1a1bceb Various code style and naming fixes
* Renamed some symbols for consistency, fixes #6:
   - yamlStartSequence -> yamlStartSeq
   - yamlEndSequence   -> yamlEndSeq
   - yamlStartDocument -> yamlStartDoc
   - yamlEndDocument   -> yamlEndDoc
   - yTagMap           -> yTagMapping
 * Improved code formatting at some places
 * Fixed code documentation at some places
 * Added generic objects to TODO list
 * Removed obsolete parsing tests, these are superseeded
   by yaml-dev-kit test suite integration
2016-03-14 18:10:34 +01:00
Felix Krause 5933605591 Added copyright notices to files where missing 2016-02-27 13:09:50 +01:00
Felix Krause 27670f63c9 Implemented and documented DOM 2016-02-22 21:56:30 +01:00
Felix Krause a08f4c1e4e Sanitized exceptions and raises pragmas
* Added raises pragma to every proc in yaml.nim
 * Properly encapsulate exceptions from YamlStreams
 * Discovered a Nim compiler bug and added a workaround
 * Added possibility to query line, column and line content from
   YamlParser
 * Updated rst documentation
 * Actually call callback in fastparse if available
 * Fixed parsing YAML version
2016-01-24 18:24:09 +01:00
Felix Krause fdcc699768 Removed old lexer/parser impl in favor of new one
* fastparse now used for everything
 * private/[lexer|parser].nim gone
 * Made fastparse use YamlParser object
 * Got all tests working with fastparse
 * Some more smaller changes to API
2016-01-24 11:44:10 +01:00
Felix Krause dc1a3c0fe2 Can construct basic types and custom objects
* Added construct() procs for some basic types
 * Added macro make_serializable
2015-12-29 15:09:37 +01:00
Felix Krause ca0f5d1741 Refactoring, less heap objects
* YamlParserEvent -> YamlStreamEvent
 * YamlStreamEvent is no longer a `ref` object. Test suite now
   runs in a small fraction of a second (compared to several
   seconds before)
 * Introduced YamlStream
2015-12-26 13:39:43 +01:00
Felix Krause 2c4e681f0b Finished JSON parser. Restructuring.
* Made JSON parser resolve anchors and aliases
 * Moved exported consts and types to yaml.nim
2015-12-26 13:16:57 +01:00
Felix Krause 73ce41bbef Added parsing tests; got basic parsing working 2015-12-07 22:09:57 +01:00
Felix Krause 9cba968c1e Separation between directives and content; tests 2015-11-29 15:42:41 +01:00