Commit Graph

49 Commits

Author SHA1 Message Date
Felix Krause 2f3a809738 Support JS string output in presenter 2016-09-19 19:33:29 +02:00
Felix Krause 5a90255993 Fixed remaining JS compilation issues
* Changed transform() to not use first class iterators
 * provide a archaic `$` for uints that will break if
   poked
 * TODO: test JS output!
2016-09-01 21:08:27 +02:00
Felix Krause ef9159ab98 Removed trailing ws; JS fixes
* do not call writeStackTrace() if compiling to JS
2016-08-30 22:15:29 +02:00
Felix Krause 09824f931b Refactoring of assertions, improved exceptions
* Replaced all assert statements with yAssert, which prints an error message
   and quits on failure, but does nothing when compiling with -d:release.
 * Implemented and used internalError for better discovery of internal bugs.
   Fixes #8.
 * Made RawYamlStream able to raise YamlStreamError, which might primarily be
   useful for user-defined serialization
 * Properly encapsulate RangeError coming from int/uint serialization on 64bit
   machines in YamlStreamError.
 * Some minor style improvements
2016-08-09 20:47:22 +02:00
Felix Krause fb05fcc95f Fixed undeclared possible IndexError from queues 2016-06-26 12:37:15 +02:00
Felix Krause 280f0d6ce2 Check for multiple documents when dumping JSON 2016-06-08 20:07:29 +02:00
Felix Krause 5f6ed61e30 Fixed and improved canonical presentation 2016-06-08 20:01:46 +02:00
Felix Krause 9945375904 ... and now also fixed it for canonical form 2016-06-08 19:46:58 +02:00
Felix Krause 1df2444c50 Fixed a JSON presentation bug 2016-06-08 19:40:53 +02:00
Felix Krause cde346b85c Switched to indentation of 2 spaces 2016-04-02 17:48:22 +02:00
Felix Krause 57b4518564 Fixed presenter bug
* Fixed TagIds for Nim's system types
 * Output JSON integers for Nim's integer types
 * Output JSON floats for Nim's float types
2016-03-20 19:55:23 +01:00
Felix Krause eef247b2e8 Fixed parser bug, added option to output YAML 1.1
* Fixed a parser bug that got confused when looking for an implicit
   map key in a plain scalar that contains &, * or !
 * Added OutputYamlVersion to PresentationOptions
2016-03-20 10:31:40 +01:00
Felix Krause 5688499650 Fixed bugs with presenting block scalars
* Folded block scalars were presented with "|" instead of ">"
 * It has not been properly detected that a scalar cannot be outputted as
   literal block scalar
2016-03-20 09:21:52 +01:00
Felix Krause 4eb9685a57 code style: use compact blocks where possible 2016-03-17 19:30:40 +01:00
Felix Krause c3f5188e5e Removed unnecessary import 2016-03-14 18:18:41 +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 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 6b46cffbbb Replaced \x0A with \l in strings 2016-02-26 19:28:28 +01:00
Felix Krause 2d6e44188f Vastly improved quoted string output. Fixes #4 2016-02-25 22:32:50 +01:00
Felix Krause b13d8fa201 Presenter: Output block scalars if feasible 2016-02-25 21:04:44 +01:00
Felix Krause 33a7f93480 Code cleanup; reduced compiler hints 2016-02-19 18:25:01 +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 96f01385ef Implemented serializing ref objects. 2016-01-28 21:59:26 +01:00
Felix Krause cec66cd0a2 Presenter: Properly forward exceptions 2016-01-27 15:18:01 +01:00
Felix Krause 24f44b5022 Fixed wrapped exception handling 2016-01-24 21:38:29 +01:00
Felix Krause f2c81f1fc5 Small improvements 2016-01-24 21:21:37 +01:00
Felix Krause 36872370d5 Fixed bugs in presenter, serialization, README
* Made presenter output numbers without double quotes in
   JSON style again
 * Fixed broken serialization.load
 * Updated examples in README
2016-01-24 20:53:51 +01:00
Felix Krause b7828884bd Documentation fixes.
* Some typo fixes in code
 * nim documentation now generates API doc with source links
 * presenter now uses "" if a string starts with @ or `
 * Removed some outdated stuff
2016-01-24 19:15:50 +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 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 46acdc3ccd Fixed presenter JSON output 2016-01-14 19:00:03 +01:00
Felix Krause a1b92a14de REALLY fixed presenter bug 2016-01-11 21:12:38 +01:00
Felix Krause fe583e8538 Debug output 2016-01-11 21:10:30 +01:00
Felix Krause bc9aa06d13 Fixed bug in presenter 2016-01-11 21:08:57 +01:00
Felix Krause 9f83b79bc0 Handle dBlockInlineMap in presenter 2016-01-11 21:03:46 +01:00
Felix Krause 2ed4499674 Do write '?' in ypsMinimal 2016-01-11 21:01:36 +01:00
Felix Krause f29a55c907 REALLY don't use newlines in ypsMinimal 2016-01-11 20:59:49 +01:00
Felix Krause 2d4746b56c No newlines in explicit flow maps for ypsMinimal 2016-01-11 20:58:24 +01:00
Felix Krause fc9607f959 Resolve non-specific tags in transform() 2016-01-11 20:54:06 +01:00
Felix Krause eb29582ef8 Output inline map for single key-value pair 2016-01-11 19:53:47 +01:00
Felix Krause 1e39ca5b6c Removed unneccessary mapMayHaveKeyObjects 2016-01-11 19:12:55 +01:00
Felix Krause f5627254f7 Fixed bug in presenter 2016-01-07 11:58:33 +01:00
Felix Krause 68f0ba0cc7 Added jester-based YAML parsing webservice
* Added server/server.nim
 * Fixed a problem in presenter that made it crash when
   outputting a root map to JSON
2016-01-05 21:34:07 +01:00
Felix Krause f3f6f5de9e Added explicit raises pragma to present()
* Added YamlPresenter*Error exceptions
 * Added raises pragma to present()
 * catch exceptions from YamlStream and Stream in present() and
   put them as cause into YamlPresenter*Error
 * Added loadToJson() proc
 * Give "~" the type hint yTypeNull
 * Always output "null" for yTagNull/yTypeNull scalars when
   presenter is in JSON mode
2016-01-05 19:58:46 +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