Commit Graph

191 Commits

Author SHA1 Message Date
Felix Krause 608d9ef090 Fixed path due to staticExec changes in Nim 0.16.0 2017-01-12 11:19:02 +01:00
Felix Krause 737d326e7a Improved test code 2017-01-10 11:35:19 +01:00
Felix Krause c2041b44d1 Updated tests to use yaml-test-suite repo url 2016-12-12 19:29:39 +01:00
Felix Krause 9b5d0e60c6 Updated yaml-dev-kit test data parser 2016-12-05 19:22:51 +01:00
Felix Krause 36bdf5ba79 Reverted unnecessarily commited file 2016-11-30 22:02:09 +01:00
Felix Krause 44ca31b1e2 Empty documents always contain an empty scalar 2016-11-30 21:58:46 +01:00
Felix Krause 927de32d8d Reverted accidentally commited changes 2016-11-30 18:05:47 +01:00
Felix Krause 5e00d714eb Do not assume RecLists everywhere. Fixes #31 2016-11-30 18:01:03 +01:00
Felix Krause 84d4127caf Improved DOM API
* yMapping is now a Table
 * changed names to match those of the json module
 * implemented procs to easier get and set values
2016-11-28 20:17:04 +01:00
Felix Krause a51befe30d Improved float parsing
* Fixed #30
 * Accept underscores in float literals
 * Added test
2016-11-10 10:12:32 +01:00
Felix Krause 64f68ae1af Implemented !!timestamp 2016-11-08 21:13:01 +01:00
Felix Krause dcfa8fd27c Implemented ignoreInputKey 2016-10-27 17:58:14 +02:00
Felix Krause 6402433d2a Implemented setDefaultValue. 2016-10-26 18:32:54 +02:00
Felix Krause 9290ca0d91 Load objects with transient fields 2016-10-19 22:04:46 +02:00
Felix Krause 3ab3dc7ad0 Dump variant objects with transient fields
* tuples not working yet
 * loading not woring yet
 * added tests
2016-10-15 17:58:29 +02:00
Felix Krause 29352fa4fe Use global tag handle for NimYAML
* NimYAML now uses the tag prefix tag:nimyaml.org,2016:
 * That tag handle is shortened to !n! when presenting
 * Also fixed some minor bugs dealing with tag handles
2016-10-10 20:16:54 +02:00
Felix Krause 98c16afb47 This might finally fix travis 2016-10-09 15:53:47 +02:00
Felix Krause ea90b4d2db Debugging remaining travis issues 2016-10-09 15:42:43 +02:00
Felix Krause 636ee81295 Still working on travis 2016-10-09 15:37:20 +02:00
Felix Krause e1f3ac9b07 Another try to fix travis build 2016-10-09 15:30:50 +02:00
Felix Krause d2e5c9e0a9 Hopefully fixes travis build 2016-10-09 15:21:27 +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 4bde3a7986 Fixed issues in quickstart and taglib
* Updated expected YAML in 02
 * Fixed duplicate TagIds in taglib
2016-10-09 11:48:52 +02:00
Felix Krause 0f2e077b87 Added automatic test for quickstart snippets
* There are errors which indicate real bugs!
2016-10-08 23:35:33 +02:00
Felix Krause 3942e80d9b Improved error messages and test them. 2016-09-24 16:45:49 +02:00
Felix Krause 2ad41d349e Improved and fixed issues with error reporting 2016-09-23 15:42:24 +02:00
Felix Krause d987b607e5 Check for custom object errors when loading
* Ensure no duplicate fields
 * Ensure no missing fields
 * Ensure no unknown fields
 * Implemented for both tuples and objects,
   including variant objects
2016-09-21 15:40:03 +02:00
Felix Krause 12960b2e31 Restructuring: no more includes 2016-09-20 21:53:38 +02:00
Felix Krause 8b3f8f5282 Made test names more consistent 2016-09-20 19:22:31 +02:00
GaveUp 6f8dfdcd00 Code cleanup per comments 2016-09-19 15:51:33 -05:00
GaveUp 2c470c8aa9 Add octal/hex support. Add multi doc support. 2016-09-19 14:40:03 -05:00
Felix Krause 2f3a809738 Support JS string output in presenter 2016-09-19 19:33:29 +02:00
Felix Krause 2bb7f45354 Improved tests, benchs, shallowCopies 2016-09-14 18:31:09 +02:00
Felix Krause 92504c1893 JSON tests working again. Other tests TODO 2016-09-13 10:39:54 +02:00
Felix Krause 92f5a7a6fd got parse.nim to compile again
* it is still pretty broken
2016-09-12 21:38:56 +02:00
Felix Krause a1f900ae44 Enhanced empty line processing 2016-09-11 19:20:02 +02:00
Felix Krause b9286fa550 Implemented lookahead 2016-09-11 18:23:47 +02:00
Felix Krause 4e97e53489 Implemented anchors and aliases 2016-09-11 13:04:10 +02:00
Felix Krause 4d1a444f61 Implemented tag handles 2016-09-11 12:52:24 +02:00
Felix Krause 279d233c4f Implemented adjacent values in flow style 2016-09-11 12:13:51 +02:00
Felix Krause 383f1ab016 Made lexer non-generic 2016-09-11 11:28:05 +02:00
Felix Krause 8e7b3b32bb lexer: Flow indicators 2016-09-10 17:33:58 +02:00
Felix Krause ba02b41555 lexer: worked on block scalars and stuff 2016-09-10 17:19:37 +02:00
Felix Krause 79f432a27d lexer: implemented quoted scalars 2016-09-10 13:38:42 +02:00
Felix Krause 68a157e173 First compiling version (incomplete) 2016-09-10 12:38:03 +02:00
Felix Krause d51872f9e7 Started work on new lexer 2016-09-10 10:30:40 +02:00
Felix Krause ad18db5113 Do not use first class iterators in serialization
* needed for JS backend
2016-09-01 20:56:34 +02:00
Felix Krause 34cbe61479 Got rid of lots of compiler warnings 2016-08-17 22:50:37 +02:00
Felix Krause 01b34290b7 Parser refactoring
* refactored parser to not use first class iterators
   (not available for JS backend)
 * Current state misses flow style handling and fails tests
2016-08-15 21:30:49 +02:00
Felix Krause 7cad7b5478 Fixed and properly implemented variant objects 2016-06-08 19:15:50 +02:00
Felix Krause 273093e390 improved setTagUri
* renamed setTagUriForType to setTagUri
 * generated TagId is now const (can be used in case etc)
 * Uses compile-time counter independent from tag library
2016-04-21 18:58:53 +02:00
Felix Krause 4ca4b2c87e Support nil strings and seqs 2016-04-04 21:21:24 +02:00
Felix Krause 58b9b92895 Support int, uint and float types. 2016-04-04 20:44:16 +02:00
Felix Krause 6ad7e33bb5 Reduced dead code and compiler warnings 2016-04-03 11:45:48 +02:00
Felix Krause f2c83cc170 Support array types. Updated documentation 2016-04-03 11:29:49 +02:00
Felix Krause a267f73e0a Serialization: support sets 2016-04-02 18:29:26 +02:00
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