on master help sign in
Merge pull request #184 from flip111/patch-1
32fd592Michael Snoyman
.gitignore+1
@@ -9,3 +9,4 @@ yaml.cabal
9/tarballs/
9/tarballs/
10.dir-locals.el
10.dir-locals.el
11*#
11*#
12+stack.yaml.lock
libyaml/README.md+1−1
@@ -1,3 +1,3 @@
1# libyaml
1# libyaml
2
2
3−This package provides a haskell wrapper over the [libyaml C library version 0.2.1 by Kirill Simonov](https://github.com/yaml/libyaml). It contains the C source so you don't need to worry about any non-Haskell dependencies.
3+This package provides a haskell wrapper over the [libyaml C library version 0.2.2 by Kirill Simonov](https://github.com/yaml/libyaml). It contains the C source so you don't need to worry about any non-Haskell dependencies.
libyaml/libyaml_src/LICENSE+1−1
@@ -1,4 +1,4 @@
1−Copyright (c) 2017-2018 Ingy döt Net
1+Copyright (c) 2017-2019 Ingy döt Net
2Copyright (c) 2006-2016 Kirill Simonov
2Copyright (c) 2006-2016 Kirill Simonov
3
3
4Permission is hereby granted, free of charge, to any person obtaining a copy of
4Permission is hereby granted, free of charge, to any person obtaining a copy of
libyaml/libyaml_src/dumper.c+1−1
@@ -131,7 +131,7 @@ yaml_emitter_dump(yaml_emitter_t *emitter, yaml_document_t *document)
131
131
132 assert(emitter->opened); /* Emitter should be opened. */
132 assert(emitter->opened); /* Emitter should be opened. */
133
133
134− emitter->anchors = yaml_malloc(sizeof(*(emitter->anchors))
134+ emitter->anchors = (yaml_anchors_t*)yaml_malloc(sizeof(*(emitter->anchors))
135 * (document->nodes.top - document->nodes.start));
135 * (document->nodes.top - document->nodes.start));
136 if (!emitter->anchors) goto error;
136 if (!emitter->anchors) goto error;
137 memset(emitter->anchors, 0, sizeof(*(emitter->anchors))
137 memset(emitter->anchors, 0, sizeof(*(emitter->anchors))
libyaml/libyaml_src/emitter.c+11−11
@@ -16,7 +16,7 @@
16#define PUT(emitter,value) \
16#define PUT(emitter,value) \
17 (FLUSH(emitter) \
17 (FLUSH(emitter) \
18 && (*(emitter->buffer.pointer++) = (yaml_char_t)(value), \
18 && (*(emitter->buffer.pointer++) = (yaml_char_t)(value), \
19− emitter->column ++, \
19+ emitter->column++, \
20 1))
20 1))
21
21
22/*
22/*
@@ -221,7 +221,7 @@ yaml_emitter_write_indent(yaml_emitter_t *emitter);
221
221
222static int
222static int
223yaml_emitter_write_indicator(yaml_emitter_t *emitter,
223yaml_emitter_write_indicator(yaml_emitter_t *emitter,
224− char *indicator, int need_whitespace,
224+ const char *indicator, int need_whitespace,
225 int is_whitespace, int is_indention);
225 int is_whitespace, int is_indention);
226
226
227static int
227static int
@@ -649,13 +649,6 @@ yaml_emitter_emit_document_start(yaml_emitter_t *emitter,
649
649
650 else if (event->type == YAML_STREAM_END_EVENT)
650 else if (event->type == YAML_STREAM_END_EVENT)
651 {
651 {
652− if (emitter->open_ended)
653− {
654− if (!yaml_emitter_write_indicator(emitter, "...", 1, 0, 0))
655− return 0;
656− if (!yaml_emitter_write_indent(emitter))
657− return 0;
658− }
659
652
660 if (!yaml_emitter_flush(emitter))
653 if (!yaml_emitter_flush(emitter))
661 return 0;
654 return 0;
@@ -1784,7 +1777,7 @@ yaml_emitter_write_indent(yaml_emitter_t *emitter)
1784
1777
1785static int
1778static int
1786yaml_emitter_write_indicator(yaml_emitter_t *emitter,
1779yaml_emitter_write_indicator(yaml_emitter_t *emitter,
1787− char *indicator, int need_whitespace,
1780+ const char *indicator, int need_whitespace,
1788 int is_whitespace, int is_indention)
1781 int is_whitespace, int is_indention)
1789{
1782{
1790 size_t indicator_length;
1783 size_t indicator_length;
@@ -1946,6 +1939,10 @@ yaml_emitter_write_plain_scalar(yaml_emitter_t *emitter,
1946
1939
1947 emitter->whitespace = 0;
1940 emitter->whitespace = 0;
1948 emitter->indention = 0;
1941 emitter->indention = 0;
1942+ if (emitter->root_context)
1943+ {
1944+ emitter->open_ended = 1;
1945+ }
1949
1946
1950 return 1;
1947 return 1;
1951}
1948}
@@ -2004,6 +2001,9 @@ yaml_emitter_write_single_quoted_scalar(yaml_emitter_t *emitter,
2004 }
2001 }
2005 }
2002 }
2006
2003
2004+ if (breaks)
2005+ if (!yaml_emitter_write_indent(emitter)) return 0;
2006+
2007 if (!yaml_emitter_write_indicator(emitter, "'", 0, 0, 0))
2007 if (!yaml_emitter_write_indicator(emitter, "'", 0, 0, 0))
2008 return 0;
2008 return 0;
2009
2009
@@ -2174,7 +2174,7 @@ yaml_emitter_write_block_scalar_hints(yaml_emitter_t *emitter,
2174 yaml_string_t string)
2174 yaml_string_t string)
2175{
2175{
2176 char indent_hint[2];
2176 char indent_hint[2];
2177− char *chomp_hint = NULL;
2177+ const char *chomp_hint = NULL;
2178
2178
2179 if (IS_SPACE(string) || IS_BREAK(string))
2179 if (IS_SPACE(string) || IS_BREAK(string))
2180 {
2180 {
libyaml/libyaml_src/parser.c+2
@@ -1316,6 +1316,8 @@ yaml_parser_process_directives(yaml_parser_t *parser,
1316 STACK_DEL(parser, tag_directives);
1316 STACK_DEL(parser, tag_directives);
1317 }
1317 }
1318
1318
1319+ if (!version_directive_ref)
1320+ yaml_free(version_directive);
1319 return 1;
1321 return 1;
1320
1322
1321error:
1323error:
libyaml/libyaml_src/scanner.c+18−7
@@ -38,8 +38,8 @@
38 * BLOCK-END # Indentation decrease.
38 * BLOCK-END # Indentation decrease.
39 * FLOW-SEQUENCE-START # '['
39 * FLOW-SEQUENCE-START # '['
40 * FLOW-SEQUENCE-END # ']'
40 * FLOW-SEQUENCE-END # ']'
41− * BLOCK-SEQUENCE-START # '{'
41+ * FLOW-MAPPING-START # '{'
42− * BLOCK-SEQUENCE-END # '}'
42+ * FLOW-MAPPING-END # '}'
43 * BLOCK-ENTRY # '-'
43 * BLOCK-ENTRY # '-'
44 * FLOW-ENTRY # ','
44 * FLOW-ENTRY # ','
45 * KEY # '?' or nothing (simple keys).
45 * KEY # '?' or nothing (simple keys).
@@ -1636,7 +1636,7 @@ yaml_parser_fetch_key(yaml_parser_t *parser)
1636
1636
1637 if (!parser->flow_level)
1637 if (!parser->flow_level)
1638 {
1638 {
1639− /* Check if we are allowed to start a new key (not nessesary simple). */
1639+ /* Check if we are allowed to start a new key (not necessary simple). */
1640
1640
1641 if (!parser->simple_key_allowed) {
1641 if (!parser->simple_key_allowed) {
1642 return yaml_parser_set_scanner_error(parser, NULL, parser->mark,
1642 return yaml_parser_set_scanner_error(parser, NULL, parser->mark,
@@ -2860,7 +2860,7 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token,
2860
2860
2861 if (!CACHE(parser, 1)) goto error;
2861 if (!CACHE(parser, 1)) goto error;
2862
2862
2863− while ((int)parser->mark.column == indent && !IS_Z(parser->buffer))
2863+ while ((int)parser->mark.column == indent && !(IS_Z(parser->buffer)))
2864 {
2864 {
2865 /*
2865 /*
2866 * We are at the beginning of a non-empty line.
2866 * We are at the beginning of a non-empty line.
@@ -3430,11 +3430,22 @@ yaml_parser_scan_plain_scalar(yaml_parser_t *parser, yaml_token_t *token)
3430
3430
3431 while (!IS_BLANKZ(parser->buffer))
3431 while (!IS_BLANKZ(parser->buffer))
3432 {
3432 {
3433− /* Check for 'x:x' in the flow context. TODO: Fix the test "spec-08-13". */
3433+ /* Check for "x:" + one of ',?[]{}' in the flow context. TODO: Fix the test "spec-08-13".
3434+ * This is not completely according to the spec
3435+ * See http://yaml.org/spec/1.1/#id907281 9.1.3. Plain
3436+ */
3434
3437
3435 if (parser->flow_level
3438 if (parser->flow_level
3436 && CHECK(parser->buffer, ':')
3439 && CHECK(parser->buffer, ':')
3440+ && (
3441+ CHECK_AT(parser->buffer, ',', 1)
3442+ || CHECK_AT(parser->buffer, '?', 1)
3443+ || CHECK_AT(parser->buffer, '[', 1)
3437− && !IS_BLANKZ_AT(parser->buffer, 1)) {
3444+ || CHECK_AT(parser->buffer, ']', 1)
3445+ || CHECK_AT(parser->buffer, '{', 1)
3446+ || CHECK_AT(parser->buffer, '}', 1)
3447+ )
3448+ ) {
3438 yaml_parser_set_scanner_error(parser, "while scanning a plain scalar",
3449 yaml_parser_set_scanner_error(parser, "while scanning a plain scalar",
3439 start_mark, "found unexpected ':'");
3450 start_mark, "found unexpected ':'");
3440 goto error;
3451 goto error;
@@ -3444,7 +3455,7 @@ yaml_parser_scan_plain_scalar(yaml_parser_t *parser, yaml_token_t *token)
3444
3455
3445 if ((CHECK(parser->buffer, ':') && IS_BLANKZ_AT(parser->buffer, 1))
3456 if ((CHECK(parser->buffer, ':') && IS_BLANKZ_AT(parser->buffer, 1))
3446 || (parser->flow_level &&
3457 || (parser->flow_level &&
3447− (CHECK(parser->buffer, ',') || CHECK(parser->buffer, ':')
3458+ (CHECK(parser->buffer, ',')
3448 || CHECK(parser->buffer, '?') || CHECK(parser->buffer, '[')
3459 || CHECK(parser->buffer, '?') || CHECK(parser->buffer, '[')
3449 || CHECK(parser->buffer, ']') || CHECK(parser->buffer, '{')
3460 || CHECK(parser->buffer, ']') || CHECK(parser->buffer, '{')
3450 || CHECK(parser->buffer, '}'))))
3461 || CHECK(parser->buffer, '}'))))
libyaml/libyaml_src/yaml.h+14−9
@@ -232,7 +232,7 @@ typedef enum yaml_token_type_e {
232
232
233 /** A BLOCK-SEQUENCE-START token. */
233 /** A BLOCK-SEQUENCE-START token. */
234 YAML_BLOCK_SEQUENCE_START_TOKEN,
234 YAML_BLOCK_SEQUENCE_START_TOKEN,
235− /** A BLOCK-SEQUENCE-END token. */
235+ /** A BLOCK-MAPPING-START token. */
236 YAML_BLOCK_MAPPING_START_TOKEN,
236 YAML_BLOCK_MAPPING_START_TOKEN,
237 /** A BLOCK-END token. */
237 /** A BLOCK-END token. */
238 YAML_BLOCK_END_TOKEN,
238 YAML_BLOCK_END_TOKEN,
@@ -1517,6 +1517,18 @@ typedef enum yaml_emitter_state_e {
1517 YAML_EMIT_END_STATE
1517 YAML_EMIT_END_STATE
1518} yaml_emitter_state_t;
1518} yaml_emitter_state_t;
1519
1519
1520+
1521+/* This is needed for C++ */
1522+
1523+typedef struct yaml_anchors_s {
1524+ /** The number of references. */
1525+ int references;
1526+ /** The anchor id. */
1527+ int anchor;
1528+ /** If the node has been emitted? */
1529+ int serialized;
1530+} yaml_anchors_t;
1531+
1520/**
1532/**
1521 * The emitter structure.
1533 * The emitter structure.
1522 *
1534 *
@@ -1742,14 +1754,7 @@ typedef struct yaml_emitter_s {
1742 int closed;
1754 int closed;
1743
1755
1744 /** The information associated with the document nodes. */
1756 /** The information associated with the document nodes. */
1745− struct {
1746− /** The number of references. */
1747− int references;
1748− /** The anchor id. */
1749− int anchor;
1750− /** If the node has been emitted? */
1751− int serialized;
1752− } *anchors;
1757+ yaml_anchors_t *anchors;
1753
1758
1754 /** The last assigned anchor id. */
1759 /** The last assigned anchor id. */
1755 int last_anchor_id;
1760 int last_anchor_id;
libyaml/libyaml_src/yaml_private.h+5−5
@@ -1,5 +1,5 @@
1#if HAVE_CONFIG_H
1#if HAVE_CONFIG_H
2−#include <config.h>
2+#include "config.h"
3#endif
3#endif
4
4
5#include <yaml.h>
5#include <yaml.h>
@@ -171,14 +171,14 @@ yaml_string_join(
171 * Check the octet at the specified position.
171 * Check the octet at the specified position.
172 */
172 */
173
173
174−#define CHECK_AT(string,octet,offset) \
174+#define CHECK_AT(string,octet,offset) \
175 ((string).pointer[offset] == (yaml_char_t)(octet))
175 ((string).pointer[offset] == (yaml_char_t)(octet))
176
176
177/*
177/*
178 * Check the current octet in the buffer.
178 * Check the current octet in the buffer.
179 */
179 */
180
180
181−#define CHECK(string,octet) CHECK_AT((string),(octet),0)
181+#define CHECK(string,octet) (CHECK_AT((string),(octet),0))
182
182
183/*
183/*
184 * Check if the character at the specified position is an alphabetical
184 * Check if the character at the specified position is an alphabetical
@@ -684,7 +684,7 @@ yaml_queue_extend(void **start, void **head, void **tail, void **end);
684#define YAML_MALLOC(size) (yaml_char_t *)yaml_malloc(size)
684#define YAML_MALLOC(size) (yaml_char_t *)yaml_malloc(size)
685
685
686/* For Haskell yaml package, since we do not use the configure script */
686/* For Haskell yaml package, since we do not use the configure script */
687−#define YAML_VERSION_STRING "0.2.1"
687+#define YAML_VERSION_STRING "0.2.2"
688#define YAML_VERSION_MAJOR 0
688#define YAML_VERSION_MAJOR 0
689#define YAML_VERSION_MINOR 2
689#define YAML_VERSION_MINOR 2
690−#define YAML_VERSION_PATCH 1
690+#define YAML_VERSION_PATCH 2
stack.yaml+1−1
@@ -1,4 +1,4 @@
1−resolver: lts-13.17
1+resolver: lts-14.22
2
2
3flags:
3flags:
4 yaml:
4 yaml:
yaml/ChangeLog.md+6
@@ -1,5 +1,11 @@
1# ChangeLog for yaml
1# ChangeLog for yaml
2
2
3+## 0.11.2.1
4+
5+* Upgrade libyaml to 0.2.2
6+* Compiles with GHC 8.6.5
7+* Updated stack LTS to 14.22
8+
3## 0.11.2.0
9## 0.11.2.0
4
10
5* Reduces some of the code duplication between the `encode` and `encodePretty` functions
11* Reduces some of the code duplication between the `encode` and `encodePretty` functions
yaml/package.yaml+1−1
@@ -1,5 +1,5 @@
1name: yaml
1name: yaml
2−version: 0.11.2.0
2+version: 0.11.2.1
3synopsis: Support for parsing and rendering YAML documents.
3synopsis: Support for parsing and rendering YAML documents.
4description: README and API documentation are available at <https://www.stackage.org/package/yaml>
4description: README and API documentation are available at <https://www.stackage.org/package/yaml>
5category: Data
5category: Data