yaml 0.8.21.2 → 0.8.22
raw patch · 14 files changed
+70/−68 lines, 14 filesdep −enclosed-exceptions
Dependencies removed: enclosed-exceptions
Files
- ChangeLog.md +4/−0
- Data/Yaml/Internal.hs +5/−3
- libyaml/LICENSE +1/−1
- libyaml/api.c +9/−11
- libyaml/emitter.c +8/−13
- libyaml/loader.c +2/−2
- libyaml/parser.c +1/−1
- libyaml/reader.c +3/−3
- libyaml/scanner.c +28/−25
- libyaml/writer.c +1/−1
- libyaml/yaml.h +3/−2
- libyaml/yaml_private.h +3/−3
- test/Data/YamlSpec.hs +1/−1
- yaml.cabal +1/−2
ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.8.22++* Update to libyaml hosted on Github [#105](https://github.com/snoyberg/yaml/issues/105)+ ## 0.8.21.2 * Fix wrong file not found exception in `Data.Yaml.Include` with pre-1.2.3.0 `directory` [#104](https://github.com/snoyberg/yaml/pull/104)
Data/Yaml/Internal.hs view
@@ -17,7 +17,6 @@ import Control.Applicative ((<$>), Applicative(..)) #endif import Control.Exception-import Control.Exception.Enclosed import Control.Monad (liftM, ap, unless) import Control.Monad.IO.Class (MonadIO, liftIO) import Control.Monad.Trans.Class (MonadTrans, lift)@@ -253,7 +252,10 @@ => C.Source Parse Y.Event -> IO (Either ParseException (Either String a)) decodeHelper src = do- x <- tryAny $ runResourceT $ flip evalStateT Map.empty $ src C.$$ parse+ -- This used to be tryAny, but the fact is that catching async+ -- exceptions is fine here. We'll rethrow them immediately in the+ -- otherwise clause.+ x <- try $ runResourceT $ flip evalStateT Map.empty $ src C.$$ parse case x of Left e | Just pe <- fromException e -> return $ Left pe@@ -265,7 +267,7 @@ => C.Source Parse Event -> IO (Either ParseException a) decodeHelper_ src = do- x <- tryAny $ runResourceT $ flip evalStateT Map.empty $ src C.$$ parse+ x <- try $ runResourceT $ flip evalStateT Map.empty $ src C.$$ parse return $ case x of Left e | Just pe <- fromException e -> Left pe
libyaml/LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2006 Kirill Simonov+Copyright (c) 2006-2016 Kirill Simonov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in
libyaml/api.c view
@@ -5,15 +5,6 @@ * Get the library version. */ -/*- * added to support _WIN64- */-#if _WIN64-#define STRDUP _strdup-#else-#define STRDUP strdup-#endif- YAML_DECLARE(const char *) yaml_get_version_string(void) {@@ -72,7 +63,14 @@ if (!str) return NULL; - return (yaml_char_t *) STRDUP((char *)str);+/*+ * Haskell yaml package: added to support _WIN64+ */+#if _WIN64+ return (yaml_char_t *)_strdup((char *)str);+#else+ return (yaml_char_t *)strdup((char *)str);+#endif } /*@@ -834,7 +832,7 @@ assert(event); /* Non-NULL event object is expected. */ /* following line added for Haskell yaml library */- if (!value && !length) value = "";+ if (!value && !length) value = (unsigned char*)""; assert(value); /* Non-NULL anchor is expected. */ if (anchor) {
libyaml/emitter.c view
@@ -517,7 +517,7 @@ if (emitter->best_width < 0) { emitter->best_width = INT_MAX; }- + if (!emitter->line_break) { emitter->line_break = YAML_LN_BREAK; }@@ -607,7 +607,7 @@ if (!yaml_emitter_write_indent(emitter)) return 0; }- + if (event->data.document_start.tag_directives.start != event->data.document_start.tag_directives.end) { implicit = 0;@@ -721,7 +721,7 @@ } /*- * + * * Expect a flow item node. */ @@ -1402,7 +1402,7 @@ { size_t anchor_length; yaml_string_t string;- + anchor_length = strlen((char *)anchor); STRING_ASSIGN(string, anchor, anchor_length); @@ -1493,7 +1493,7 @@ int break_space = 0; int space_break = 0; - int preceeded_by_whitespace = 0;+ int preceded_by_whitespace = 0; int followed_by_whitespace = 0; int previous_space = 0; int previous_break = 0;@@ -1524,7 +1524,7 @@ flow_indicators = 1; } - preceeded_by_whitespace = 1;+ preceded_by_whitespace = 1; followed_by_whitespace = IS_BLANKZ_AT(string, WIDTH(string)); while (string.pointer != string.end)@@ -1570,7 +1570,7 @@ } } - if (CHECK(string, '#') && preceeded_by_whitespace) {+ if (CHECK(string, '#') && preceded_by_whitespace) { flow_indicators = 1; block_indicators = 1; }@@ -1619,7 +1619,7 @@ previous_break = 0; } - preceeded_by_whitespace = IS_BLANKZ(string);+ preceded_by_whitespace = IS_BLANKZ(string); MOVE(string); if (string.pointer != string.end) { followed_by_whitespace = IS_BLANKZ_AT(string, WIDTH(string));@@ -1946,10 +1946,6 @@ emitter->whitespace = 0; emitter->indention = 0;- if (emitter->root_context)- {- emitter->open_ended = 1;- } return 1; }@@ -2326,4 +2322,3 @@ return 1; }-
libyaml/loader.c view
@@ -239,8 +239,8 @@ if (strcmp((char *)alias_data->anchor, (char *)anchor) == 0) { yaml_free(anchor); return yaml_parser_set_composer_error_context(parser,- "found duplicate anchor; first occurence",- alias_data->mark, "second occurence", data.mark);+ "found duplicate anchor; first occurrence",+ alias_data->mark, "second occurrence", data.mark); } }
libyaml/parser.c view
@@ -1295,7 +1295,7 @@ token = PEEK_TOKEN(parser); if (!token) goto error; }- + for (default_tag_directive = default_tag_directives; default_tag_directive->handle; default_tag_directive++) { if (!yaml_parser_append_tag_directive(parser, *default_tag_directive, 1,
libyaml/reader.c view
@@ -52,7 +52,7 @@ { /* Ensure that we had enough bytes in the raw buffer. */ - while (!parser->eof + while (!parser->eof && parser->raw_buffer.last - parser->raw_buffer.pointer < 3) { if (!yaml_parser_update_raw_buffer(parser)) { return 0;@@ -295,7 +295,7 @@ parser->offset, value); break;- + case YAML_UTF16LE_ENCODING: case YAML_UTF16BE_ENCODING: @@ -318,7 +318,7 @@ * * The following formulas are used for decoding * and encoding characters using surrogate pairs:- * + * * U = U' + 0x10000 (0x01 00 00 <= U <= 0x10 FF FF) * U' = yyyyyyyyyyxxxxxxxxxx (0 <= U' <= 0x0F FF FF) * W1 = 110110yyyyyyyyyy
libyaml/scanner.c view
@@ -70,7 +70,7 @@ * %TAG !yaml! tag:yaml.org,2002: * --- *- * The correspoding sequence of tokens:+ * The corresponding sequence of tokens: * * STREAM-START(utf-8) * VERSION-DIRECTIVE(1,1)@@ -762,7 +762,7 @@ } /* Fetch the next token from the queue. */- + *token = DEQUEUE(parser, parser->tokens); parser->token_available = 0; parser->tokens_parsed ++;@@ -1114,7 +1114,7 @@ yaml_simple_key_t simple_key; simple_key.possible = 1; simple_key.required = required;- simple_key.token_number = + simple_key.token_number = parser->tokens_parsed + (parser->tokens.tail - parser->tokens.head); simple_key.mark = parser->mark; @@ -1200,7 +1200,7 @@ * Push the current indentation level to the stack and set the new level * the current column is greater than the indentation level. In this case, * append or insert the specified token into the token queue.- * + * */ static int@@ -1251,7 +1251,7 @@ /* * Pop indentation levels from the indents stack until the current level- * becomes less or equal to the column. For each intendation level, append+ * becomes less or equal to the column. For each indentation level, append * the BLOCK-END token. */ @@ -1266,7 +1266,7 @@ if (parser->flow_level) return 1; - /* Loop through the intendation levels in the stack. */+ /* Loop through the indentation levels in the stack. */ while (parser->indent > column) {@@ -1938,7 +1938,7 @@ * * - in the flow context; * - in the block context, but not at the beginning of the line or- * after '-', '?', or ':' (complex value). + * after '-', '?', or ':' (complex value). */ if (!CACHE(parser, 1)) return 0;@@ -2053,7 +2053,7 @@ else { yaml_parser_set_scanner_error(parser, "while scanning a directive",- start_mark, "found uknown directive name");+ start_mark, "found unknown directive name"); goto error; } @@ -2775,15 +2775,15 @@ if (IS_DIGIT(parser->buffer)) {- /* Check that the intendation is greater than 0. */+ /* Check that the indentation is greater than 0. */ if (CHECK(parser->buffer, '0')) { yaml_parser_set_scanner_error(parser, "while scanning a block scalar",- start_mark, "found an intendation indicator equal to 0");+ start_mark, "found an indentation indicator equal to 0"); goto error; } - /* Get the intendation level and eat the indicator. */+ /* Get the indentation level and eat the indicator. */ increment = AS_DIGIT(parser->buffer); @@ -2797,7 +2797,7 @@ { if (CHECK(parser->buffer, '0')) { yaml_parser_set_scanner_error(parser, "while scanning a block scalar",- start_mark, "found an intendation indicator equal to 0");+ start_mark, "found an indentation indicator equal to 0"); goto error; } @@ -2847,7 +2847,7 @@ end_mark = parser->mark; - /* Set the intendation level if it was specified. */+ /* Set the indentation level if it was specified. */ if (increment) { indent = parser->indent >= 0 ? parser->indent+increment : increment;@@ -2913,7 +2913,7 @@ if (!READ_LINE(parser, leading_break)) goto error; - /* Eat the following intendation spaces and line breaks. */+ /* Eat the following indentation spaces and line breaks. */ if (!yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark)) goto error;@@ -2948,8 +2948,8 @@ } /*- * Scan intendation spaces and line breaks for a block scalar. Determine the- * intendation level if needed.+ * Scan indentation spaces and line breaks for a block scalar. Determine the+ * indentation level if needed. */ static int@@ -2961,11 +2961,11 @@ *end_mark = parser->mark; - /* Eat the intendation spaces and line breaks. */+ /* Eat the indentation spaces and line breaks. */ while (1) {- /* Eat the intendation spaces. */+ /* Eat the indentation spaces. */ if (!CACHE(parser, 1)) return 0; @@ -2978,12 +2978,12 @@ if ((int)parser->mark.column > max_indent) max_indent = (int)parser->mark.column; - /* Check for a tab character messing the intendation. */+ /* Check for a tab character messing the indentation. */ if ((!*indent || (int)parser->mark.column < *indent) && IS_TAB(parser->buffer)) { return yaml_parser_set_scanner_error(parser, "while scanning a block scalar",- start_mark, "found a tab character where an intendation space is expected");+ start_mark, "found a tab character where an indentation space is expected"); } /* Have we found a non-empty line? */@@ -3007,7 +3007,7 @@ *indent = 1; } - return 1; + return 1; } /*@@ -3162,6 +3162,10 @@ *(string.pointer++) = '"'; break; + case '/':+ *(string.pointer++) = '/';+ break;+ case '\'': *(string.pointer++) = '\''; break;@@ -3504,12 +3508,12 @@ { if (IS_BLANK(parser->buffer)) {- /* Check for tab character that abuse intendation. */+ /* Check for tab character that abuse indentation. */ if (leading_blanks && (int)parser->mark.column < indent && IS_TAB(parser->buffer)) { yaml_parser_set_scanner_error(parser, "while scanning a plain scalar",- start_mark, "found a tab character that violate intendation");+ start_mark, "found a tab character that violate indentation"); goto error; } @@ -3542,7 +3546,7 @@ if (!CACHE(parser, 1)) goto error; } - /* Check intendation level. */+ /* Check indentation level. */ if (!parser->flow_level && (int)parser->mark.column < indent) break;@@ -3573,4 +3577,3 @@ return 0; }-
libyaml/writer.c view
@@ -74,7 +74,7 @@ unsigned int value; size_t k; - /* + /* * See the "reader.c" code for more details on UTF-8 encoding. Note * that we assume that the buffer contains a valid UTF-8 sequence. */
libyaml/yaml.h view
@@ -26,9 +26,10 @@ /** The public API declaration. */ +/* __MINGW32__ definition added for Haskell yaml package */ #if defined(__MINGW32__) # define YAML_DECLARE(type) type-#elif defined(_WIN32)+#elif _WIN32 # if defined(YAML_DECLARE_STATIC) # define YAML_DECLARE(type) type # elif defined(YAML_DECLARE_EXPORT)@@ -665,7 +666,7 @@ /** The tag @c !!null with the only possible value: @c null. */ #define YAML_NULL_TAG "tag:yaml.org,2002:null"-/** The tag @c !!bool with the values: @c true and @c falce. */+/** The tag @c !!bool with the values: @c true and @c false. */ #define YAML_BOOL_TAG "tag:yaml.org,2002:bool" /** The tag @c !!str for string values. */ #define YAML_STR_TAG "tag:yaml.org,2002:str"
libyaml/yaml_private.h view
@@ -1,4 +1,3 @@- #if HAVE_CONFIG_H #include <config.h> #endif@@ -242,9 +241,9 @@ (string).pointer[offset] <= (yaml_char_t) 'f') ? \ ((string).pointer[offset] - (yaml_char_t) 'a' + 10) : \ ((string).pointer[offset] - (yaml_char_t) '0'))- + #define AS_HEX(string) AS_HEX_AT((string),0)- + /* * Check if the character is ASCII. */@@ -658,6 +657,7 @@ (node).data.mapping.pairs.top = (node_pairs_start), \ (node).data.mapping.style = (node_style)) +/* For Haskell yaml package, since we do not use the configure script */ #define YAML_VERSION_STRING "0.1.7" #define YAML_VERSION_MAJOR 0 #define YAML_VERSION_MINOR 1
test/Data/YamlSpec.hs view
@@ -450,7 +450,7 @@ caseQuotedNumber = D.decode "foo: \"1234\"" @?= Just (object [("foo", D.String "1234")]) caseUnquotedNumber = D.decode "foo: 1234" @?= Just (object [("foo", D.Number 1234)]) caseAttribNumber = D.decode "foo: !!str 1234" @?= Just (object [("foo", D.String "1234")])-caseIntegerDecimals = D.encode (1 :: Int) @?= "1\n...\n"+caseIntegerDecimals = D.encode (1 :: Int) @?= "1\n" obj :: Maybe D.Value obj = Just (object [("foo", D.Bool False), ("bar", D.Bool True), ("baz", D.Bool True)])
yaml.cabal view
@@ -1,5 +1,5 @@ name: yaml-version: 0.8.21.2+version: 0.8.22 license: BSD3 license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>, Anton Ageev <antage@gmail.com>,Kirill Simonov@@ -59,7 +59,6 @@ , scientific , filepath , directory- , enclosed-exceptions , semigroups exposed-modules: Text.Libyaml Data.Yaml