psych 3.0.3.pre3-java → 3.2.1-java
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 +4 -4
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +3 -6
- data/Rakefile +2 -16
- data/ext/java/{PsychEmitter.java → org/jruby/ext/psych/PsychEmitter.java} +9 -3
- data/ext/java/{PsychLibrary.java → org/jruby/ext/psych/PsychLibrary.java} +25 -1
- data/ext/java/{PsychParser.java → org/jruby/ext/psych/PsychParser.java} +0 -0
- data/ext/java/{PsychToRuby.java → org/jruby/ext/psych/PsychToRuby.java} +0 -0
- data/ext/java/{PsychYamlTree.java → org/jruby/ext/psych/PsychYamlTree.java} +0 -8
- data/ext/psych/depend +2 -0
- data/ext/psych/extconf.rb +6 -2
- data/ext/psych/psych.c +3 -3
- data/ext/psych/psych_parser.c +20 -33
- data/ext/psych/psych_yaml_tree.c +0 -12
- data/ext/psych/yaml/api.c +48 -47
- data/ext/psych/yaml/config.h +77 -7
- data/ext/psych/yaml/dumper.c +3 -3
- data/ext/psych/yaml/emitter.c +48 -19
- data/ext/psych/yaml/loader.c +210 -110
- data/ext/psych/yaml/parser.c +11 -6
- data/ext/psych/yaml/reader.c +3 -3
- data/ext/psych/yaml/scanner.c +52 -28
- data/ext/psych/yaml/yaml.h +44 -30
- data/ext/psych/yaml/yaml_private.h +46 -20
- data/lib/psych.rb +138 -64
- data/lib/psych/handler.rb +1 -1
- data/lib/psych/nodes/node.rb +2 -2
- data/lib/psych/scalar_scanner.rb +23 -36
- data/lib/psych/versions.rb +4 -3
- data/lib/psych/visitors/to_ruby.rb +42 -11
- data/lib/psych/visitors/yaml_tree.rb +29 -41
- data/psych.gemspec +18 -14
- metadata +13 -58
- data/.travis.yml +0 -20
- data/CHANGELOG.rdoc +0 -576
data/ext/psych/psych_yaml_tree.c
CHANGED
@@ -2,23 +2,11 @@
|
|
2
2
|
|
3
3
|
VALUE cPsychVisitorsYamlTree;
|
4
4
|
|
5
|
-
/*
|
6
|
-
* call-seq: private_iv_get(target, prop)
|
7
|
-
*
|
8
|
-
* Get the private instance variable +prop+ from +target+
|
9
|
-
*/
|
10
|
-
static VALUE private_iv_get(VALUE self, VALUE target, VALUE prop)
|
11
|
-
{
|
12
|
-
return rb_attr_get(target, rb_intern(StringValueCStr(prop)));
|
13
|
-
}
|
14
|
-
|
15
5
|
void Init_psych_yaml_tree(void)
|
16
6
|
{
|
17
7
|
VALUE psych = rb_define_module("Psych");
|
18
8
|
VALUE visitors = rb_define_module_under(psych, "Visitors");
|
19
9
|
VALUE visitor = rb_define_class_under(visitors, "Visitor", rb_cObject);
|
20
10
|
cPsychVisitorsYamlTree = rb_define_class_under(visitors, "YAMLTree", visitor);
|
21
|
-
|
22
|
-
rb_define_private_method(cPsychVisitorsYamlTree, "private_iv_get", private_iv_get, 2);
|
23
11
|
}
|
24
12
|
/* vim: set noet sws=4 sw=4: */
|
data/ext/psych/yaml/api.c
CHANGED
@@ -74,7 +74,7 @@ YAML_DECLARE(int)
|
|
74
74
|
yaml_string_extend(yaml_char_t **start,
|
75
75
|
yaml_char_t **pointer, yaml_char_t **end)
|
76
76
|
{
|
77
|
-
yaml_char_t *new_start = yaml_realloc(*start, (*end - *start)*2);
|
77
|
+
yaml_char_t *new_start = (yaml_char_t *)yaml_realloc((void*)*start, (*end - *start)*2);
|
78
78
|
|
79
79
|
if (!new_start) return 0;
|
80
80
|
|
@@ -94,8 +94,9 @@ yaml_string_extend(yaml_char_t **start,
|
|
94
94
|
YAML_DECLARE(int)
|
95
95
|
yaml_string_join(
|
96
96
|
yaml_char_t **a_start, yaml_char_t **a_pointer, yaml_char_t **a_end,
|
97
|
-
yaml_char_t **b_start, yaml_char_t **b_pointer, yaml_char_t **b_end)
|
97
|
+
yaml_char_t **b_start, yaml_char_t **b_pointer, SHIM(yaml_char_t **b_end))
|
98
98
|
{
|
99
|
+
UNUSED_PARAM(b_end)
|
99
100
|
if (*b_start == *b_pointer)
|
100
101
|
return 1;
|
101
102
|
|
@@ -117,7 +118,12 @@ yaml_string_join(
|
|
117
118
|
YAML_DECLARE(int)
|
118
119
|
yaml_stack_extend(void **start, void **top, void **end)
|
119
120
|
{
|
120
|
-
void *new_start
|
121
|
+
void *new_start;
|
122
|
+
|
123
|
+
if ((char *)*end - (char *)*start >= INT_MAX / 2)
|
124
|
+
return 0;
|
125
|
+
|
126
|
+
new_start = yaml_realloc(*start, ((char *)*end - (char *)*start)*2);
|
121
127
|
|
122
128
|
if (!new_start) return 0;
|
123
129
|
|
@@ -177,17 +183,17 @@ yaml_parser_initialize(yaml_parser_t *parser)
|
|
177
183
|
goto error;
|
178
184
|
if (!BUFFER_INIT(parser, parser->buffer, INPUT_BUFFER_SIZE))
|
179
185
|
goto error;
|
180
|
-
if (!QUEUE_INIT(parser, parser->tokens, INITIAL_QUEUE_SIZE))
|
186
|
+
if (!QUEUE_INIT(parser, parser->tokens, INITIAL_QUEUE_SIZE, yaml_token_t*))
|
181
187
|
goto error;
|
182
|
-
if (!STACK_INIT(parser, parser->indents,
|
188
|
+
if (!STACK_INIT(parser, parser->indents, int*))
|
183
189
|
goto error;
|
184
|
-
if (!STACK_INIT(parser, parser->simple_keys,
|
190
|
+
if (!STACK_INIT(parser, parser->simple_keys, yaml_simple_key_t*))
|
185
191
|
goto error;
|
186
|
-
if (!STACK_INIT(parser, parser->states,
|
192
|
+
if (!STACK_INIT(parser, parser->states, yaml_parser_state_t*))
|
187
193
|
goto error;
|
188
|
-
if (!STACK_INIT(parser, parser->marks,
|
194
|
+
if (!STACK_INIT(parser, parser->marks, yaml_mark_t*))
|
189
195
|
goto error;
|
190
|
-
if (!STACK_INIT(parser, parser->tag_directives,
|
196
|
+
if (!STACK_INIT(parser, parser->tag_directives, yaml_tag_directive_t*))
|
191
197
|
goto error;
|
192
198
|
|
193
199
|
return 1;
|
@@ -243,7 +249,7 @@ static int
|
|
243
249
|
yaml_string_read_handler(void *data, unsigned char *buffer, size_t size,
|
244
250
|
size_t *size_read)
|
245
251
|
{
|
246
|
-
yaml_parser_t *parser = data;
|
252
|
+
yaml_parser_t *parser = (yaml_parser_t *)data;
|
247
253
|
|
248
254
|
if (parser->input.string.current == parser->input.string.end) {
|
249
255
|
*size_read = 0;
|
@@ -269,7 +275,7 @@ static int
|
|
269
275
|
yaml_file_read_handler(void *data, unsigned char *buffer, size_t size,
|
270
276
|
size_t *size_read)
|
271
277
|
{
|
272
|
-
yaml_parser_t *parser = data;
|
278
|
+
yaml_parser_t *parser = (yaml_parser_t *)data;
|
273
279
|
|
274
280
|
*size_read = fread(buffer, 1, size, parser->input.file);
|
275
281
|
return !ferror(parser->input.file);
|
@@ -355,13 +361,13 @@ yaml_emitter_initialize(yaml_emitter_t *emitter)
|
|
355
361
|
goto error;
|
356
362
|
if (!BUFFER_INIT(emitter, emitter->raw_buffer, OUTPUT_RAW_BUFFER_SIZE))
|
357
363
|
goto error;
|
358
|
-
if (!STACK_INIT(emitter, emitter->states,
|
364
|
+
if (!STACK_INIT(emitter, emitter->states, yaml_emitter_state_t*))
|
359
365
|
goto error;
|
360
|
-
if (!QUEUE_INIT(emitter, emitter->events, INITIAL_QUEUE_SIZE))
|
366
|
+
if (!QUEUE_INIT(emitter, emitter->events, INITIAL_QUEUE_SIZE, yaml_event_t*))
|
361
367
|
goto error;
|
362
|
-
if (!STACK_INIT(emitter, emitter->indents,
|
368
|
+
if (!STACK_INIT(emitter, emitter->indents, int*))
|
363
369
|
goto error;
|
364
|
-
if (!STACK_INIT(emitter, emitter->tag_directives,
|
370
|
+
if (!STACK_INIT(emitter, emitter->tag_directives, yaml_tag_directive_t*))
|
365
371
|
goto error;
|
366
372
|
|
367
373
|
return 1;
|
@@ -413,7 +419,7 @@ yaml_emitter_delete(yaml_emitter_t *emitter)
|
|
413
419
|
static int
|
414
420
|
yaml_string_write_handler(void *data, unsigned char *buffer, size_t size)
|
415
421
|
{
|
416
|
-
|
422
|
+
yaml_emitter_t *emitter = (yaml_emitter_t *)data;
|
417
423
|
|
418
424
|
if (emitter->output.string.size - *emitter->output.string.size_written
|
419
425
|
< size) {
|
@@ -439,7 +445,7 @@ yaml_string_write_handler(void *data, unsigned char *buffer, size_t size)
|
|
439
445
|
static int
|
440
446
|
yaml_file_write_handler(void *data, unsigned char *buffer, size_t size)
|
441
447
|
{
|
442
|
-
yaml_emitter_t *emitter = data;
|
448
|
+
yaml_emitter_t *emitter = (yaml_emitter_t *)data;
|
443
449
|
|
444
450
|
return (fwrite(buffer, 1, size, emitter->output.file) == size);
|
445
451
|
}
|
@@ -617,10 +623,10 @@ yaml_token_delete(yaml_token_t *token)
|
|
617
623
|
*/
|
618
624
|
|
619
625
|
static int
|
620
|
-
yaml_check_utf8(yaml_char_t *start, size_t length)
|
626
|
+
yaml_check_utf8(const yaml_char_t *start, size_t length)
|
621
627
|
{
|
622
|
-
yaml_char_t *end = start+length;
|
623
|
-
yaml_char_t *pointer = start;
|
628
|
+
const yaml_char_t *end = start+length;
|
629
|
+
const yaml_char_t *pointer = start;
|
624
630
|
|
625
631
|
while (pointer < end) {
|
626
632
|
unsigned char octet;
|
@@ -717,7 +723,7 @@ yaml_document_start_event_initialize(yaml_event_t *event,
|
|
717
723
|
/* Valid tag directives are expected. */
|
718
724
|
|
719
725
|
if (version_directive) {
|
720
|
-
version_directive_copy =
|
726
|
+
version_directive_copy = YAML_MALLOC_STATIC(yaml_version_directive_t);
|
721
727
|
if (!version_directive_copy) goto error;
|
722
728
|
version_directive_copy->major = version_directive->major;
|
723
729
|
version_directive_copy->minor = version_directive->minor;
|
@@ -725,7 +731,7 @@ yaml_document_start_event_initialize(yaml_event_t *event,
|
|
725
731
|
|
726
732
|
if (tag_directives_start != tag_directives_end) {
|
727
733
|
yaml_tag_directive_t *tag_directive;
|
728
|
-
if (!STACK_INIT(&context, tag_directives_copy,
|
734
|
+
if (!STACK_INIT(&context, tag_directives_copy, yaml_tag_directive_t*))
|
729
735
|
goto error;
|
730
736
|
for (tag_directive = tag_directives_start;
|
731
737
|
tag_directive != tag_directives_end; tag_directive ++) {
|
@@ -788,7 +794,7 @@ yaml_document_end_event_initialize(yaml_event_t *event, int implicit)
|
|
788
794
|
*/
|
789
795
|
|
790
796
|
YAML_DECLARE(int)
|
791
|
-
yaml_alias_event_initialize(yaml_event_t *event, yaml_char_t *anchor)
|
797
|
+
yaml_alias_event_initialize(yaml_event_t *event, const yaml_char_t *anchor)
|
792
798
|
{
|
793
799
|
yaml_mark_t mark = { 0, 0, 0 };
|
794
800
|
yaml_char_t *anchor_copy = NULL;
|
@@ -813,8 +819,8 @@ yaml_alias_event_initialize(yaml_event_t *event, yaml_char_t *anchor)
|
|
813
819
|
|
814
820
|
YAML_DECLARE(int)
|
815
821
|
yaml_scalar_event_initialize(yaml_event_t *event,
|
816
|
-
yaml_char_t *anchor, yaml_char_t *tag,
|
817
|
-
yaml_char_t *value, int length,
|
822
|
+
const yaml_char_t *anchor, const yaml_char_t *tag,
|
823
|
+
const yaml_char_t *value, int length,
|
818
824
|
int plain_implicit, int quoted_implicit,
|
819
825
|
yaml_scalar_style_t style)
|
820
826
|
{
|
@@ -839,11 +845,11 @@ yaml_scalar_event_initialize(yaml_event_t *event,
|
|
839
845
|
}
|
840
846
|
|
841
847
|
if (length < 0) {
|
842
|
-
length = strlen((char *)value);
|
848
|
+
length = (int)strlen((char *)value);
|
843
849
|
}
|
844
850
|
|
845
851
|
if (!yaml_check_utf8(value, length)) goto error;
|
846
|
-
value_copy =
|
852
|
+
value_copy = YAML_MALLOC(length+1);
|
847
853
|
if (!value_copy) goto error;
|
848
854
|
memcpy(value_copy, value, length);
|
849
855
|
value_copy[length] = '\0';
|
@@ -867,7 +873,7 @@ error:
|
|
867
873
|
|
868
874
|
YAML_DECLARE(int)
|
869
875
|
yaml_sequence_start_event_initialize(yaml_event_t *event,
|
870
|
-
yaml_char_t *anchor, yaml_char_t *tag, int implicit,
|
876
|
+
const yaml_char_t *anchor, const yaml_char_t *tag, int implicit,
|
871
877
|
yaml_sequence_style_t style)
|
872
878
|
{
|
873
879
|
yaml_mark_t mark = { 0, 0, 0 };
|
@@ -922,7 +928,7 @@ yaml_sequence_end_event_initialize(yaml_event_t *event)
|
|
922
928
|
|
923
929
|
YAML_DECLARE(int)
|
924
930
|
yaml_mapping_start_event_initialize(yaml_event_t *event,
|
925
|
-
yaml_char_t *anchor, yaml_char_t *tag, int implicit,
|
931
|
+
const yaml_char_t *anchor, const yaml_char_t *tag, int implicit,
|
926
932
|
yaml_mapping_style_t style)
|
927
933
|
{
|
928
934
|
yaml_mark_t mark = { 0, 0, 0 };
|
@@ -1055,10 +1061,10 @@ yaml_document_initialize(yaml_document_t *document,
|
|
1055
1061
|
(tag_directives_start == tag_directives_end));
|
1056
1062
|
/* Valid tag directives are expected. */
|
1057
1063
|
|
1058
|
-
if (!STACK_INIT(&context, nodes,
|
1064
|
+
if (!STACK_INIT(&context, nodes, yaml_node_t*)) goto error;
|
1059
1065
|
|
1060
1066
|
if (version_directive) {
|
1061
|
-
version_directive_copy =
|
1067
|
+
version_directive_copy = YAML_MALLOC_STATIC(yaml_version_directive_t);
|
1062
1068
|
if (!version_directive_copy) goto error;
|
1063
1069
|
version_directive_copy->major = version_directive->major;
|
1064
1070
|
version_directive_copy->minor = version_directive->minor;
|
@@ -1066,7 +1072,7 @@ yaml_document_initialize(yaml_document_t *document,
|
|
1066
1072
|
|
1067
1073
|
if (tag_directives_start != tag_directives_end) {
|
1068
1074
|
yaml_tag_directive_t *tag_directive;
|
1069
|
-
if (!STACK_INIT(&context, tag_directives_copy,
|
1075
|
+
if (!STACK_INIT(&context, tag_directives_copy, yaml_tag_directive_t*))
|
1070
1076
|
goto error;
|
1071
1077
|
for (tag_directive = tag_directives_start;
|
1072
1078
|
tag_directive != tag_directives_end; tag_directive ++) {
|
@@ -1116,13 +1122,8 @@ error:
|
|
1116
1122
|
YAML_DECLARE(void)
|
1117
1123
|
yaml_document_delete(yaml_document_t *document)
|
1118
1124
|
{
|
1119
|
-
struct {
|
1120
|
-
yaml_error_type_t error;
|
1121
|
-
} context;
|
1122
1125
|
yaml_tag_directive_t *tag_directive;
|
1123
1126
|
|
1124
|
-
context.error = YAML_NO_ERROR; /* Eliminate a compliler warning. */
|
1125
|
-
|
1126
1127
|
assert(document); /* Non-NULL document object is expected. */
|
1127
1128
|
|
1128
1129
|
while (!STACK_EMPTY(&context, document->nodes)) {
|
@@ -1192,7 +1193,7 @@ yaml_document_get_root_node(yaml_document_t *document)
|
|
1192
1193
|
|
1193
1194
|
YAML_DECLARE(int)
|
1194
1195
|
yaml_document_add_scalar(yaml_document_t *document,
|
1195
|
-
yaml_char_t *tag, yaml_char_t *value, int length,
|
1196
|
+
const yaml_char_t *tag, const yaml_char_t *value, int length,
|
1196
1197
|
yaml_scalar_style_t style)
|
1197
1198
|
{
|
1198
1199
|
struct {
|
@@ -1215,11 +1216,11 @@ yaml_document_add_scalar(yaml_document_t *document,
|
|
1215
1216
|
if (!tag_copy) goto error;
|
1216
1217
|
|
1217
1218
|
if (length < 0) {
|
1218
|
-
length = strlen((char *)value);
|
1219
|
+
length = (int)strlen((char *)value);
|
1219
1220
|
}
|
1220
1221
|
|
1221
1222
|
if (!yaml_check_utf8(value, length)) goto error;
|
1222
|
-
value_copy =
|
1223
|
+
value_copy = YAML_MALLOC(length+1);
|
1223
1224
|
if (!value_copy) goto error;
|
1224
1225
|
memcpy(value_copy, value, length);
|
1225
1226
|
value_copy[length] = '\0';
|
@@ -1227,7 +1228,7 @@ yaml_document_add_scalar(yaml_document_t *document,
|
|
1227
1228
|
SCALAR_NODE_INIT(node, tag_copy, value_copy, length, style, mark, mark);
|
1228
1229
|
if (!PUSH(&context, document->nodes, node)) goto error;
|
1229
1230
|
|
1230
|
-
return document->nodes.top - document->nodes.start;
|
1231
|
+
return (int)(document->nodes.top - document->nodes.start);
|
1231
1232
|
|
1232
1233
|
error:
|
1233
1234
|
yaml_free(tag_copy);
|
@@ -1242,7 +1243,7 @@ error:
|
|
1242
1243
|
|
1243
1244
|
YAML_DECLARE(int)
|
1244
1245
|
yaml_document_add_sequence(yaml_document_t *document,
|
1245
|
-
yaml_char_t *tag, yaml_sequence_style_t style)
|
1246
|
+
const yaml_char_t *tag, yaml_sequence_style_t style)
|
1246
1247
|
{
|
1247
1248
|
struct {
|
1248
1249
|
yaml_error_type_t error;
|
@@ -1266,13 +1267,13 @@ yaml_document_add_sequence(yaml_document_t *document,
|
|
1266
1267
|
tag_copy = yaml_strdup(tag);
|
1267
1268
|
if (!tag_copy) goto error;
|
1268
1269
|
|
1269
|
-
if (!STACK_INIT(&context, items,
|
1270
|
+
if (!STACK_INIT(&context, items, yaml_node_item_t*)) goto error;
|
1270
1271
|
|
1271
1272
|
SEQUENCE_NODE_INIT(node, tag_copy, items.start, items.end,
|
1272
1273
|
style, mark, mark);
|
1273
1274
|
if (!PUSH(&context, document->nodes, node)) goto error;
|
1274
1275
|
|
1275
|
-
return document->nodes.top - document->nodes.start;
|
1276
|
+
return (int)(document->nodes.top - document->nodes.start);
|
1276
1277
|
|
1277
1278
|
error:
|
1278
1279
|
STACK_DEL(&context, items);
|
@@ -1287,7 +1288,7 @@ error:
|
|
1287
1288
|
|
1288
1289
|
YAML_DECLARE(int)
|
1289
1290
|
yaml_document_add_mapping(yaml_document_t *document,
|
1290
|
-
yaml_char_t *tag, yaml_mapping_style_t style)
|
1291
|
+
const yaml_char_t *tag, yaml_mapping_style_t style)
|
1291
1292
|
{
|
1292
1293
|
struct {
|
1293
1294
|
yaml_error_type_t error;
|
@@ -1311,13 +1312,13 @@ yaml_document_add_mapping(yaml_document_t *document,
|
|
1311
1312
|
tag_copy = yaml_strdup(tag);
|
1312
1313
|
if (!tag_copy) goto error;
|
1313
1314
|
|
1314
|
-
if (!STACK_INIT(&context, pairs,
|
1315
|
+
if (!STACK_INIT(&context, pairs, yaml_node_pair_t*)) goto error;
|
1315
1316
|
|
1316
1317
|
MAPPING_NODE_INIT(node, tag_copy, pairs.start, pairs.end,
|
1317
1318
|
style, mark, mark);
|
1318
1319
|
if (!PUSH(&context, document->nodes, node)) goto error;
|
1319
1320
|
|
1320
|
-
return document->nodes.top - document->nodes.start;
|
1321
|
+
return (int)(document->nodes.top - document->nodes.start);
|
1321
1322
|
|
1322
1323
|
error:
|
1323
1324
|
STACK_DEL(&context, pairs);
|
data/ext/psych/yaml/config.h
CHANGED
@@ -1,10 +1,80 @@
|
|
1
|
+
/* include/config.h. Generated from config.h.in by configure. */
|
2
|
+
/* include/config.h.in. Generated from configure.ac by autoheader. */
|
3
|
+
|
4
|
+
/* Define to 1 if you have the <dlfcn.h> header file. */
|
5
|
+
#define HAVE_DLFCN_H 1
|
6
|
+
|
7
|
+
/* Define to 1 if you have the <inttypes.h> header file. */
|
8
|
+
#define HAVE_INTTYPES_H 1
|
9
|
+
|
10
|
+
/* Define to 1 if you have the <memory.h> header file. */
|
11
|
+
#define HAVE_MEMORY_H 1
|
12
|
+
|
13
|
+
/* Define to 1 if you have the <stdint.h> header file. */
|
14
|
+
#define HAVE_STDINT_H 1
|
15
|
+
|
16
|
+
/* Define to 1 if you have the <stdlib.h> header file. */
|
17
|
+
#define HAVE_STDLIB_H 1
|
18
|
+
|
19
|
+
/* Define to 1 if you have the <strings.h> header file. */
|
20
|
+
#define HAVE_STRINGS_H 1
|
21
|
+
|
22
|
+
/* Define to 1 if you have the <string.h> header file. */
|
23
|
+
#define HAVE_STRING_H 1
|
24
|
+
|
25
|
+
/* Define to 1 if you have the <sys/stat.h> header file. */
|
26
|
+
#define HAVE_SYS_STAT_H 1
|
27
|
+
|
28
|
+
/* Define to 1 if you have the <sys/types.h> header file. */
|
29
|
+
#define HAVE_SYS_TYPES_H 1
|
30
|
+
|
31
|
+
/* Define to 1 if you have the <unistd.h> header file. */
|
32
|
+
#define HAVE_UNISTD_H 1
|
33
|
+
|
34
|
+
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
35
|
+
#define LT_OBJDIR ".libs/"
|
36
|
+
|
37
|
+
/* Name of package */
|
38
|
+
#define PACKAGE "yaml"
|
39
|
+
|
40
|
+
/* Define to the address where bug reports for this package should be sent. */
|
41
|
+
#define PACKAGE_BUGREPORT "https://github.com/yaml/libyaml/issues/new"
|
42
|
+
|
43
|
+
/* Define to the full name of this package. */
|
1
44
|
#define PACKAGE_NAME "yaml"
|
45
|
+
|
46
|
+
/* Define to the full name and version of this package. */
|
47
|
+
#define PACKAGE_STRING "yaml 0.2.5"
|
48
|
+
|
49
|
+
/* Define to the one symbol short name of this package. */
|
2
50
|
#define PACKAGE_TARNAME "yaml"
|
3
|
-
|
4
|
-
|
5
|
-
#define
|
6
|
-
|
51
|
+
|
52
|
+
/* Define to the home page for this package. */
|
53
|
+
#define PACKAGE_URL ""
|
54
|
+
|
55
|
+
/* Define to the version of this package. */
|
56
|
+
#define PACKAGE_VERSION "0.2.5"
|
57
|
+
|
58
|
+
/* Define to 1 if you have the ANSI C header files. */
|
59
|
+
#define STDC_HEADERS 1
|
60
|
+
|
61
|
+
/* Version number of package */
|
62
|
+
#define VERSION "0.2.5"
|
63
|
+
|
64
|
+
/* Define the major version number. */
|
7
65
|
#define YAML_VERSION_MAJOR 0
|
8
|
-
|
9
|
-
|
10
|
-
#define
|
66
|
+
|
67
|
+
/* Define the minor version number. */
|
68
|
+
#define YAML_VERSION_MINOR 2
|
69
|
+
|
70
|
+
/* Define the patch version number. */
|
71
|
+
#define YAML_VERSION_PATCH 5
|
72
|
+
|
73
|
+
/* Define the version string. */
|
74
|
+
#define YAML_VERSION_STRING "0.2.5"
|
75
|
+
|
76
|
+
/* Define to empty if `const' does not conform to ANSI C. */
|
77
|
+
/* #undef const */
|
78
|
+
|
79
|
+
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
80
|
+
/* #undef size_t */
|
data/ext/psych/yaml/dumper.c
CHANGED
@@ -131,7 +131,7 @@ yaml_emitter_dump(yaml_emitter_t *emitter, yaml_document_t *document)
|
|
131
131
|
|
132
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
135
|
* (document->nodes.top - document->nodes.start));
|
136
136
|
if (!emitter->anchors) goto error;
|
137
137
|
memset(emitter->anchors, 0, sizeof(*(emitter->anchors))
|
@@ -245,9 +245,9 @@ yaml_emitter_anchor_node(yaml_emitter_t *emitter, int index)
|
|
245
245
|
#define ANCHOR_TEMPLATE_LENGTH 16
|
246
246
|
|
247
247
|
static yaml_char_t *
|
248
|
-
yaml_emitter_generate_anchor(yaml_emitter_t *emitter, int anchor_id)
|
248
|
+
yaml_emitter_generate_anchor(SHIM(yaml_emitter_t *emitter), int anchor_id)
|
249
249
|
{
|
250
|
-
yaml_char_t *anchor =
|
250
|
+
yaml_char_t *anchor = YAML_MALLOC(ANCHOR_TEMPLATE_LENGTH);
|
251
251
|
|
252
252
|
if (!anchor) return NULL;
|
253
253
|
|
data/ext/psych/yaml/emitter.c
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
#define PUT(emitter,value) \
|
17
17
|
(FLUSH(emitter) \
|
18
18
|
&& (*(emitter->buffer.pointer++) = (yaml_char_t)(value), \
|
19
|
-
emitter->column
|
19
|
+
emitter->column++, \
|
20
20
|
1))
|
21
21
|
|
22
22
|
/*
|
@@ -24,7 +24,7 @@
|
|
24
24
|
*/
|
25
25
|
|
26
26
|
#define PUT_BREAK(emitter) \
|
27
|
-
(FLUSH(emitter) ?
|
27
|
+
(FLUSH(emitter) ? \
|
28
28
|
((emitter->line_break == YAML_CR_BREAK ? \
|
29
29
|
(*(emitter->buffer.pointer++) = (yaml_char_t) '\r') : \
|
30
30
|
emitter->line_break == YAML_LN_BREAK ? \
|
@@ -495,6 +495,7 @@ static int
|
|
495
495
|
yaml_emitter_emit_stream_start(yaml_emitter_t *emitter,
|
496
496
|
yaml_event_t *event)
|
497
497
|
{
|
498
|
+
emitter->open_ended = 0;
|
498
499
|
if (event->type == YAML_STREAM_START_EVENT)
|
499
500
|
{
|
500
501
|
if (!emitter->encoding) {
|
@@ -597,13 +598,20 @@ yaml_emitter_emit_document_start(yaml_emitter_t *emitter,
|
|
597
598
|
if (!yaml_emitter_write_indent(emitter))
|
598
599
|
return 0;
|
599
600
|
}
|
601
|
+
emitter->open_ended = 0;
|
600
602
|
|
601
603
|
if (event->data.document_start.version_directive) {
|
602
604
|
implicit = 0;
|
603
605
|
if (!yaml_emitter_write_indicator(emitter, "%YAML", 1, 0, 0))
|
604
606
|
return 0;
|
605
|
-
if (
|
606
|
-
|
607
|
+
if (event->data.document_start.version_directive->minor == 1) {
|
608
|
+
if (!yaml_emitter_write_indicator(emitter, "1.1", 1, 0, 0))
|
609
|
+
return 0;
|
610
|
+
}
|
611
|
+
else {
|
612
|
+
if (!yaml_emitter_write_indicator(emitter, "1.2", 1, 0, 0))
|
613
|
+
return 0;
|
614
|
+
}
|
607
615
|
if (!yaml_emitter_write_indent(emitter))
|
608
616
|
return 0;
|
609
617
|
}
|
@@ -644,19 +652,25 @@ yaml_emitter_emit_document_start(yaml_emitter_t *emitter,
|
|
644
652
|
|
645
653
|
emitter->state = YAML_EMIT_DOCUMENT_CONTENT_STATE;
|
646
654
|
|
655
|
+
emitter->open_ended = 0;
|
647
656
|
return 1;
|
648
657
|
}
|
649
658
|
|
650
659
|
else if (event->type == YAML_STREAM_END_EVENT)
|
651
660
|
{
|
652
|
-
|
661
|
+
|
662
|
+
/**
|
663
|
+
* This can happen if a block scalar with trailing empty lines
|
664
|
+
* is at the end of the stream
|
665
|
+
*/
|
666
|
+
if (emitter->open_ended == 2)
|
653
667
|
{
|
654
668
|
if (!yaml_emitter_write_indicator(emitter, "...", 1, 0, 0))
|
655
669
|
return 0;
|
670
|
+
emitter->open_ended = 0;
|
656
671
|
if (!yaml_emitter_write_indent(emitter))
|
657
672
|
return 0;
|
658
673
|
}
|
659
|
-
|
660
674
|
if (!yaml_emitter_flush(emitter))
|
661
675
|
return 0;
|
662
676
|
|
@@ -698,9 +712,12 @@ yaml_emitter_emit_document_end(yaml_emitter_t *emitter,
|
|
698
712
|
if (!event->data.document_end.implicit) {
|
699
713
|
if (!yaml_emitter_write_indicator(emitter, "...", 1, 0, 0))
|
700
714
|
return 0;
|
715
|
+
emitter->open_ended = 0;
|
701
716
|
if (!yaml_emitter_write_indent(emitter))
|
702
717
|
return 0;
|
703
718
|
}
|
719
|
+
else if (!emitter->open_ended)
|
720
|
+
emitter->open_ended = 1;
|
704
721
|
if (!yaml_emitter_flush(emitter))
|
705
722
|
return 0;
|
706
723
|
|
@@ -1002,10 +1019,12 @@ yaml_emitter_emit_node(yaml_emitter_t *emitter, yaml_event_t *event,
|
|
1002
1019
|
*/
|
1003
1020
|
|
1004
1021
|
static int
|
1005
|
-
yaml_emitter_emit_alias(yaml_emitter_t *emitter, yaml_event_t *event)
|
1022
|
+
yaml_emitter_emit_alias(yaml_emitter_t *emitter, SHIM(yaml_event_t *event))
|
1006
1023
|
{
|
1007
1024
|
if (!yaml_emitter_process_anchor(emitter))
|
1008
1025
|
return 0;
|
1026
|
+
if (emitter->simple_key_context)
|
1027
|
+
if (!PUT(emitter, ' ')) return 0;
|
1009
1028
|
emitter->state = POP(emitter, emitter->states);
|
1010
1029
|
|
1011
1030
|
return 1;
|
@@ -1087,7 +1106,7 @@ yaml_emitter_emit_mapping_start(yaml_emitter_t *emitter, yaml_event_t *event)
|
|
1087
1106
|
*/
|
1088
1107
|
|
1089
1108
|
static int
|
1090
|
-
yaml_emitter_check_empty_document(yaml_emitter_t *emitter)
|
1109
|
+
yaml_emitter_check_empty_document(SHIM(yaml_emitter_t *emitter))
|
1091
1110
|
{
|
1092
1111
|
return 0;
|
1093
1112
|
}
|
@@ -1234,7 +1253,7 @@ yaml_emitter_select_scalar_style(yaml_emitter_t *emitter, yaml_event_t *event)
|
|
1234
1253
|
}
|
1235
1254
|
|
1236
1255
|
/*
|
1237
|
-
* Write an
|
1256
|
+
* Write an anchor.
|
1238
1257
|
*/
|
1239
1258
|
|
1240
1259
|
static int
|
@@ -1333,7 +1352,10 @@ static int
|
|
1333
1352
|
yaml_emitter_analyze_version_directive(yaml_emitter_t *emitter,
|
1334
1353
|
yaml_version_directive_t version_directive)
|
1335
1354
|
{
|
1336
|
-
if (version_directive.major != 1 ||
|
1355
|
+
if (version_directive.major != 1 || (
|
1356
|
+
version_directive.minor != 1
|
1357
|
+
&& version_directive.minor != 2
|
1358
|
+
)) {
|
1337
1359
|
return yaml_emitter_set_emitter_error(emitter,
|
1338
1360
|
"incompatible %YAML directive");
|
1339
1361
|
}
|
@@ -1803,7 +1825,6 @@ yaml_emitter_write_indicator(yaml_emitter_t *emitter,
|
|
1803
1825
|
|
1804
1826
|
emitter->whitespace = is_whitespace;
|
1805
1827
|
emitter->indention = (emitter->indention && is_indention);
|
1806
|
-
emitter->open_ended = 0;
|
1807
1828
|
|
1808
1829
|
return 1;
|
1809
1830
|
}
|
@@ -1904,7 +1925,17 @@ yaml_emitter_write_plain_scalar(yaml_emitter_t *emitter,
|
|
1904
1925
|
|
1905
1926
|
STRING_ASSIGN(string, value, length);
|
1906
1927
|
|
1907
|
-
|
1928
|
+
/**
|
1929
|
+
* Avoid trailing spaces for empty values in block mode.
|
1930
|
+
* In flow mode, we still want the space to prevent ambiguous things
|
1931
|
+
* like {a:}.
|
1932
|
+
* Currently, the emitter forbids any plain empty scalar in flow mode
|
1933
|
+
* (e.g. it outputs {a: ''} instead), so emitter->flow_level will
|
1934
|
+
* never be true here.
|
1935
|
+
* But if the emitter is ever changed to allow emitting empty values,
|
1936
|
+
* the check for flow_level is already here.
|
1937
|
+
*/
|
1938
|
+
if (!emitter->whitespace && (length || emitter->flow_level)) {
|
1908
1939
|
if (!PUT(emitter, ' ')) return 0;
|
1909
1940
|
}
|
1910
1941
|
|
@@ -1946,10 +1977,6 @@ yaml_emitter_write_plain_scalar(yaml_emitter_t *emitter,
|
|
1946
1977
|
|
1947
1978
|
emitter->whitespace = 0;
|
1948
1979
|
emitter->indention = 0;
|
1949
|
-
if (emitter->root_context)
|
1950
|
-
{
|
1951
|
-
emitter->open_ended = 1;
|
1952
|
-
}
|
1953
1980
|
|
1954
1981
|
return 1;
|
1955
1982
|
}
|
@@ -2008,6 +2035,9 @@ yaml_emitter_write_single_quoted_scalar(yaml_emitter_t *emitter,
|
|
2008
2035
|
}
|
2009
2036
|
}
|
2010
2037
|
|
2038
|
+
if (breaks)
|
2039
|
+
if (!yaml_emitter_write_indent(emitter)) return 0;
|
2040
|
+
|
2011
2041
|
if (!yaml_emitter_write_indicator(emitter, "'", 0, 0, 0))
|
2012
2042
|
return 0;
|
2013
2043
|
|
@@ -2207,7 +2237,7 @@ yaml_emitter_write_block_scalar_hints(yaml_emitter_t *emitter,
|
|
2207
2237
|
else if (string.start == string.pointer)
|
2208
2238
|
{
|
2209
2239
|
chomp_hint = "+";
|
2210
|
-
emitter->open_ended =
|
2240
|
+
emitter->open_ended = 2;
|
2211
2241
|
}
|
2212
2242
|
else
|
2213
2243
|
{
|
@@ -2217,7 +2247,7 @@ yaml_emitter_write_block_scalar_hints(yaml_emitter_t *emitter,
|
|
2217
2247
|
if (IS_BREAK(string))
|
2218
2248
|
{
|
2219
2249
|
chomp_hint = "+";
|
2220
|
-
emitter->open_ended =
|
2250
|
+
emitter->open_ended = 2;
|
2221
2251
|
}
|
2222
2252
|
}
|
2223
2253
|
}
|
@@ -2326,4 +2356,3 @@ yaml_emitter_write_folded_scalar(yaml_emitter_t *emitter,
|
|
2326
2356
|
|
2327
2357
|
return 1;
|
2328
2358
|
}
|
2329
|
-
|