Commit Graph

371 Commits

Author SHA1 Message Date
Norio Nomura 21e59d2976
Change `_YAML` prefix of coders types to `_` other than `_YAMLCodingKey`
Some types already be changed.
2017-10-27 12:32:12 +09:00
Norio Nomura d1f55a10d7
Merge `_YAMLDecodingKey` and `_YAMLEncodingKey` 2017-10-27 12:32:12 +09:00
Norio Nomura 3524624e81
Remove `Substring.sexagesimal()` 2017-10-27 12:32:11 +09:00
Norio Nomura 2b9779286f
Unify `ScalarConstructible` implementations of `Double` and `Float` 2017-10-27 12:32:10 +09:00
Norio Nomura d0b0f1f728
DBL_DECIMAL_DIG = 17 2017-10-27 12:32:10 +09:00
Norio Nomura 20476bd78d
Apply patch created by jpsim 2017-10-27 12:32:09 +09:00
Norio Nomura f2001b9855
Fix compilation issue on Swift 3.x 2017-10-27 12:32:09 +09:00
Norio Nomura a8c730ee2c
Encoding/Decoding `Double` and `Float` with full precision are supported only on Apple platforms 2017-10-27 12:32:08 +09:00
Norio Nomura dfbff63386
Fix encoding `Double` and `Float`
Double and Float are now encoded with sufficient precision for decoding.
2017-10-27 12:32:07 +09:00
Norio Nomura d0f2102535
Fix decoding `max` of `UnsignedInteger` 2017-10-27 12:32:06 +09:00
Norio Nomura b15a46ae09
Inline some simple methods 2017-10-27 12:32:05 +09:00
Norio Nomura 2171c92313
Remove unneeded method 2017-10-27 12:32:04 +09:00
Norio Nomura d03eb6eae5
Revise access levels 2017-10-27 12:32:03 +09:00
Norio Nomura dc7cee5205
Add default to `type` parameter of `YAMLDecoder.decode` method 2017-10-27 12:32:03 +09:00
Norio Nomura ab9039aca4
Refactor `YAMLEncoder` 2017-10-27 12:32:02 +09:00
Norio Nomura e4d5cf67b3
Refactor `YAMLDecoder` 2017-10-27 12:32:02 +09:00
Norio Nomura cddbcad16d
Add `Emitter.Options` to `YAMLEncoder` as `Options` 2017-10-27 12:32:02 +09:00
Norio Nomura 1e1a7bd783
Change type of payload from `Data` to `String` 2017-10-27 12:32:01 +09:00
Norio Nomura df02b7024f
Fix swiftlint violations 2017-10-27 12:31:59 +09:00
Norio Nomura 9ab288a274
Fix private_over_fileprivate violations 2017-10-27 12:31:59 +09:00
Norio Nomura 48cf441274
Wrap `YamlError` into `EncodingError` or `DecodingError` 2017-10-27 12:31:59 +09:00
Norio Nomura 8833d3a683
Add specialization for `Decimal` and `URL` 2017-10-27 12:31:57 +09:00
Norio Nomura 0e5ef0762e
Fix `Float.construct(from:)` 2017-10-27 12:31:56 +09:00
Norio Nomura d50249f384
Add `mapping` and `sequence` to `_YAMLEncoder`
Fix codingPath had duplicated entries in `_UnkeyedEncodingContainer`.
2017-10-27 12:31:56 +09:00
Norio Nomura d94119b453
Use `.unused` instead of `""` as initial value of `_YAMLEncoder.node` 2017-10-27 12:31:55 +09:00
Norio Nomura a6396a9d3e
Stop expecting non null on `SingleValueDecodingContainer.decode(_:)` 2017-10-27 12:31:55 +09:00
Norio Nomura 97c6f72dcd
Remove `_YAMLEncoder.with(pushedKey:)` and fix invalid `_YAMLReferencingEncoder.codingPath` 2017-10-27 12:31:53 +09:00
Norio Nomura d6cab350ce
Update to latest Coders protocol 2017-10-27 12:31:53 +09:00
Norio Nomura a396a13050
Loose requirement that `Node` is `scalar` in `NSNull.construct(from:)`
This allows checking `node.null == NSNull()`.
2017-10-27 12:31:52 +09:00
Norio Nomura adae047a2f
Add `ScalarRepresentable` protocol that is representable as `Node.scalar` 2017-10-27 12:31:51 +09:00
Norio Nomura 116f5b2761
Conform to latest Coders protocol 2017-10-27 12:31:50 +09:00
Norio Nomura a72a47b107
Change `Date` encoding for `Codable` to preserve nanosecond without truncation 2017-10-27 12:31:49 +09:00
Norio Nomura d06d6e03e6
Add SE-0166 support 2017-10-27 12:31:49 +09:00
Norio Nomura 57ac824a76
Add `ScalarRepresentable` protocol that is representable as `Node.scalar` 2017-10-27 12:31:47 +09:00
Norio Nomura dad95c8fdc
Remove unused libYAML files
fixes #62
2017-10-27 09:40:09 +09:00
Norio Nomura 2f8317cefd
Change from `sortedKeys` to `sortKeys` 2017-10-27 08:25:30 +09:00
Norio Nomura 677851d6a5
Add `Emitter.Options.sortedKeys`
Set if emitter should sort keys in lexicographic order.
2017-10-26 16:10:54 +09:00
Norio Nomura 44a4559d41
Fix failed on `Int.min` 2017-10-25 09:50:16 +09:00
Norio Nomura 556911e888
Add negative Int support to other formats in addition to canonical 2017-10-25 09:23:59 +09:00
Norio Nomura ff1309dc4c
'characters' is deprecated: Please use String or Substring directly 2017-10-24 11:14:23 +09:00
Norio Nomura e19764db26
Fix comment 2017-10-20 16:04:23 +09:00
Norio Nomura 81506f564d
Add `Emitter.Options` 2017-10-20 15:35:16 +09:00
Norio Nomura db42c6ae7c
Fix swiftlint violations 2017-10-20 11:06:27 +09:00
JP Simard 66680328f4
Fix -Wconditional-uninitialized warning
See https://circleci.com/gh/realm/SwiftLint/1899
2017-10-05 14:51:56 -07:00
JP Simard 7851ecb90d
Remove superfluous SwiftLint disable command
since this file doesn't trigger a file_length violation.
2017-09-09 16:52:34 -07:00
Norio Nomura 58fae96c42
Use `..<` instead of `...` as equivalent to `substring(to:)`
Fix https://travis-ci.org/jpsim/Yams/jobs/263299535#L102
> Test Case '-[YamsTests.EncoderTests testEncodingDate]' started.
> fatal error: cannot increment beyond endIndex
2017-08-11 09:48:15 +09:00
JP Simard d5dd1decd9
updates for latest Swift 4 from Xcode 9 beta 5 2017-08-07 10:54:10 -07:00
JP Simard e4c2678a9c
backwards-compatible update to compile with 4020170725a snapshot 2017-07-27 12:58:33 -07:00
JP Simard b1b18ed175
update to compile with Xcode 9 beta 4 in Swift 4 mode 2017-07-27 12:48:19 -07:00
JP Simard fdf1f718bb
update to compile with Xcode 9 beta 2 2017-06-24 11:46:13 -07:00
Norio Nomura 936eb2f899
Remove dummy vars instead of adding dummy usage of them 2017-06-16 22:53:36 +09:00
Norio Nomura 83d35bf497
Avoid accessing to field results in a dereference of a null pointer
Fix static analyzer issues:
> Access to field 'start_mark' results in a dereference of a null pointer (loaded from variable 'token')
2017-06-16 19:29:54 +09:00
Norio Nomura d36da1dda8
Silence static analyzer issues: Value stored to '…' is never read 2017-06-16 19:28:11 +09:00
Norio Nomura b53284ba4c Merge pull request #42 from jpsim/nn-prepare-for-SE-0104
Prepare for SE-0104 Protocol-oriented integers
2017-05-02 15:48:38 +09:00
Norio Nomura 1c60dfe7e1
Prepare for SE-0104 Protocol-oriented integers 2017-05-02 14:58:47 +09:00
Norio Nomura eeffceaae9
Fix misused `flatMap` 2017-05-02 14:50:02 +09:00
Norio Nomura 0394f746a9
[SE-0110] Distinguish between single-tuple and multiple-argument function types 2017-05-02 09:27:37 +09:00
Norio Nomura eeb0f8ade5
Fix crash if context is nil in `YAML_SCANNER_ERROR`
Fixes https://github.com/realm/SwiftLint/issues/1436
2017-04-14 14:34:40 +09:00
Norio Nomura 2fc8121644
Add `mark` to `Node` 2017-04-12 00:14:03 +09:00
Norio Nomura a56f3d386c
Take out `Mark` from nest 2017-04-11 20:57:14 +09:00
Norio Nomura fc6b75982f
Silence swiftlint violations 2017-04-11 20:23:09 +09:00
Norio Nomura 6506ee98c5
Add missing file header to `YamlError.swift` 2017-04-11 20:22:26 +09:00
Norio Nomura 23db5f9949
Change line and column in `YamlError.Mark` to start from 1 2017-04-11 20:13:26 +09:00
Norio Nomura 0c3b6f94c3
Change line and column to starting from 1 in `description` 2017-04-05 12:34:45 +09:00
Norio Nomura 29de805cd9
Change `utf(8|16)LineNumberColumnAndContents`’s result to starting from 0 2017-04-05 12:33:47 +09:00
Norio Nomura 054494580b
Fix crash with empty yaml on Swift 3.0.2 2017-03-30 14:43:32 +09:00
Norio Nomura 4bd7fdbb06
Reformat `description` of `YamlError`
Add:
- `YamlError.Context` represents context information
- `YamlError.Mark` represents location in Yaml string
2017-03-28 23:43:52 +09:00
Norio Nomura 18af892042
Add test for `YamlError.emitter` 2017-03-28 23:39:57 +09:00
Norio Nomura bb45ecef87
Remove `YamlError.describing(with:)` and make `YamlError` to conform `CustomStringConvertible` 2017-03-28 19:23:11 +09:00
Norio Nomura e070a52788
Change from `RepresenterError` to `YamlError.representer` 2017-03-28 19:23:11 +09:00
Norio Nomura 685d386c01
Use `YamlError.emitter` instead of `EmitterError`, and remove `EmitterError` 2017-03-28 19:23:10 +09:00
Norio Nomura 2dfd583c21
Remove `ParserError`
Change throwing error on undefined alias from `ParserError` to `YamlError`.
2017-03-28 19:23:10 +09:00
Norio Nomura 8e7ff45bb3
Change `Parser.singleRoot()` to throw if multiple documents in yaml 2017-03-28 19:23:10 +09:00
Norio Nomura 88a8bafdb4 Merge pull request #25 from jpsim/nn-add-single-root
Fix merging #24 to master
2017-03-08 18:53:09 +09:00
Norio Nomura 6b6632263c
Fix spacing 2017-03-08 15:42:57 +09:00
Norio Nomura 9cdd8905a2 Merge pull request #22 from jpsim/nn-change-associated-value-of-node
Change associated value of `Node`
2017-03-08 15:37:55 +09:00
Norio Nomura 2dd7f08c9c
Fix `YamlError.init(from:)` crashes when `yaml_parser_t.context` is nil
It also changes to use `String.init(cString:)` instead of `String.init(validatingUTF8:)`
2017-02-26 22:11:26 +09:00
Norio Nomura 5439041573
Add `Parser.singleRoot()`
It supports behavior that expected by `YamlParserTests.testParseInvalidStringThrows` in SwiftLint.
2017-02-26 22:09:11 +09:00
Norio Nomura 349b85ead8
Change `Tag` to `.implicit` when changing `Scalar.string` 2017-02-25 00:27:10 +09:00
Norio Nomura 53d663596c
Make `Tag` conform to` CustomStringConvertible` 2017-02-25 00:22:41 +09:00
Norio Nomura f61661031b
Add `TagResolvable` and separate the differences in Resolving processes of each types 2017-02-25 00:06:39 +09:00
Norio Nomura 1dda476bfc
Delegate `Comparable` of `Node` to `Node.Scalar`, `Node.Mapping` and `Node.Sequence` 2017-02-24 23:55:06 +09:00
Norio Nomura b145abb9ad
Move implementation of `Node.Scalar` to `Node.Scalar.swift` 2017-02-24 23:49:35 +09:00
Norio Nomura 86551420fa
Fix swiftlint violations 2017-02-24 18:55:40 +09:00
Norio Nomura 5aa61a1a0f
Change `Node.Sequence.node` to fileprivate 2017-02-24 18:53:37 +09:00
Norio Nomura b421ee8ac2
Move implementation of `Node.Sequence` to `Node.Sequence.swift` 2017-02-24 18:33:55 +09:00
Norio Nomura 92cb330269
Change `Pair` to fileprivate 2017-02-24 18:24:38 +09:00
Norio Nomura 88b629b559
Add `index(forKey:)` to `Node.Mapping` 2017-02-24 18:08:57 +09:00
Norio Nomura 4e2084359d
Move implementation of `Node.Mapping` and `Pair` to `Node.Mapping.swift` 2017-02-24 18:08:42 +09:00
Norio Nomura 8d744c558b
Delegate `Equatable` of `Node` to `Node.Scalar`, `Node.Mapping` and `Node.Sequence` 2017-02-24 17:57:03 +09:00
Norio Nomura e19cc3324d
Add `resolved(with:)` taking each of `Node.Scalar`, `Node.Mapping` and `Node.Sequence` to `Tag` 2017-02-24 17:50:33 +09:00
Norio Nomura 9a6066c0f8
Add `resolveTag(of:)` taking each of `Node.Scalar`, `Node.Mapping` and `Node.Sequence` to `Resolver` 2017-02-24 17:50:08 +09:00
Norio Nomura 06b38f0f09
Change `Tag.init(…)` from internal to public
Remove `@testable` from some test cases.
2017-02-24 09:07:12 +09:00
Norio Nomura 4c1763b3d5
Add `Node.init(_ pairs: [Node], …)` and replace `.sequence(.init(…))` with that 2017-02-24 00:31:10 +09:00
Norio Nomura f1c889f844
Change access level of `Pair` from public to internal 2017-02-24 00:21:40 +09:00
Norio Nomura 7ce5405592
Add `Node.init(_ pairs: [(Node, Node)], …)` and replace `.mapping(.init(…))` with that 2017-02-24 00:17:15 +09:00
Norio Nomura 1be97d24e5
Replace `Node.scalar(.init(…))` with `Node.init(…)` 2017-02-23 23:18:19 +09:00
Norio Nomura c0a427847e
Change type of `Node.init(_:_:_:)`’s `tag` parameter from `Tag.Name` to `Tag` 2017-02-23 23:15:43 +09:00
Norio Nomura faee5328da
Change associated values of `Node.sequence`’s from `([Node], Tag, Node.Sequence.Style)` to `(Node.Sequence)` 2017-02-23 22:35:43 +09:00
Norio Nomura 2745c861bc
Change associated values of `Node.mapping`’s from `([Pair<Node>], Tag, Node.Mapping.Style)` to `(Node.Mapping)` 2017-02-23 22:30:22 +09:00
Norio Nomura b72eea3b02
Change associated values of `Node.scalar`’s from `(String, Tag, Node.Scalar.Style)` to `(Node.Scalar)` 2017-02-23 18:47:05 +09:00
Norio Nomura 65a2ea2ca4
Fix styling 2017-02-23 17:45:57 +09:00
Norio Nomura 2d87d78966
Change to use UTF16 by default.
The `USE_UTF8` option using UTF8 will remain.
2017-02-23 17:45:56 +09:00
Norio Nomura 450c13fc6f
Use native endian in `Emitter` 2017-02-23 16:39:23 +09:00
Norio Nomura 94239a402f
Use native endian in `Parser` 2017-02-23 16:38:59 +09:00
Norio Nomura a3fe8ce92b
Use `NSRegularExpression` on Swift 3.1 for Linux 2017-02-04 21:28:31 +09:00
Norio Nomura 5e3c6be8e3
Change `Node.Mapping.pairs` and `Node.Sequence.nodes` to internal 2017-02-04 00:07:32 +09:00
Norio Nomura f30798d6e6
Add `Node.subscript(string:)` 2017-02-04 00:01:15 +09:00
Norio Nomura ef1b965c5e
Make `Node.Sequence` behave like an `Array<Node>` 2017-02-04 00:00:36 +09:00
Norio Nomura c625d66880
Make `Node.Mapping` behave like a `Dictionary<Node, Node>` 2017-02-03 23:55:32 +09:00
JP Simard 7a57411c9e
fix minor typos in comments 2017-02-02 17:28:37 -08:00
Norio Nomura 1f365da5f8
Add documentation comments 2017-02-01 18:29:49 +09:00
Norio Nomura 7da52edb58
Add setter to `subscript()` of `Node` 2017-02-01 18:15:41 +09:00
Norio Nomura c291b4c00e
Rewrite `dump()` and add `dump()` execution to each tests in `SpecTests` 2017-02-01 14:23:30 +09:00
Norio Nomura 0599313d3d
Change to sort mapping on representing Dictionary 2017-01-31 13:42:00 +09:00
Norio Nomura 270e8df8b0
Change `Emitter` to allow plain style scalar 2017-01-31 13:42:00 +09:00
Norio Nomura 41fc301f31
Rename names of generic parameters 2017-01-31 13:42:00 +09:00
Norio Nomura c782ee08b3
Add `dump(object:…)` and `dump(objects:…)` 2017-01-31 13:42:00 +09:00
Norio Nomura 997a65c789
Rename `serialize_all(nodes:…)` to `serialize(nodes:…)` 2017-01-31 13:42:00 +09:00
Norio Nomura 12d35614eb
Add `NodeRepresentable` 2017-01-31 13:41:59 +09:00
Norio Nomura 2fcbd72175
Refactor `Tag` initializer 2017-01-31 13:41:59 +09:00
Norio Nomura fa512794fa
Fix swiftlint violations 2017-01-31 13:41:59 +09:00
Norio Nomura 112a338c06
Add styles to `Node` 2017-01-31 13:41:59 +09:00
Norio Nomura b2bb862b01
Fix typo 2017-01-31 13:41:59 +09:00
Norio Nomura 0cdb07dd02
Add support “!” non-specific tag
http://www.yaml.org/spec/1.2/spec.html#id2768011
> By explicitly specifying a “!” non-specific tag property, the node would then be resolved to a “vanilla” sequence, mapping, or string, according to its kind.
2017-01-31 13:41:59 +09:00
Norio Nomura b58b56efd6
Hide `yaml_break_t` from `serialize*()` and `Emitter.init` 2017-01-31 13:41:58 +09:00
Norio Nomura bb2137bf4d
Remove `encoding` option from `serialize*()` and `Emitter.init` 2017-01-31 13:41:58 +09:00
Norio Nomura fe1077061f
Initial `Emitter` implementation 2017-01-31 13:41:57 +09:00
Norio Nomura 74298e3893
Fix failing test of `YamsError` on `USE_UTF16`
Error locations are affected by encoding set by encoding on `yaml_parser_set_encoding()`.
2017-01-31 11:58:48 +09:00
Norio Nomura df5127ce68
Merge branch 'master' into nn-improve-node
* master:
  [Travis] Workaround for https://github.com/travis-ci/travis-ci/issues/7031
  [Travis] Change action from `test` to `build-for-testing test-without-building`
  Bump version to 0.1.5
  Update docker to norionomura/sourcekit:302
  Adjust deployment targets to podspec
  [Travis] Run tests on multiple platforms
  Fix “include of non-modular header inside framework module 'Yams’” error on Xcode 8.3
  Importing C modules with umbrella directories prevents debugging

# Conflicts:
#	Yams.xcodeproj/project.pbxproj
2017-01-31 11:51:06 +09:00
Norio Nomura a19cccf82a
Fix “include of non-modular header inside framework module 'Yams’” error on Xcode 8.3 2017-01-25 11:32:57 +09:00
Norio Nomura ad0e6be54f
Fix documentation comments 2017-01-06 18:37:54 +09:00
Norio Nomura 07de411625
Add `SexagesimalConvertible` 2016-12-27 15:56:14 +09:00
Norio Nomura b1c694f49e
Apply reviews 2016-12-27 13:18:40 +09:00
Norio Nomura 977d144f32
Revise some comments 2016-12-27 13:17:12 +09:00
Norio Nomura a858a5b7ff
Merge calling `map` in raw into single `map` with closure 2016-12-27 12:01:49 +09:00
Norio Nomura 0c7fefb13d
Change of `fatelError()`
- Use `assert(<condition>)` and force unwrapping pattern instead of
`guard let … else { fatelError() }` pattern.
- Change messages to “unreachable”.
2016-12-27 11:59:03 +09:00
Norio Nomura f44c21dadb
Change classes to `final` 2016-12-26 22:58:15 +09:00
Norio Nomura 572f163343
Revise some API’s visibility and name 2016-12-26 16:50:17 +09:00
Norio Nomura c14b1f5a64
Add `Node.array()` accessors
Implemented three variant:
A. `Node.array()` returns `[Node]`
B. `Node.array<Type: ScalarConstructible>()` returns `[Type]`
C. `Node.array(of type: Type.Type)` returns `[Type]`

B is intended to use such as `array() as [String]`
C is intended to use such as `array(of: String.self)`
2016-12-26 16:48:06 +09:00
Norio Nomura 4ec403cf62
Change constructing method from `Constructor`’s instance methods to constructing type’s static methods 2016-12-26 15:42:04 +09:00
Norio Nomura 1bbbb93851
Add `subscript` to `Node` 2016-12-25 23:41:27 +09:00
Norio Nomura 4c67565a15
Add typed accessor properties to `Node`
It also hides some internal properties.
2016-12-25 22:38:40 +09:00
Norio Nomura 388ef180c2
Fix return type of `Yams.compose()` 2016-12-25 22:30:27 +09:00
Norio Nomura d06eca6c30
Fix colon violations 2016-12-25 18:37:22 +09:00
Norio Nomura f8279ab587
Reduce build duration 2016-12-23 23:44:41 +09:00
Norio Nomura 32590e4841
Add `omap`, `pairs` and `set` support to `Constructor` 2016-12-23 23:44:20 +09:00
Norio Nomura adc4e6b7ef
Add `ConstructorTests.swift` 2016-12-23 18:28:43 +09:00
Norio Nomura 4677810740
Simplify APIs 2016-12-22 23:42:42 +09:00
Norio Nomura dc6cc53767
Add `Constructor` 2016-12-22 22:04:01 +09:00
Norio Nomura 1144de54fa
Use `Optional<Tag.Name>` instead of `Tag.State` 2016-12-21 22:12:18 +09:00
Norio Nomura 0214c13232
Change `KnownTag` enum to `Tag.Name` struct 2016-12-21 22:02:43 +09:00
Norio Nomura 40799ce00e
Avoid SwiftLint violations 2016-12-21 17:10:42 +09:00
Norio Nomura be7b025987
Rewrite `Tag` and `Resolver`
`Tag`:
- Change from `enum` to `class`
- Add `KnownTag` enum that defines tags from http://yaml.org/type/int.html
- Holds `Resolver` and resolves tag lazy

`Resolver`:
- Simplify `Resolver` to `struct` and `static` properties
- Use RegularExpression
2016-12-21 16:11:09 +09:00
Norio Nomura 499831cd26
Change `Pair` to generic 2016-12-21 14:14:18 +09:00
Norio Nomura 37de487637
Change associated value of `Node.mapping` from tuple to `Pair`
This achieves referential equality of `Array` on comparing.
2016-12-20 19:40:12 +09:00
Norio Nomura fef210d4a1
Revert associated value of `Node.mapping` to array of tuples
This will be needed to support overriding behavior of `!!merge`.
http://yaml.org/type/merge.html
2016-12-20 19:32:59 +09:00
Ryan Lovelett f5c2b3330c
Importing C modules with umbrella directories prevents debugging 2016-12-18 15:34:11 -05:00
Norio Nomura 49e2235d0e
Add `Resolver`
Three Resolver:
- Failsafe <http://www.yaml.org/spec/1.2/spec.html#id2802346>
- JSON <http://www.yaml.org/spec/1.2/spec.html#id2803231>
- Core <http://www.yaml.org/spec/1.2/spec.html#id2804923>
2016-12-15 22:48:59 +09:00
Norio Nomura da5df139f3
Rename `YamsError` to `YamlError` 2016-12-15 18:21:29 +09:00
Norio Nomura a60aaa24a7
Implement `Parser` that using `yaml_parser_parse()`
- Add `Parser` class that representing of `yaml_parser_t`
- Add `Tag` enum
- Change `Node`
  - Add `Tag` to each cases’s associated value
  - Change `.mapping` to holding `[Node:Node]`
  - Remove `init(string:)`
  - Add `array` property that returns `[Node]?`
  - Add `dictionary` property that returns `[Node:Node]?`
  - Add `string` property that returns `String?`
2016-12-15 18:16:21 +09:00
Norio Nomura fb046e0681
Move `Node` to Node.swift 2016-12-15 16:53:28 +09:00
Norio Nomura 0637311e8b
Improve Error
- Rename `Error` to `YamsError` for avoiding force consumer to using `Swift.Error`
- Change `YamsError` to `enum` that supports `YAML_*_ERROR`
- Add `YamsError.init(from:)` that initializing from `yaml_parser_t`
- Add `YamsError.describing(with:)` that produce `String` describing error with YAML contents:
```
test: 'test
           ^ found unexpected end of stream while scanning a quoted scalar
```
2016-12-08 01:09:26 +09:00
Norio Nomura 161299fd0f
Fix lifetime issue of allocated memory by implicit transformation
On passing `String` as `UnsafePointer<UInt8>` arguments to function,
Swift implicitly creates null terminated UTF8 string buffer and pass the pointer to function.
That memory is released immediately on returning the function.
But, yaml_parser requires that is valid while `yaml_parser_t` exists.
2016-12-05 19:42:14 +09:00
Norio Nomura 3125c9a1ff
Simplify implementation
Also fix off-by-one bug
2016-12-01 22:03:00 +09:00
JP Simard bce5e41a54
Only build CYaml when building with SwiftPM 2016-11-20 09:48:01 -08:00
JP Simard 0f3000796b
silence warnings in libYAML 2016-11-19 19:53:10 -08:00
JP Simard e4451dd5ab
fix more warnings in libYAML 2016-11-19 16:38:56 -08:00
JP Simard d562234adf
fix warnings in libYAML 2016-11-19 16:35:03 -08:00
JP Simard c603313fd6
convert absolute paths to relative paths
and move modulemap file to source
2016-11-19 16:23:53 -08:00
JP Simard f7165ec80e
first commit 2016-11-19 13:59:58 -08:00