Commit Graph

85 Commits

Author SHA1 Message Date
Felix Krause cde346b85c Switched to indentation of 2 spaces 2016-04-02 17:48:22 +02:00
Felix Krause 5ec086081c Implemented serialization of OrderedMap 2016-03-25 22:22:42 +01:00
Felix Krause 42ddfbe5c5 Fixes #13.
* Separated into representObject and in representChild and
   representObject. Makes it possible for multiple types to
   use the same representObject proc.
2016-03-25 21:27:41 +01:00
Felix Krause 28ccdcc5a6 Handle block scalars line-per-line. Fixes #10 2016-03-25 18:17:37 +01:00
Felix Krause 4d4e3c94e1 Added fplDocument, fixes #11
* Do not use -1 for unknown indentation, because the document level is -1.
 * Use const UnknownIndentation in code instead of magic number
 * Added fplDocument level which is used as root of the ancestry
 * Added debugFail() template to better locate internal errors
2016-03-19 22:45:24 +01:00
Felix Krause ae933d90a1 Fixes to block scalars and yamlTestSuite
* Properly handle empty block scalars and trailing lines
 * Fixed a bug in yamlTestSuite that led to lots of open file handles
2016-03-18 22:29:35 +01:00
Felix Krause 1c61486739 Fixed small bugs
* allow '!' at beginning of tag URI in %TAG directive
 * recognise \t as start of more indented line in block flow scalar
 * Made testEventParser more robust
2016-03-16 19:20:18 +01:00
Felix Krause 9c251584a0 Fixed YAML test suite to conform to naming changes 2016-03-14 18:20:20 +01: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 afc5306da5 event parser: support \b and \t escape sequences 2016-03-11 17:58:15 +01:00
Felix Krause de7f821696 Improved YAML test suite integration
* Support for anchors and aliases
 * Continue with next test on exception
 * Better naming
2016-03-09 20:15:43 +01:00
Felix Krause 121492d4c6 Support updated yaml-dev-kit data layout 2016-03-04 21:23:13 +01:00
Felix Krause 778799e4ff Added option to validate against YAML test suite 2016-03-04 19:10:48 +01:00
Felix Krause 5933605591 Added copyright notices to files where missing 2016-02-27 13:09:50 +01:00
Felix Krause 46913867e2 Presenter: Let user decide about newline style
* Added PresentationOptions object; merged PresentationStyle,
   indentationStep and NewLineStyle in it
 * Updated signatures of relevant procs
 * Implemented user-defined newline style in presenter
2016-02-26 21:55:59 +01:00
Felix Krause 349cb19912 Refactoring of serialization code
* Made some procs/templates private that have been public without need
 * Improved documentation of procs
2016-02-26 21:13:40 +01:00
Felix Krause c9dae4430c Fixes #5 2016-02-25 21:16:03 +01:00
Felix Krause 27670f63c9 Implemented and documented DOM 2016-02-22 21:56:30 +01:00
Felix Krause 33a7f93480 Code cleanup; reduced compiler hints 2016-02-19 18:25:01 +01:00
Felix Krause f2f340c0b6 Fixes #2 2016-02-19 17:31:57 +01:00
Felix Krause 43e10f496a Fixes #3 2016-02-18 22:32:25 +01:00
Felix Krause bc9229d0c5 Fixes #1 2016-02-18 22:14:24 +01:00
Felix Krause 9be97ff386 Added constructChild for better serialization.
- Handle tag and anchor checks and ref types in constructChild
 - Added tests for using custom representObject and constructObject
   procs
 - Code cleanup
2016-02-16 19:24:55 +01:00
Felix Krause 0a7f87a539 Improved docs. Fixed serialization problem.
* Added serialization.txt to doc
 * Fixed rendering problem in api.txt
 * Use explicit tag when ref type renders to a scalar that can be
   parsed to !!null
 * Added test cases for this ref type fix
2016-02-15 22:54:05 +01:00
Felix Krause 02e505959a Added setTagUriForType. Used it. Improved docs. 2016-02-15 19:46:21 +01:00
Felix Krause 325e3ec18f Made serialization part of yaml. Improved doc. 2016-02-12 20:44:38 +01:00
Felix Krause c6c13eb044 Better doc index. YamlStream now an object.
* Also various fixes to serialization and presentation
2016-02-12 19:53:25 +01:00
Felix Krause 32c42054f7 Renamed serialize() to represent() to better conform to YAML spec 2016-02-02 18:19:40 +01:00
Felix Krause e89a9a5b14 Serialization: Support enum types 2016-02-01 20:16:35 +01:00
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