Commit Graph

164 Commits

Author SHA1 Message Date
Felix Krause cde346b85c Switched to indentation of 2 spaces 2016-04-02 17:48:22 +02:00
Felix Krause 7063e72ace Added advanced example to index.html 2016-03-25 23:12:00 +01:00
Felix Krause 5ec086081c Implemented serialization of OrderedMap 2016-03-25 22:22:42 +01:00
Felix Krause 06faf4966d Object fields get the tag !nim:field. Fixes #12. 2016-03-25 21:38:28 +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 c18fd47511 Some litte performance increases 2016-03-25 18:22:25 +01:00
Felix Krause 28ccdcc5a6 Handle block scalars line-per-line. Fixes #10 2016-03-25 18:17:37 +01:00
Felix Krause 93ce0b26ba Some performance optimization with shallowCopy 2016-03-25 10:13:55 +01: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 a9b565c35c Eliminated dead code, fixed serialization
* fpBlockContinueScalar wasn't used anymore and has been removed
 * Do not mark scalarContent in events as shallow because it breaks
   peeking in YamlStreams
2016-03-20 14:19:46 +01:00
Felix Krause a1f914eee4 Got rid of fpBlockLineStart, fixes #9 2016-03-20 13:50:00 +01:00
Felix Krause b6d363107a Performance optimizations in parser 2016-03-20 12:09:04 +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 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 e45eb7b514 Fixed some bugs
* Ensure that no event is yielded twice at explicit document end
 * Properly handle indentation when comment occurs in a line before the
   start of the node
 * Allow multiline implicit map keys in flow map
2016-03-19 15:54:19 +01:00
Felix Krause 0fc30241b9 Fixes for block scalars and doc end markers
* Properly (now really) handle block scalars at doc root
 * Properly handle multiple document end markers
2016-03-19 15:03:09 +01:00
Felix Krause 22b8de876d Root block scalars may have indentation of 0 2016-03-19 12:57:25 +01:00
Felix Krause 1399d3ba22 Refactoring: added yieldEmptyScalar() 2016-03-19 11:16:24 +01:00
Felix Krause cb6f73eb01 Fixed a bug with comments in block mode 2016-03-19 11:11:38 +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 b9eb4b62f6 Fixes for flow style
* Allow # in flow scalar if not preceded by whitespace
 * Fixed various issue with parsing single key-value pairs
   in flow maps
2016-03-17 22:50:41 +01:00
Felix Krause 91cc16cde7 Properly handle multiline scalars
* single-quoted scalars: proper line folding
 * plain scalars: allow tabs before continuation lines
2016-03-17 21:25:30 +01:00
Felix Krause 961a8dba81 Support implicit maps in flow sequences 2016-03-17 20:28:00 +01:00
Felix Krause 7edb682844 Handle ',' as flow indicator after tag shorthand 2016-03-17 19:45:01 +01:00
Felix Krause 4eb9685a57 code style: use compact blocks where possible 2016-03-17 19:30:40 +01:00
Felix Krause 06322505d1 Properly handle ':' after empty key in flow style 2016-03-17 18:57:14 +01:00
Felix Krause eda85be0b9 Support % escape sequences in tag URIs 2016-03-17 18:44:35 +01:00
Felix Krause d1c8c171a1 Properly handle comments in flow mode 2016-03-16 19:30:51 +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 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 2e8d7b39ab Fixed a bug with setting ! in %TAG directive 2016-03-11 18:32:17 +01:00
Felix Krause e1cee73b27 Fixed a bug with indentation after block scalar 2016-03-11 18:09:34 +01:00
Felix Krause 5444572543 Fixed bugs with handling scalars
* Fixed a problem with ':' followed by a plain-safe char
   after space within a plain scalar
 * Fixed block scalar handling in indented block context
2016-03-11 17:56:42 +01:00
Felix Krause 3a8781ba6e Handle more indented lines in folded block scalars 2016-03-10 21:20:14 +01:00
Felix Krause 491c5f5e3a Fixed a problem with implicit keys and properties 2016-03-10 19:59:56 +01:00
Felix Krause 99ece33b8b Parser: Use sets instead of arrays where feasible 2016-03-09 20:29:18 +01:00
Felix Krause a6ce61d3c4 Fixed bug related to block sequence indentation 2016-03-09 20:26:16 +01:00
Felix Krause a6fff2d7af Parser: Fixed bugs in multiline and block scalar 2016-03-04 21:51:37 +01:00
Felix Krause 778799e4ff Added option to validate against YAML test suite 2016-03-04 19:10:48 +01:00
Felix Krause 54703ae577 Fixed a problem with comment after plain scalar 2016-03-04 19:07:12 +01:00
Felix Krause a720abdc44 Parser: fixed problems with block scalars
* Block scalar as root node no longer leads to an error
 * Block scalar does not get a ! tag by default
2016-03-04 17:45:47 +01:00
Felix Krause 00e10ff9ce Fixed problem with JSON handling.
* use `[]=` instead of add() to add JSON nodes to an object.
   add() seems to have problems with expanding.
 * renamed bench/json.nim to bench/jsonBench.nim to avoid confusion
   with Nim's stdlib json.nim
2016-02-27 14:33:13 +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 eddcc02e16 Merge branch 'master' of github.com:flyx/NimYAML 2016-02-26 19:28:50 +01:00
Felix Krause 6b46cffbbb Replaced \x0A with \l in strings 2016-02-26 19:28:28 +01:00
Felix Krause a5169230a3 Fixed JSON module to compile against new Nim API 2016-02-25 22:52:52 +01:00
Felix Krause 2d6e44188f Vastly improved quoted string output. Fixes #4 2016-02-25 22:32:50 +01:00
Felix Krause c9dae4430c Fixes #5 2016-02-25 21:16:03 +01:00
Felix Krause b13d8fa201 Presenter: Output block scalars if feasible 2016-02-25 21:04:44 +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 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 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 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 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 7f8afef3d4 Handle line folding in double quoted strings 2016-01-23 15:29:45 +01:00
Felix Krause 954aeafd15 Implemented block scalar, improved comments 2016-01-23 14:09:52 +01:00
Felix Krause 573d4788c7 Properly parse flow sequences 2016-01-22 23:53:42 +01:00
Felix Krause 8c91abc917 fastparse: Implemented explicit keys 2016-01-22 23:44:26 +01:00
Felix Krause c89f07e1fd fastparse: Improvements to flow parsing 2016-01-22 22:40:22 +01:00
Felix Krause f670c5c86b fastparse: Support flow object as implicit keys 2016-01-22 21:36:11 +01:00
Felix Krause 7af566c3a0 Handle quoted strings in flow style.
* Also use fastparse for benchmarking
2016-01-21 19:23:45 +01:00
Felix Krause bb5804cd15 FastParser: Implemented flow style
* still missing: block scalars and explicit map keys
2016-01-20 23:38:39 +01:00
Felix Krause 55d5cfcbf9 Started re-implementing parser
* Made TagLibrary a ref object
 * Started writing fastparse.nim, a parser aimed to deliver
   much faster speeds than the current implementation. It
   currently is only able to parse block content
2016-01-20 21:18:28 +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 46acdc3ccd Fixed presenter JSON output 2016-01-14 19:00:03 +01:00
Felix Krause 7cabfc652e Benchmark against libyaml.
* Took libyaml binding from nimlets and used it in bench
 * Use shallow copy for scalar content in parser
2016-01-13 21:01:50 +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 cf5f614b21 Properly continue parsing after quoted scalar 2016-01-07 11:49:21 +01:00
Felix Krause 9bd12797d2 Fixed parser code 2016-01-07 11:49:01 +01:00