psych 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f2e70b3ff8828fe0241a7047bdd843ad39f669c7
4
- data.tar.gz: ec14c0a1d14bb917e2b43701d97c23ff32c037d2
3
+ metadata.gz: 054dd7398e4481390331b2f80d104914f646fba7
4
+ data.tar.gz: 81e02124a8a73bb21def8b462c35711c6b4157b6
5
5
  SHA512:
6
- metadata.gz: 24c746dc58c84d37adf9e1660c002d3882bbd4ae81bf5f800094959593c0b06ca1d246c563e95ed40e4459d3fa179260f8358ce1dd6a57d9b44d2187b8a52401
7
- data.tar.gz: 01df0982d787422a5cd43ff68adc5dca474d0e7b5012205095f43ccc04d55c5b80d3f112da68c46617c5b587631307fb1e75e61e6acfafe0cee3f378afa6ab7d
6
+ metadata.gz: fd2725e45732155d3fedd70298c9ddfc995ff5c2ef187752dcc654e3ba6a2a3133716db06aa1e9be1026664edf5a65f28cfba6ba73a226e5bfbd7db46aa2be41
7
+ data.tar.gz: 11952cff524490d070fbee8862c4ff0ecf4a0900ab43a344a96263f961c32f60a43e567c568d8de847585277d86d1fc07ae03788552bc105211b1e5f8f5bc7c9
@@ -0,0 +1,73 @@
1
+ # Psych
2
+
3
+ [![Build Status](https://travis-ci.org/ruby/psych.svg?branch=master)](https://travis-ci.org/ruby/psych)
4
+ [![Build status](https://ci.appveyor.com/api/projects/status/2t6x109xfmbx209k/branch/master?svg=true)](https://ci.appveyor.com/project/ruby/psych/branch/master)
5
+
6
+ * https://github.com/ruby/psych
7
+
8
+ ## Description
9
+
10
+ Psych is a YAML parser and emitter. Psych leverages
11
+ [libyaml](http://pyyaml.org/wiki/LibYAML) for its YAML parsing and emitting
12
+ capabilities. In addition to wrapping libyaml, Psych also knows how to
13
+ serialize and de-serialize most Ruby objects to and from the YAML format.
14
+
15
+ ## Examples
16
+
17
+ # Load YAML in to a Ruby object
18
+ Psych.load('--- foo') # => 'foo'
19
+
20
+ # Emit YAML from a Ruby object
21
+ Psych.dump("foo") # => "--- foo\n...\n"
22
+
23
+ ## Dependencies
24
+
25
+ * libyaml
26
+
27
+ ## Installation
28
+
29
+ Psych has been included with MRI since 1.9.2, and is the default YAML parser
30
+ in 1.9.3.
31
+
32
+ If you want a newer gem release of Psych, you can use rubygems:
33
+
34
+ gem install psych
35
+
36
+ In order to use the gem release in your app, and not the stdlib version,
37
+ you'll need the following:
38
+
39
+ gem 'psych'
40
+ require 'psych'
41
+
42
+ Or if you use Bundler add this to your `Gemfile`:
43
+
44
+ gem 'psych'
45
+
46
+ JRuby ships with a pure Java implementation of Psych.
47
+
48
+ If you're on Rubinius, Psych is available in 1.9 mode, please refer to the
49
+ Language Modes section of the [Rubinius
50
+ README](https://github.com/rubinius/rubinius#readme) for more information on
51
+ building and 1.9 mode.
52
+
53
+ ## License
54
+
55
+ Copyright 2009 Aaron Patterson, et al.
56
+
57
+ Permission is hereby granted, free of charge, to any person obtaining a copy
58
+ of this software and associated documentation files (the 'Software'), to deal
59
+ in the Software without restriction, including without limitation the rights
60
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
61
+ copies of the Software, and to permit persons to whom the Software is
62
+ furnished to do so, subject to the following conditions:
63
+
64
+ The above copyright notice and this permission notice shall be included in all
65
+ copies or substantial portions of the Software.
66
+
67
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
68
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
69
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
70
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
71
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
72
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
73
+ SOFTWARE.
@@ -77,7 +77,7 @@ import org.jruby.util.ByteList;
77
77
 
78
78
  public class PsychParser extends RubyObject {
79
79
 
80
- private static final Logger LOG = LoggerFactory.getLogger("PsychParser");
80
+ private static final Logger LOG = LoggerFactory.getLogger(PsychParser.class);
81
81
 
82
82
  public static void initPsychParser(Ruby runtime, RubyModule psych) {
83
83
  RubyClass psychParser = runtime.defineClassUnder("Parser", runtime.getObject(), new ObjectAllocator() {
@@ -55,7 +55,7 @@ public class PsychToRuby {
55
55
  public static IRubyObject build_exception(ThreadContext context, IRubyObject self, IRubyObject klass, IRubyObject message) {
56
56
  if (klass instanceof RubyClass) {
57
57
  IRubyObject exception = ((RubyClass)klass).allocate();
58
- ((RubyException)exception).message = message;
58
+ ((RubyException)exception).setMessage(message);
59
59
  return exception;
60
60
  } else {
61
61
  throw context.runtime.newTypeError(klass, context.runtime.getClassClass());
@@ -395,7 +395,7 @@ yaml_emitter_delete(yaml_emitter_t *emitter)
395
395
  }
396
396
  QUEUE_DEL(emitter, emitter->events);
397
397
  STACK_DEL(emitter, emitter->indents);
398
- while (!STACK_EMPTY(emitter, emitter->tag_directives)) {
398
+ while (!STACK_EMPTY(empty, emitter->tag_directives)) {
399
399
  yaml_tag_directive_t tag_directive = POP(emitter, emitter->tag_directives);
400
400
  yaml_free(tag_directive.handle);
401
401
  yaml_free(tag_directive.prefix);
@@ -415,7 +415,7 @@ yaml_string_write_handler(void *data, unsigned char *buffer, size_t size)
415
415
  {
416
416
  yaml_emitter_t *emitter = data;
417
417
 
418
- if (emitter->output.string.size + *emitter->output.string.size_written
418
+ if (emitter->output.string.size - *emitter->output.string.size_written
419
419
  < size) {
420
420
  memcpy(emitter->output.string.buffer
421
421
  + *emitter->output.string.size_written,
@@ -822,7 +822,6 @@ yaml_scalar_event_initialize(yaml_event_t *event,
822
822
  yaml_char_t *anchor_copy = NULL;
823
823
  yaml_char_t *tag_copy = NULL;
824
824
  yaml_char_t *value_copy = NULL;
825
- size_t value_length;
826
825
 
827
826
  assert(event); /* Non-NULL event object is expected. */
828
827
  assert(value); /* Non-NULL anchor is expected. */
@@ -840,19 +839,16 @@ yaml_scalar_event_initialize(yaml_event_t *event,
840
839
  }
841
840
 
842
841
  if (length < 0) {
843
- value_length = strlen((char *)value);
844
- }
845
- else {
846
- value_length = (size_t)length;
842
+ length = strlen((char *)value);
847
843
  }
848
844
 
849
- if (!yaml_check_utf8(value, value_length)) goto error;
850
- value_copy = yaml_malloc(value_length+1);
845
+ if (!yaml_check_utf8(value, length)) goto error;
846
+ value_copy = yaml_malloc(length+1);
851
847
  if (!value_copy) goto error;
852
- memcpy(value_copy, value, value_length);
853
- value_copy[value_length] = '\0';
848
+ memcpy(value_copy, value, length);
849
+ value_copy[length] = '\0';
854
850
 
855
- SCALAR_EVENT_INIT(*event, anchor_copy, tag_copy, value_copy, value_length,
851
+ SCALAR_EVENT_INIT(*event, anchor_copy, tag_copy, value_copy, length,
856
852
  plain_implicit, quoted_implicit, style, mark, mark);
857
853
 
858
854
  return 1;
@@ -1206,8 +1202,6 @@ yaml_document_add_scalar(yaml_document_t *document,
1206
1202
  yaml_char_t *tag_copy = NULL;
1207
1203
  yaml_char_t *value_copy = NULL;
1208
1204
  yaml_node_t node;
1209
- size_t value_length;
1210
- ptrdiff_t ret;
1211
1205
 
1212
1206
  assert(document); /* Non-NULL document object is expected. */
1213
1207
  assert(value); /* Non-NULL value is expected. */
@@ -1221,26 +1215,19 @@ yaml_document_add_scalar(yaml_document_t *document,
1221
1215
  if (!tag_copy) goto error;
1222
1216
 
1223
1217
  if (length < 0) {
1224
- value_length = strlen((char *)value);
1225
- }
1226
- else {
1227
- value_length = (size_t)length;
1218
+ length = strlen((char *)value);
1228
1219
  }
1229
1220
 
1230
- if (!yaml_check_utf8(value, value_length)) goto error;
1231
- value_copy = yaml_malloc(value_length+1);
1221
+ if (!yaml_check_utf8(value, length)) goto error;
1222
+ value_copy = yaml_malloc(length+1);
1232
1223
  if (!value_copy) goto error;
1233
- memcpy(value_copy, value, value_length);
1234
- value_copy[value_length] = '\0';
1224
+ memcpy(value_copy, value, length);
1225
+ value_copy[length] = '\0';
1235
1226
 
1236
- SCALAR_NODE_INIT(node, tag_copy, value_copy, value_length, style, mark, mark);
1227
+ SCALAR_NODE_INIT(node, tag_copy, value_copy, length, style, mark, mark);
1237
1228
  if (!PUSH(&context, document->nodes, node)) goto error;
1238
1229
 
1239
- ret = document->nodes.top - document->nodes.start;
1240
- #if PTRDIFF_MAX > INT_MAX
1241
- if (ret > INT_MAX) goto error;
1242
- #endif
1243
- return (int)ret;
1230
+ return document->nodes.top - document->nodes.start;
1244
1231
 
1245
1232
  error:
1246
1233
  yaml_free(tag_copy);
@@ -1268,7 +1255,6 @@ yaml_document_add_sequence(yaml_document_t *document,
1268
1255
  yaml_node_item_t *top;
1269
1256
  } items = { NULL, NULL, NULL };
1270
1257
  yaml_node_t node;
1271
- ptrdiff_t ret;
1272
1258
 
1273
1259
  assert(document); /* Non-NULL document object is expected. */
1274
1260
 
@@ -1286,11 +1272,7 @@ yaml_document_add_sequence(yaml_document_t *document,
1286
1272
  style, mark, mark);
1287
1273
  if (!PUSH(&context, document->nodes, node)) goto error;
1288
1274
 
1289
- ret = document->nodes.top - document->nodes.start;
1290
- #if PTRDIFF_MAX > INT_MAX
1291
- if (ret > INT_MAX) goto error;
1292
- #endif
1293
- return (int)ret;
1275
+ return document->nodes.top - document->nodes.start;
1294
1276
 
1295
1277
  error:
1296
1278
  STACK_DEL(&context, items);
@@ -1318,7 +1300,6 @@ yaml_document_add_mapping(yaml_document_t *document,
1318
1300
  yaml_node_pair_t *top;
1319
1301
  } pairs = { NULL, NULL, NULL };
1320
1302
  yaml_node_t node;
1321
- ptrdiff_t ret;
1322
1303
 
1323
1304
  assert(document); /* Non-NULL document object is expected. */
1324
1305
 
@@ -1336,11 +1317,7 @@ yaml_document_add_mapping(yaml_document_t *document,
1336
1317
  style, mark, mark);
1337
1318
  if (!PUSH(&context, document->nodes, node)) goto error;
1338
1319
 
1339
- ret = document->nodes.top - document->nodes.start;
1340
- #if PTRDIFF_MAX > INT_MAX
1341
- if (ret > INT_MAX) goto error;
1342
- #endif
1343
- return (int)ret;
1320
+ return document->nodes.top - document->nodes.start;
1344
1321
 
1345
1322
  error:
1346
1323
  STACK_DEL(&context, pairs);
@@ -1,10 +1,10 @@
1
1
  #define PACKAGE_NAME "yaml"
2
2
  #define PACKAGE_TARNAME "yaml"
3
- #define PACKAGE_VERSION "0.1.6"
4
- #define PACKAGE_STRING "yaml 0.1.6"
5
- #define PACKAGE_BUGREPORT "http://pyyaml.org/newticket?component libyaml"
6
- #define PACKAGE_URL ""
3
+ #define PACKAGE_VERSION "0.1.7"
4
+ #define PACKAGE_STRING "yaml 0.1.7"
5
+ #define PACKAGE_BUGREPORT "https://github.com/yaml/libyaml/issues"
6
+ #define PACKAGE_URL "https://github.com/yaml/libyaml"
7
7
  #define YAML_VERSION_MAJOR 0
8
8
  #define YAML_VERSION_MINOR 1
9
- #define YAML_VERSION_PATCH 6
10
- #define YAML_VERSION_STRING "0.1.6"
9
+ #define YAML_VERSION_PATCH 7
10
+ #define YAML_VERSION_STRING "0.1.7"
@@ -53,7 +53,7 @@
53
53
  #define WRITE_BREAK(emitter,string) \
54
54
  (FLUSH(emitter) \
55
55
  && (CHECK(string,'\n') ? \
56
- ((void)PUT_BREAK(emitter), \
56
+ (PUT_BREAK(emitter), \
57
57
  string.pointer ++, \
58
58
  1) : \
59
59
  (COPY(emitter->buffer,string), \
@@ -221,7 +221,7 @@ yaml_emitter_write_indent(yaml_emitter_t *emitter);
221
221
 
222
222
  static int
223
223
  yaml_emitter_write_indicator(yaml_emitter_t *emitter,
224
- const char *indicator, int need_whitespace,
224
+ char *indicator, int need_whitespace,
225
225
  int is_whitespace, int is_indention);
226
226
 
227
227
  static int
@@ -517,7 +517,7 @@ yaml_emitter_emit_stream_start(yaml_emitter_t *emitter,
517
517
  if (emitter->best_width < 0) {
518
518
  emitter->best_width = INT_MAX;
519
519
  }
520
-
520
+
521
521
  if (!emitter->line_break) {
522
522
  emitter->line_break = YAML_LN_BREAK;
523
523
  }
@@ -607,7 +607,7 @@ yaml_emitter_emit_document_start(yaml_emitter_t *emitter,
607
607
  if (!yaml_emitter_write_indent(emitter))
608
608
  return 0;
609
609
  }
610
-
610
+
611
611
  if (event->data.document_start.tag_directives.start
612
612
  != event->data.document_start.tag_directives.end) {
613
613
  implicit = 0;
@@ -721,7 +721,7 @@ yaml_emitter_emit_document_end(yaml_emitter_t *emitter,
721
721
  }
722
722
 
723
723
  /*
724
- *
724
+ *
725
725
  * Expect a flow item node.
726
726
  */
727
727
 
@@ -1402,7 +1402,7 @@ yaml_emitter_analyze_anchor(yaml_emitter_t *emitter,
1402
1402
  {
1403
1403
  size_t anchor_length;
1404
1404
  yaml_string_t string;
1405
-
1405
+
1406
1406
  anchor_length = strlen((char *)anchor);
1407
1407
  STRING_ASSIGN(string, anchor, anchor_length);
1408
1408
 
@@ -1784,7 +1784,7 @@ yaml_emitter_write_indent(yaml_emitter_t *emitter)
1784
1784
 
1785
1785
  static int
1786
1786
  yaml_emitter_write_indicator(yaml_emitter_t *emitter,
1787
- const char *indicator, int need_whitespace,
1787
+ char *indicator, int need_whitespace,
1788
1788
  int is_whitespace, int is_indention)
1789
1789
  {
1790
1790
  size_t indicator_length;
@@ -2178,7 +2178,7 @@ yaml_emitter_write_block_scalar_hints(yaml_emitter_t *emitter,
2178
2178
  yaml_string_t string)
2179
2179
  {
2180
2180
  char indent_hint[2];
2181
- const char *chomp_hint = NULL;
2181
+ char *chomp_hint = NULL;
2182
2182
 
2183
2183
  if (IS_SPACE(string) || IS_BREAK(string))
2184
2184
  {
@@ -239,8 +239,8 @@ yaml_parser_register_anchor(yaml_parser_t *parser,
239
239
  if (strcmp((char *)alias_data->anchor, (char *)anchor) == 0) {
240
240
  yaml_free(anchor);
241
241
  return yaml_parser_set_composer_error_context(parser,
242
- "found duplicate anchor; first occurrence",
243
- alias_data->mark, "second occurrence", data.mark);
242
+ "found duplicate anchor; first occurence",
243
+ alias_data->mark, "second occurence", data.mark);
244
244
  }
245
245
  }
246
246
 
@@ -283,7 +283,6 @@ static int
283
283
  yaml_parser_load_scalar(yaml_parser_t *parser, yaml_event_t *first_event)
284
284
  {
285
285
  yaml_node_t node;
286
- ptrdiff_t node_index;
287
286
  int index;
288
287
  yaml_char_t *tag = first_event->data.scalar.tag;
289
288
 
@@ -301,11 +300,7 @@ yaml_parser_load_scalar(yaml_parser_t *parser, yaml_event_t *first_event)
301
300
 
302
301
  if (!PUSH(parser, parser->document->nodes, node)) goto error;
303
302
 
304
- node_index = parser->document->nodes.top - parser->document->nodes.start;
305
- #if PTRDIFF_MAX > INT_MAX
306
- if (node_index > INT_MAX) goto error;
307
- #endif
308
- index = (int)node_index;
303
+ index = parser->document->nodes.top - parser->document->nodes.start;
309
304
 
310
305
  if (!yaml_parser_register_anchor(parser, index,
311
306
  first_event->data.scalar.anchor)) return 0;
@@ -334,7 +329,6 @@ yaml_parser_load_sequence(yaml_parser_t *parser, yaml_event_t *first_event)
334
329
  yaml_node_item_t *top;
335
330
  } items = { NULL, NULL, NULL };
336
331
  int index, item_index;
337
- ptrdiff_t node_index;
338
332
  yaml_char_t *tag = first_event->data.sequence_start.tag;
339
333
 
340
334
  if (!STACK_LIMIT(parser, parser->document->nodes, INT_MAX-1)) goto error;
@@ -353,11 +347,7 @@ yaml_parser_load_sequence(yaml_parser_t *parser, yaml_event_t *first_event)
353
347
 
354
348
  if (!PUSH(parser, parser->document->nodes, node)) goto error;
355
349
 
356
- node_index = parser->document->nodes.top - parser->document->nodes.start;
357
- #if PTRDIFF_MAX > INT_MAX
358
- if (node_index > INT_MAX) goto error;
359
- #endif
360
- index = (int)node_index;
350
+ index = parser->document->nodes.top - parser->document->nodes.start;
361
351
 
362
352
  if (!yaml_parser_register_anchor(parser, index,
363
353
  first_event->data.sequence_start.anchor)) return 0;
@@ -401,7 +391,6 @@ yaml_parser_load_mapping(yaml_parser_t *parser, yaml_event_t *first_event)
401
391
  yaml_node_pair_t *top;
402
392
  } pairs = { NULL, NULL, NULL };
403
393
  int index;
404
- ptrdiff_t node_index;
405
394
  yaml_node_pair_t pair;
406
395
  yaml_char_t *tag = first_event->data.mapping_start.tag;
407
396
 
@@ -421,11 +410,7 @@ yaml_parser_load_mapping(yaml_parser_t *parser, yaml_event_t *first_event)
421
410
 
422
411
  if (!PUSH(parser, parser->document->nodes, node)) goto error;
423
412
 
424
- node_index = parser->document->nodes.top - parser->document->nodes.start;
425
- #if PTRDIFF_MAX > INT_MAX
426
- if (node_index > INT_MAX) goto error;
427
- #endif
428
- index = (int)node_index;
413
+ index = parser->document->nodes.top - parser->document->nodes.start;
429
414
 
430
415
  if (!yaml_parser_register_anchor(parser, index,
431
416
  first_event->data.mapping_start.anchor)) return 0;
@@ -759,8 +759,9 @@ yaml_parser_parse_block_sequence_entry(yaml_parser_t *parser,
759
759
 
760
760
  else if (token->type == YAML_BLOCK_END_TOKEN)
761
761
  {
762
+ yaml_mark_t dummy_mark; /* Used to eliminate a compiler warning. */
762
763
  parser->state = POP(parser, parser->states);
763
- (void)POP(parser, parser->marks);
764
+ dummy_mark = POP(parser, parser->marks);
764
765
  SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
765
766
  SKIP_TOKEN(parser);
766
767
  return 1;
@@ -868,8 +869,9 @@ yaml_parser_parse_block_mapping_key(yaml_parser_t *parser,
868
869
 
869
870
  else if (token->type == YAML_BLOCK_END_TOKEN)
870
871
  {
872
+ yaml_mark_t dummy_mark; /* Used to eliminate a compiler warning. */
871
873
  parser->state = POP(parser, parser->states);
872
- (void)POP(parser, parser->marks);
874
+ dummy_mark = POP(parser, parser->marks);
873
875
  MAPPING_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
874
876
  SKIP_TOKEN(parser);
875
877
  return 1;
@@ -950,6 +952,7 @@ yaml_parser_parse_flow_sequence_entry(yaml_parser_t *parser,
950
952
  yaml_event_t *event, int first)
951
953
  {
952
954
  yaml_token_t *token;
955
+ yaml_mark_t dummy_mark; /* Used to eliminate a compiler warning. */
953
956
 
954
957
  if (first) {
955
958
  token = PEEK_TOKEN(parser);
@@ -994,7 +997,7 @@ yaml_parser_parse_flow_sequence_entry(yaml_parser_t *parser,
994
997
  }
995
998
 
996
999
  parser->state = POP(parser, parser->states);
997
- (void)POP(parser, parser->marks);
1000
+ dummy_mark = POP(parser, parser->marks);
998
1001
  SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
999
1002
  SKIP_TOKEN(parser);
1000
1003
  return 1;
@@ -1101,6 +1104,7 @@ yaml_parser_parse_flow_mapping_key(yaml_parser_t *parser,
1101
1104
  yaml_event_t *event, int first)
1102
1105
  {
1103
1106
  yaml_token_t *token;
1107
+ yaml_mark_t dummy_mark; /* Used to eliminate a compiler warning. */
1104
1108
 
1105
1109
  if (first) {
1106
1110
  token = PEEK_TOKEN(parser);
@@ -1154,7 +1158,7 @@ yaml_parser_parse_flow_mapping_key(yaml_parser_t *parser,
1154
1158
  }
1155
1159
 
1156
1160
  parser->state = POP(parser, parser->states);
1157
- (void)POP(parser, parser->marks);
1161
+ dummy_mark = POP(parser, parser->marks);
1158
1162
  MAPPING_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
1159
1163
  SKIP_TOKEN(parser);
1160
1164
  return 1;
@@ -1291,7 +1295,7 @@ yaml_parser_process_directives(yaml_parser_t *parser,
1291
1295
  token = PEEK_TOKEN(parser);
1292
1296
  if (!token) goto error;
1293
1297
  }
1294
-
1298
+
1295
1299
  for (default_tag_directive = default_tag_directives;
1296
1300
  default_tag_directive->handle; default_tag_directive++) {
1297
1301
  if (!yaml_parser_append_tag_directive(parser, *default_tag_directive, 1,
@@ -52,7 +52,7 @@ yaml_parser_determine_encoding(yaml_parser_t *parser)
52
52
  {
53
53
  /* Ensure that we had enough bytes in the raw buffer. */
54
54
 
55
- while (!parser->eof
55
+ while (!parser->eof
56
56
  && parser->raw_buffer.last - parser->raw_buffer.pointer < 3) {
57
57
  if (!yaml_parser_update_raw_buffer(parser)) {
58
58
  return 0;
@@ -295,7 +295,7 @@ yaml_parser_update_buffer(yaml_parser_t *parser, size_t length)
295
295
  parser->offset, value);
296
296
 
297
297
  break;
298
-
298
+
299
299
  case YAML_UTF16LE_ENCODING:
300
300
  case YAML_UTF16BE_ENCODING:
301
301
 
@@ -318,7 +318,7 @@ yaml_parser_update_buffer(yaml_parser_t *parser, size_t length)
318
318
  *
319
319
  * The following formulas are used for decoding
320
320
  * and encoding characters using surrogate pairs:
321
- *
321
+ *
322
322
  * U = U' + 0x10000 (0x01 00 00 <= U <= 0x10 FF FF)
323
323
  * U' = yyyyyyyyyyxxxxxxxxxx (0 <= U' <= 0x0F FF FF)
324
324
  * W1 = 110110yyyyyyyyyy
@@ -70,7 +70,7 @@
70
70
  * %TAG !yaml! tag:yaml.org,2002:
71
71
  * ---
72
72
  *
73
- * The corresponding sequence of tokens:
73
+ * The correspoding sequence of tokens:
74
74
  *
75
75
  * STREAM-START(utf-8)
76
76
  * VERSION-DIRECTIVE(1,1)
@@ -762,7 +762,7 @@ yaml_parser_scan(yaml_parser_t *parser, yaml_token_t *token)
762
762
  }
763
763
 
764
764
  /* Fetch the next token from the queue. */
765
-
765
+
766
766
  *token = DEQUEUE(parser, parser->tokens);
767
767
  parser->token_available = 0;
768
768
  parser->tokens_parsed ++;
@@ -1114,7 +1114,7 @@ yaml_parser_save_simple_key(yaml_parser_t *parser)
1114
1114
  yaml_simple_key_t simple_key;
1115
1115
  simple_key.possible = 1;
1116
1116
  simple_key.required = required;
1117
- simple_key.token_number =
1117
+ simple_key.token_number =
1118
1118
  parser->tokens_parsed + (parser->tokens.tail - parser->tokens.head);
1119
1119
  simple_key.mark = parser->mark;
1120
1120
 
@@ -1186,9 +1186,11 @@ yaml_parser_increase_flow_level(yaml_parser_t *parser)
1186
1186
  static int
1187
1187
  yaml_parser_decrease_flow_level(yaml_parser_t *parser)
1188
1188
  {
1189
+ yaml_simple_key_t dummy_key; /* Used to eliminate a compiler warning. */
1190
+
1189
1191
  if (parser->flow_level) {
1190
1192
  parser->flow_level --;
1191
- (void)POP(parser, parser->simple_keys);
1193
+ dummy_key = POP(parser, parser->simple_keys);
1192
1194
  }
1193
1195
 
1194
1196
  return 1;
@@ -1198,7 +1200,7 @@ yaml_parser_decrease_flow_level(yaml_parser_t *parser)
1198
1200
  * Push the current indentation level to the stack and set the new level
1199
1201
  * the current column is greater than the indentation level. In this case,
1200
1202
  * append or insert the specified token into the token queue.
1201
- *
1203
+ *
1202
1204
  */
1203
1205
 
1204
1206
  static int
@@ -1222,14 +1224,12 @@ yaml_parser_roll_indent(yaml_parser_t *parser, ptrdiff_t column,
1222
1224
  if (!PUSH(parser, parser->indents, parser->indent))
1223
1225
  return 0;
1224
1226
 
1225
- #if PTRDIFF_MAX > INT_MAX
1226
1227
  if (column > INT_MAX) {
1227
1228
  parser->error = YAML_MEMORY_ERROR;
1228
1229
  return 0;
1229
1230
  }
1230
- #endif
1231
1231
 
1232
- parser->indent = (int)column;
1232
+ parser->indent = column;
1233
1233
 
1234
1234
  /* Create a token and insert it into the queue. */
1235
1235
 
@@ -1251,7 +1251,7 @@ yaml_parser_roll_indent(yaml_parser_t *parser, ptrdiff_t column,
1251
1251
 
1252
1252
  /*
1253
1253
  * Pop indentation levels from the indents stack until the current level
1254
- * becomes less or equal to the column. For each indentation level, append
1254
+ * becomes less or equal to the column. For each intendation level, append
1255
1255
  * the BLOCK-END token.
1256
1256
  */
1257
1257
 
@@ -1266,7 +1266,7 @@ yaml_parser_unroll_indent(yaml_parser_t *parser, ptrdiff_t column)
1266
1266
  if (parser->flow_level)
1267
1267
  return 1;
1268
1268
 
1269
- /* Loop through the indentation levels in the stack. */
1269
+ /* Loop through the intendation levels in the stack. */
1270
1270
 
1271
1271
  while (parser->indent > column)
1272
1272
  {
@@ -1938,7 +1938,7 @@ yaml_parser_scan_to_next_token(yaml_parser_t *parser)
1938
1938
  *
1939
1939
  * - in the flow context;
1940
1940
  * - in the block context, but not at the beginning of the line or
1941
- * after '-', '?', or ':' (complex value).
1941
+ * after '-', '?', or ':' (complex value).
1942
1942
  */
1943
1943
 
1944
1944
  if (!CACHE(parser, 1)) return 0;
@@ -2053,7 +2053,7 @@ yaml_parser_scan_directive(yaml_parser_t *parser, yaml_token_t *token)
2053
2053
  else
2054
2054
  {
2055
2055
  yaml_parser_set_scanner_error(parser, "while scanning a directive",
2056
- start_mark, "found unknown directive name");
2056
+ start_mark, "found uknown directive name");
2057
2057
  goto error;
2058
2058
  }
2059
2059
 
@@ -2775,15 +2775,15 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token,
2775
2775
 
2776
2776
  if (IS_DIGIT(parser->buffer))
2777
2777
  {
2778
- /* Check that the indentation is greater than 0. */
2778
+ /* Check that the intendation is greater than 0. */
2779
2779
 
2780
2780
  if (CHECK(parser->buffer, '0')) {
2781
2781
  yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
2782
- start_mark, "found an indentation indicator equal to 0");
2782
+ start_mark, "found an intendation indicator equal to 0");
2783
2783
  goto error;
2784
2784
  }
2785
2785
 
2786
- /* Get the indentation level and eat the indicator. */
2786
+ /* Get the intendation level and eat the indicator. */
2787
2787
 
2788
2788
  increment = AS_DIGIT(parser->buffer);
2789
2789
 
@@ -2797,7 +2797,7 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token,
2797
2797
  {
2798
2798
  if (CHECK(parser->buffer, '0')) {
2799
2799
  yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
2800
- start_mark, "found an indentation indicator equal to 0");
2800
+ start_mark, "found an intendation indicator equal to 0");
2801
2801
  goto error;
2802
2802
  }
2803
2803
 
@@ -2847,7 +2847,7 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token,
2847
2847
 
2848
2848
  end_mark = parser->mark;
2849
2849
 
2850
- /* Set the indentation level if it was specified. */
2850
+ /* Set the intendation level if it was specified. */
2851
2851
 
2852
2852
  if (increment) {
2853
2853
  indent = parser->indent >= 0 ? parser->indent+increment : increment;
@@ -2913,7 +2913,7 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token,
2913
2913
 
2914
2914
  if (!READ_LINE(parser, leading_break)) goto error;
2915
2915
 
2916
- /* Eat the following indentation spaces and line breaks. */
2916
+ /* Eat the following intendation spaces and line breaks. */
2917
2917
 
2918
2918
  if (!yaml_parser_scan_block_scalar_breaks(parser,
2919
2919
  &indent, &trailing_breaks, start_mark, &end_mark)) goto error;
@@ -2948,8 +2948,8 @@ error:
2948
2948
  }
2949
2949
 
2950
2950
  /*
2951
- * Scan indentation spaces and line breaks for a block scalar. Determine the
2952
- * indentation level if needed.
2951
+ * Scan intendation spaces and line breaks for a block scalar. Determine the
2952
+ * intendation level if needed.
2953
2953
  */
2954
2954
 
2955
2955
  static int
@@ -2961,11 +2961,11 @@ yaml_parser_scan_block_scalar_breaks(yaml_parser_t *parser,
2961
2961
 
2962
2962
  *end_mark = parser->mark;
2963
2963
 
2964
- /* Eat the indentation spaces and line breaks. */
2964
+ /* Eat the intendation spaces and line breaks. */
2965
2965
 
2966
2966
  while (1)
2967
2967
  {
2968
- /* Eat the indentation spaces. */
2968
+ /* Eat the intendation spaces. */
2969
2969
 
2970
2970
  if (!CACHE(parser, 1)) return 0;
2971
2971
 
@@ -2978,12 +2978,12 @@ yaml_parser_scan_block_scalar_breaks(yaml_parser_t *parser,
2978
2978
  if ((int)parser->mark.column > max_indent)
2979
2979
  max_indent = (int)parser->mark.column;
2980
2980
 
2981
- /* Check for a tab character messing the indentation. */
2981
+ /* Check for a tab character messing the intendation. */
2982
2982
 
2983
2983
  if ((!*indent || (int)parser->mark.column < *indent)
2984
2984
  && IS_TAB(parser->buffer)) {
2985
2985
  return yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
2986
- start_mark, "found a tab character where an indentation space is expected");
2986
+ start_mark, "found a tab character where an intendation space is expected");
2987
2987
  }
2988
2988
 
2989
2989
  /* Have we found a non-empty line? */
@@ -3007,7 +3007,7 @@ yaml_parser_scan_block_scalar_breaks(yaml_parser_t *parser,
3007
3007
  *indent = 1;
3008
3008
  }
3009
3009
 
3010
- return 1;
3010
+ return 1;
3011
3011
  }
3012
3012
 
3013
3013
  /*
@@ -3504,12 +3504,12 @@ yaml_parser_scan_plain_scalar(yaml_parser_t *parser, yaml_token_t *token)
3504
3504
  {
3505
3505
  if (IS_BLANK(parser->buffer))
3506
3506
  {
3507
- /* Check for tab character that abuse indentation. */
3507
+ /* Check for tab character that abuse intendation. */
3508
3508
 
3509
3509
  if (leading_blanks && (int)parser->mark.column < indent
3510
3510
  && IS_TAB(parser->buffer)) {
3511
3511
  yaml_parser_set_scanner_error(parser, "while scanning a plain scalar",
3512
- start_mark, "found a tab character that violate indentation");
3512
+ start_mark, "found a tab character that violate intendation");
3513
3513
  goto error;
3514
3514
  }
3515
3515
 
@@ -3542,7 +3542,7 @@ yaml_parser_scan_plain_scalar(yaml_parser_t *parser, yaml_token_t *token)
3542
3542
  if (!CACHE(parser, 1)) goto error;
3543
3543
  }
3544
3544
 
3545
- /* Check indentation level. */
3545
+ /* Check intendation level. */
3546
3546
 
3547
3547
  if (!parser->flow_level && (int)parser->mark.column < indent)
3548
3548
  break;
@@ -74,7 +74,7 @@ yaml_emitter_flush(yaml_emitter_t *emitter)
74
74
  unsigned int value;
75
75
  size_t k;
76
76
 
77
- /*
77
+ /*
78
78
  * See the "reader.c" code for more details on UTF-8 encoding. Note
79
79
  * that we assume that the buffer contains a valid UTF-8 sequence.
80
80
  */
@@ -436,8 +436,7 @@ yaml_queue_extend(void **start, void **head, void **tail, void **end);
436
436
  (stack).start = (stack).top = (stack).end = 0)
437
437
 
438
438
  #define STACK_EMPTY(context,stack) \
439
- ((void)(context), \
440
- ((stack).start == (stack).top))
439
+ ((stack).start == (stack).top)
441
440
 
442
441
  #define STACK_LIMIT(context,stack,size) \
443
442
  ((stack).top - (stack).start < (size) ? \
@@ -661,4 +660,3 @@ yaml_queue_extend(void **start, void **head, void **tail, void **end);
661
660
  (node).data.mapping.pairs.end = (node_pairs_end), \
662
661
  (node).data.mapping.pairs.top = (node_pairs_start), \
663
662
  (node).data.mapping.style = (node_style))
664
-
@@ -2,30 +2,32 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "psych"
5
- s.version = "2.1.1"
5
+ s.version = "2.2.0"
6
6
  s.authors = ["Aaron Patterson", "SHIBATA Hiroshi"]
7
7
  s.email = ["aaron@tenderlovemaking.com", "hsbt@ruby-lang.org"]
8
- s.date = "2016-09-07"
8
+ s.date = "2016-11-14"
9
9
  s.summary = "Psych is a YAML parser and emitter"
10
10
  s.description = <<-DESCRIPTION
11
11
  Psych is a YAML parser and emitter. Psych leverages libyaml[http://pyyaml.org/wiki/LibYAML]
12
12
  for its YAML parsing and emitting capabilities. In addition to wrapping libyaml,
13
13
  Psych also knows how to serialize and de-serialize most Ruby objects to and from the YAML format.
14
14
  DESCRIPTION
15
- s.homepage = "http://github.com/tenderlove/psych"
15
+ s.homepage = "https://github.com/ruby/psych"
16
16
  s.licenses = ["MIT"]
17
17
  s.require_paths = ["lib"]
18
- s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
18
 
20
- s.rdoc_options = ["--main", "README.rdoc"]
21
- s.extra_rdoc_files = ["CHANGELOG.rdoc", "README.rdoc", "CHANGELOG.rdoc", "README.rdoc"]
19
+ # for ruby core repository. It was generated by `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ s.files = [".gitignore", ".travis.yml", "CHANGELOG.rdoc", "Gemfile", "Mavenfile", "README.md", "Rakefile", "bin/console", "bin/setup", "ext/java/PsychEmitter.java", "ext/java/PsychLibrary.java", "ext/java/PsychParser.java", "ext/java/PsychToRuby.java", "ext/java/PsychYamlTree.java", "ext/psych/.gitignore", "ext/psych/depend", "ext/psych/extconf.rb", "ext/psych/psych.c", "ext/psych/psych.h", "ext/psych/psych_emitter.c", "ext/psych/psych_emitter.h", "ext/psych/psych_parser.c", "ext/psych/psych_parser.h", "ext/psych/psych_to_ruby.c", "ext/psych/psych_to_ruby.h", "ext/psych/psych_yaml_tree.c", "ext/psych/psych_yaml_tree.h", "ext/psych/yaml/LICENSE", "ext/psych/yaml/api.c", "ext/psych/yaml/config.h", "ext/psych/yaml/dumper.c", "ext/psych/yaml/emitter.c", "ext/psych/yaml/loader.c", "ext/psych/yaml/parser.c", "ext/psych/yaml/reader.c", "ext/psych/yaml/scanner.c", "ext/psych/yaml/writer.c", "ext/psych/yaml/yaml.h", "ext/psych/yaml/yaml_private.h", "lib/psych.rb", "lib/psych/class_loader.rb", "lib/psych/coder.rb", "lib/psych/core_ext.rb", "lib/psych/deprecated.rb", "lib/psych/exception.rb", "lib/psych/handler.rb", "lib/psych/handlers/document_stream.rb", "lib/psych/handlers/recorder.rb", "lib/psych/json/ruby_events.rb", "lib/psych/json/stream.rb", "lib/psych/json/tree_builder.rb", "lib/psych/json/yaml_events.rb", "lib/psych/nodes.rb", "lib/psych/nodes/alias.rb", "lib/psych/nodes/document.rb", "lib/psych/nodes/mapping.rb", "lib/psych/nodes/node.rb", "lib/psych/nodes/scalar.rb", "lib/psych/nodes/sequence.rb", "lib/psych/nodes/stream.rb", "lib/psych/omap.rb", "lib/psych/parser.rb", "lib/psych/scalar_scanner.rb", "lib/psych/set.rb", "lib/psych/stream.rb", "lib/psych/streaming.rb", "lib/psych/syntax_error.rb", "lib/psych/tree_builder.rb", "lib/psych/versions.rb", "lib/psych/visitors.rb","lib/psych/visitors/depth_first.rb", "lib/psych/visitors/emitter.rb", "lib/psych/visitors/json_tree.rb", "lib/psych/visitors/to_ruby.rb", "lib/psych/visitors/visitor.rb", "lib/psych/visitors/yaml_tree.rb", "lib/psych/y.rb", "lib/psych_jars.rb", "psych.gemspec"]
21
+
22
+ s.rdoc_options = ["--main", "README.md"]
23
+ s.extra_rdoc_files = ["CHANGELOG.rdoc", "README.md"]
22
24
 
23
25
  s.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
24
26
  s.rubygems_version = "2.5.1"
25
27
  s.required_rubygems_version = Gem::Requirement.new(">= 0")
26
28
 
27
- s.add_development_dependency(%q<rake-compiler>, [">= 0.4.1"])
28
- s.add_development_dependency(%q<minitest>, ["~> 5.0"])
29
+ s.add_development_dependency 'rake-compiler', ">= 0.4.1"
30
+ s.add_development_dependency 'minitest', "~> 5.0"
29
31
 
30
32
  if RUBY_PLATFORM =~ /java/
31
33
  require 'psych/versions'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: psych
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-09-07 00:00:00.000000000 Z
12
+ date: 2016-11-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler
@@ -51,14 +51,14 @@ extensions:
51
51
  - ext/psych/extconf.rb
52
52
  extra_rdoc_files:
53
53
  - CHANGELOG.rdoc
54
- - README.rdoc
54
+ - README.md
55
55
  files:
56
56
  - ".gitignore"
57
57
  - ".travis.yml"
58
58
  - CHANGELOG.rdoc
59
59
  - Gemfile
60
60
  - Mavenfile
61
- - README.rdoc
61
+ - README.md
62
62
  - Rakefile
63
63
  - bin/console
64
64
  - bin/setup
@@ -132,14 +132,14 @@ files:
132
132
  - lib/psych/y.rb
133
133
  - lib/psych_jars.rb
134
134
  - psych.gemspec
135
- homepage: http://github.com/tenderlove/psych
135
+ homepage: https://github.com/ruby/psych
136
136
  licenses:
137
137
  - MIT
138
138
  metadata: {}
139
139
  post_install_message:
140
140
  rdoc_options:
141
141
  - "--main"
142
- - README.rdoc
142
+ - README.md
143
143
  require_paths:
144
144
  - lib
145
145
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  version: '0'
155
155
  requirements: []
156
156
  rubyforge_project:
157
- rubygems_version: 2.6.6
157
+ rubygems_version: 2.6.8
158
158
  signing_key:
159
159
  specification_version: 4
160
160
  summary: Psych is a YAML parser and emitter
@@ -1,71 +0,0 @@
1
- = Psych
2
-
3
- * http://github.com/tenderlove/psych
4
-
5
- == Description
6
-
7
- Psych is a YAML parser and emitter. Psych leverages libyaml[http://pyyaml.org/wiki/LibYAML]
8
- for its YAML parsing and emitting capabilities. In addition to wrapping
9
- libyaml, Psych also knows how to serialize and de-serialize most Ruby objects
10
- to and from the YAML format.
11
-
12
- == Examples
13
-
14
- # Load YAML in to a Ruby object
15
- Psych.load('--- foo') # => 'foo'
16
-
17
- # Emit YAML from a Ruby object
18
- Psych.dump("foo") # => "--- foo\n...\n"
19
-
20
- == Dependencies
21
-
22
- * libyaml
23
-
24
- == Installation
25
-
26
- Psych has been included with MRI since 1.9.2,
27
- and is the default YAML parser in 1.9.3.
28
-
29
- If you want a newer gem release of Psych, you can use rubygems:
30
-
31
- gem install psych
32
-
33
- In order to use the gem release in your app,
34
- and not the stdlib version, you'll need the following:
35
-
36
- gem 'psych'
37
- require 'psych'
38
-
39
- Or if you use Bundler add this to your +Gemfile+:
40
-
41
- gem 'psych'
42
-
43
- JRuby ships with a pure Java implementation of Psych.
44
-
45
- If you're on Rubinius, Psych is available in 1.9 mode, please refer to the
46
- Language Modes section of the {Rubinius
47
- README}[https://github.com/rubinius/rubinius#readme] for more information on
48
- building and 1.9 mode.
49
-
50
- == License
51
-
52
- Copyright 2009 Aaron Patterson, et al.
53
-
54
- Permission is hereby granted, free of charge, to any person obtaining
55
- a copy of this software and associated documentation files (the
56
- 'Software'), to deal in the Software without restriction, including
57
- without limitation the rights to use, copy, modify, merge, publish,
58
- distribute, sublicense, and/or sell copies of the Software, and to
59
- permit persons to whom the Software is furnished to do so, subject to
60
- the following conditions:
61
-
62
- The above copyright notice and this permission notice shall be
63
- included in all copies or substantial portions of the Software.
64
-
65
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
66
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
67
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
68
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
69
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
70
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
71
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.