diff --git a/resources/yaml-test-suite/98YD-mixed.yml b/resources/yaml-test-suite/98YD-mixed.yml index 7986aa0..73cb287 100644 --- a/resources/yaml-test-suite/98YD-mixed.yml +++ b/resources/yaml-test-suite/98YD-mixed.yml @@ -1,3 +1,4 @@ +--- elemennts: - name: Spec Example 5.5. Comment Indicator from: http://www.yaml.org/spec/1.2/spec.html#id2773032 @@ -11,4 +12,4 @@ elemennts: dump: "" bool_val: true bool_val_b2: false - bool_val_with_spaces: true \ No newline at end of file + bool_val_with_spaces: true diff --git a/resources/yaml-test-suite/98YD.yml b/resources/yaml-test-suite/98YD.yml index 9d5fed6..e2ac213 100644 --- a/resources/yaml-test-suite/98YD.yml +++ b/resources/yaml-test-suite/98YD.yml @@ -1,3 +1,4 @@ +--- elemennts: - name: Spec Example 5.5. Comment Indicator from: http://www.yaml.org/spec/1.2/spec.html#id2773032 @@ -8,4 +9,4 @@ elemennts: +STR -STR json: "" - dump: "" \ No newline at end of file + dump: "" diff --git a/resources/yaml-test-suite/CC74.yml b/resources/yaml-test-suite/CC74.yml index 1211cb7..2411397 100644 --- a/resources/yaml-test-suite/CC74.yml +++ b/resources/yaml-test-suite/CC74.yml @@ -1,3 +1,4 @@ +--- elements: - name: Spec Example 6.20. Tag Handles from: http://www.yaml.org/spec/1.2/spec.html#id2783195 diff --git a/src/root.zig b/src/root.zig index 0fca944..5f9ba2a 100644 --- a/src/root.zig +++ b/src/root.zig @@ -294,7 +294,8 @@ pub fn Ymlz(comptime Destination: type) type { try self.allocations.append(line); // TODO: Need to fix this comments can start not only from index 0. - if (line.len == 0 or line[0] == '#') { + // TODO: What shoud really happen if a file has '---' which means a new document in the same file. + if (line.len == 0 or line[0] == '#' or std.mem.eql(u8, "---", line)) { // Skipping comments return self.readLine(); } diff --git a/src/tests.zig b/src/tests.zig index a62ecce..e56a77f 100644 --- a/src/tests.zig +++ b/src/tests.zig @@ -119,6 +119,7 @@ test "98YD" { } test "CC74" { + // test const Element = struct { name: []const u8, from: []const u8,