Commit Graph

106 Commits

Author SHA1 Message Date
Felix Krause e967038d06 Support custom types without serialize macro 2016-02-01 19:48:42 +01:00
Felix Krause 620ab55899 Added tests for ref serialization 2016-01-28 22:57:14 +01:00
Felix Krause 5162c310ce Serialization: Better proc names
* renamed serialize to serializeObject and construct to constructObject
 * added new serialize() and construct() procs that handle document
   start & end
 * re-raise AssertionError instead of swallowing it
2016-01-26 20:51:21 +01:00
Felix Krause 4c3f7cd485 Better and more system types for serialization
* Use int[8|16|32|64] and float[32|64] instead of int and float
 * Support uint[8|16|32|64]
 * Support char
2016-01-26 20:00:28 +01:00
Felix Krause 8436026250 Sanitized exception handling in serialization 2016-01-24 20:38:30 +01:00
Felix Krause 42df37bbbe Added JSON construction tests 2016-01-24 19:19:03 +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 971218314e fastparse: made it pass the parsing tests
* Scan for implicit map key as soon as a property is encountered
 * Proper handling of node properties throughout parser
 * Fixed an issue where plain scalars sometimes contained garbage
   when yielded
 * Catch reserved chars @ and `
 * Fixed some test cases
 * Made parser test cases use fastparse
2016-01-23 17:44:50 +01:00
Felix Krause 9c731cb6d1 Refactoring lexer, part 1 2016-01-15 00:06:57 +01:00
Felix Krause 56d3537920 Refactoring: Shorter type names 2016-01-14 22:51:30 +01:00
Felix Krause 551c8b0dd1 Refactoring: Extracted type guessing from lexer 2016-01-14 19:58:38 +01:00
Felix Krause 18753b1a4a Got rid of yamlWarning, use YamlPresenterError
* Added YamlWarningCallback that may be used to capture
   parser warnings
 * Removed yamlWarning as event kind
 * Replaced checks for well-formedness in presenter with asserts
 * Added checks for JSON compatibility of YamlStream in presenter
 * Added proper type hints for special float values in
   serializer to be able to check for them in the presenter
2016-01-05 19:06:55 +01:00
Felix Krause d2baa1749e Got rid of yamlError.
* Replaced yielding yamlError tokens with raising a YamlParserError
 * Renamed sequential.nim to parser.nim because it's the parser (duh)
2016-01-05 18:14:11 +01:00
Felix Krause aa98c5863e Properly handle ytsRootOnly
* Yield tag of custom type serialization when using ytsRootOnly,
   but don't yield tags of map keys or values
 * Yield proper tag of Table[K, V] serialization if requested
 * renamed dumper.nim to presenter.nim to conform to YAML spec
2016-01-04 22:18:55 +01:00
Felix Krause 507c621aaf Implemented local tags for serialization
* Fixed a bug in the lexer where an error would be raised if
   characters not allowed in tag shorthands are used in local tags
 * Fixed processing of object tags for all kinds of root nodes in Parser
 * Improved dumper to output a space after a local tag
 * Renamed some enumeration types to conform better to the YAML spec
 * Added secondaryPrefix to YamlTagLibrary
 * Added possibility to control tag output style independently from
   presentation style in serializer
 * Created local tags for all types that are serialized and use them in
   construction and serialization
2016-01-04 21:46:33 +01:00
Felix Krause a094089fb9 Various improvements
* Better JSON serialization (map bool literals to true/false if
   possible)
 * Fixed a problem where the tag of block sequence would be
   wrongly placed
 * Always output "" when dumping empty strings
 * Added helper functions to create YamlStreamEvents.
 * Moved procs for YamlStreamEvents to private/events.nim
 * renamed dump() to present()
 * Added dump() and load() to yaml.serialization
2015-12-29 18:22:55 +01:00
Felix Krause 9ff93efb11 Implemented basic serialization
* added serialize() procs for some basic types
 * extended make_serializable to generate serialize() proc
2015-12-29 16:10:47 +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 d828f4ddc5 Added benchmark. Fixed processing empty flow sets. 2015-12-29 00:14:47 +01:00
Felix Krause 238faf82ab Source restructuring, added config.nims
* moved src/* to .
 * added config.nims to build library and run tests
 * reduced compiler warnings
2015-12-28 22:03:16 +01:00
Felix Krause b1e828eae6 Added documentation comments 2015-12-27 23:40:27 +01:00
Felix Krause f2527efd46 Support additional boolean scalars
* on, off, yes, no, literals with leading or complete capital letters
 * added documentation
2015-12-27 21:36:47 +01:00
Felix Krause 2c9d065ecb Support tags for sequences and maps in block style 2015-12-27 17:37:42 +01:00
Felix Krause d7f1e726ab Added dump() and transform()
* Added a hint "mapMayHaveKeyObjects" to yamlMap
 * Added dumper.nim
 * Improved generated documentation a bit
2015-12-27 16:36:32 +01:00
Felix Krause 075cf8b8ef Worked on tag URI interface
* Added YamlTagLibrary
 * adhere to explicit tags in JSON
 * Fixed lexer type hints before YAML flow special characters
2015-12-26 18:40:23 +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 c83d488886 Added JSON compositor. 2015-12-24 15:21:49 +01:00
Felix Krause e307cbbad5 Pipe type hints through parser. Fixed bugs. 2015-12-23 18:12:51 +01:00
Felix Krause ffcbbf89e6 Restructured source code 2015-12-23 12:35:07 +01:00
Felix Krause 5c0e9f570b Added type hinting in lexer 2015-12-23 10:28:58 +01:00
Felix Krause a9a1a67bc6 Support anchors on empty nodes 2015-12-22 23:35:03 +01:00
Felix Krause 545bff673a Support missing keys/values in maps 2015-12-22 22:28:27 +01:00
Felix Krause ca077e54ca Allow mixing explicit and implicit map keys 2015-12-22 21:08:58 +01:00
Felix Krause c1880b5117 Support tag handle after directives end 2015-12-22 18:51:16 +01:00
Felix Krause f249813b90 Implemented alias resolution
* Parse alias nodes properly
 * Fixed a bug that prevented you from having objects as map keys
 * Use AnchorId for reporting anchors instead of strings
 * Do not use nil strings for anchor and tag
2015-12-22 16:28:35 +01:00
Felix Krause f320449a2d Got tags working 2015-12-21 23:10:42 +01:00
Felix Krause 32f36515e7 Return TagIds instead of strings 2015-12-21 21:58:28 +01:00
Felix Krause 70597105cb Worked on tags
* introduced YamlSequentialParser object that stores
   all known tag URIs
 * Added procs for registering and querying tag URIs
 * Return non-specific tags instead of nil if no tags
   exist in source
2015-12-21 21:40:27 +01:00
Felix Krause edec7ece37 Implemented block scalars 2015-12-17 21:44:41 +01:00
Felix Krause 3ca3081e92 Added support for multiline plain scalars 2015-12-14 21:26:34 +01:00
Felix Krause b56f9cb537 Refactoring of parser. 2015-12-11 22:55:21 +01:00
Felix Krause 01416f61be Improved mixing block and flow content 2015-12-10 23:02:06 +01:00
Felix Krause ed7176131e Implemented flow style parsing
* Fixed lexer error where comma did not get properly processed
 * Implemented flow style in parser
 * Added tests
2015-12-10 22:28:57 +01:00
Felix Krause e642e41f90 Bug fixes in lexer and parser
* Lexer: column now always points to start of token
 * Lexer: added ability to compile with -d:yamlDebug for debug output
 * Parser: Correctly handle nested sequences and maps
 * Tests: Added parser tests for nested objects
2015-12-10 20:53:43 +01:00
Felix Krause 73ce41bbef Added parsing tests; got basic parsing working 2015-12-07 22:09:57 +01:00
Felix Krause ada4a36e6e Lexer: Fixed parsing verbatim tags 2015-12-07 19:09:02 +01:00
Felix Krause 26c1c07567 No position in token; line and column in lexer 2015-11-30 20:36:55 +01:00
Felix Krause 9a3cf9a524 Renamed *LexerEvent* to *LexerToken* 2015-11-30 19:52:01 +01:00
Felix Krause 8493015042 Implemented anchors and aliases 2015-11-29 22:43:10 +01:00
Felix Krause f876c845b7 Own token kinds for every special char, more tests 2015-11-29 22:27:05 +01:00
Felix Krause 71456c6bed Fixed unicode escaping; added tests 2015-11-29 21:01:22 +01:00
Felix Krause f793247a41 Fixed line break handling 2015-11-29 16:50:27 +01:00
Felix Krause 9cba968c1e Separation between directives and content; tests 2015-11-29 15:42:41 +01:00
Felix Krause a7c159933b Initial commit 2015-11-27 23:42:11 +01:00