cybrid_api_bank_ruby 0.9.0 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +5 -5
  4. data/cybrid_api_bank_ruby.gemspec +1 -1
  5. data/lib/cybrid_api_bank_ruby/api/accounts_bank_api.rb +1 -1
  6. data/lib/cybrid_api_bank_ruby/api/assets_bank_api.rb +1 -1
  7. data/lib/cybrid_api_bank_ruby/api/banks_bank_api.rb +1 -1
  8. data/lib/cybrid_api_bank_ruby/api/customers_bank_api.rb +1 -1
  9. data/lib/cybrid_api_bank_ruby/api/identity_records_bank_api.rb +1 -1
  10. data/lib/cybrid_api_bank_ruby/api/prices_bank_api.rb +1 -1
  11. data/lib/cybrid_api_bank_ruby/api/quotes_bank_api.rb +1 -1
  12. data/lib/cybrid_api_bank_ruby/api/symbols_bank_api.rb +1 -1
  13. data/lib/cybrid_api_bank_ruby/api/trades_bank_api.rb +1 -1
  14. data/lib/cybrid_api_bank_ruby/api/trading_configurations_bank_api.rb +1 -1
  15. data/lib/cybrid_api_bank_ruby/api/verification_keys_bank_api.rb +1 -1
  16. data/lib/cybrid_api_bank_ruby/api_client.rb +1 -1
  17. data/lib/cybrid_api_bank_ruby/api_error.rb +1 -1
  18. data/lib/cybrid_api_bank_ruby/configuration.rb +1 -1
  19. data/lib/cybrid_api_bank_ruby/models/account_bank_model.rb +1 -1
  20. data/lib/cybrid_api_bank_ruby/models/account_list_bank_model.rb +1 -1
  21. data/lib/cybrid_api_bank_ruby/models/asset_bank_model.rb +1 -1
  22. data/lib/cybrid_api_bank_ruby/models/asset_list_bank_model.rb +1 -1
  23. data/lib/cybrid_api_bank_ruby/models/attestation_details_bank_model.rb +1 -1
  24. data/lib/cybrid_api_bank_ruby/models/bank_bank_model.rb +1 -1
  25. data/lib/cybrid_api_bank_ruby/models/bank_list_bank_model.rb +1 -1
  26. data/lib/cybrid_api_bank_ruby/models/customer_bank_model.rb +1 -1
  27. data/lib/cybrid_api_bank_ruby/models/customer_list_bank_model.rb +1 -1
  28. data/lib/cybrid_api_bank_ruby/models/exchange_account_bank_model.rb +1 -1
  29. data/lib/cybrid_api_bank_ruby/models/exchange_bank_model.rb +1 -1
  30. data/lib/cybrid_api_bank_ruby/models/fee_bank_model.rb +1 -1
  31. data/lib/cybrid_api_bank_ruby/models/identity_record_bank_model.rb +1 -1
  32. data/lib/cybrid_api_bank_ruby/models/post_account_bank_model.rb +1 -1
  33. data/lib/cybrid_api_bank_ruby/models/post_bank_bank_model.rb +1 -1
  34. data/lib/cybrid_api_bank_ruby/models/post_customer_bank_model.rb +1 -1
  35. data/lib/cybrid_api_bank_ruby/models/post_fee_bank_model.rb +1 -1
  36. data/lib/cybrid_api_bank_ruby/models/post_identity_record_attestation_details_bank_model.rb +1 -1
  37. data/lib/cybrid_api_bank_ruby/models/post_identity_record_bank_model.rb +1 -1
  38. data/lib/cybrid_api_bank_ruby/models/post_quote_bank_model.rb +1 -1
  39. data/lib/cybrid_api_bank_ruby/models/post_trade_bank_model.rb +1 -1
  40. data/lib/cybrid_api_bank_ruby/models/post_trading_configuration_bank_model.rb +1 -1
  41. data/lib/cybrid_api_bank_ruby/models/post_verification_key_bank_model.rb +1 -1
  42. data/lib/cybrid_api_bank_ruby/models/quote_bank_model.rb +1 -1
  43. data/lib/cybrid_api_bank_ruby/models/quote_list_bank_model.rb +1 -1
  44. data/lib/cybrid_api_bank_ruby/models/symbol_price_bank_model.rb +1 -1
  45. data/lib/cybrid_api_bank_ruby/models/system_account_bank_model.rb +1 -1
  46. data/lib/cybrid_api_bank_ruby/models/trade_bank_model.rb +1 -1
  47. data/lib/cybrid_api_bank_ruby/models/trade_list_bank_model.rb +1 -1
  48. data/lib/cybrid_api_bank_ruby/models/trading_configuration_bank_model.rb +1 -1
  49. data/lib/cybrid_api_bank_ruby/models/trading_configuration_list_bank_model.rb +1 -1
  50. data/lib/cybrid_api_bank_ruby/models/verification_key_bank_model.rb +1 -1
  51. data/lib/cybrid_api_bank_ruby/models/verification_key_list_bank_model.rb +1 -1
  52. data/lib/cybrid_api_bank_ruby/version.rb +2 -2
  53. data/lib/cybrid_api_bank_ruby.rb +1 -1
  54. data/spec/api/accounts_bank_api_spec.rb +1 -1
  55. data/spec/api/assets_bank_api_spec.rb +1 -1
  56. data/spec/api/banks_bank_api_spec.rb +1 -1
  57. data/spec/api/customers_bank_api_spec.rb +1 -1
  58. data/spec/api/identity_records_bank_api_spec.rb +1 -1
  59. data/spec/api/prices_bank_api_spec.rb +1 -1
  60. data/spec/api/quotes_bank_api_spec.rb +1 -1
  61. data/spec/api/symbols_bank_api_spec.rb +1 -1
  62. data/spec/api/trades_bank_api_spec.rb +1 -1
  63. data/spec/api/trading_configurations_bank_api_spec.rb +1 -1
  64. data/spec/api/verification_keys_bank_api_spec.rb +1 -1
  65. data/spec/api_client_spec.rb +1 -1
  66. data/spec/configuration_spec.rb +1 -1
  67. data/spec/models/account_bank_model_spec.rb +1 -1
  68. data/spec/models/account_list_bank_model_spec.rb +1 -1
  69. data/spec/models/asset_bank_model_spec.rb +1 -1
  70. data/spec/models/asset_list_bank_model_spec.rb +1 -1
  71. data/spec/models/attestation_details_bank_model_spec.rb +1 -1
  72. data/spec/models/bank_bank_model_spec.rb +1 -1
  73. data/spec/models/bank_list_bank_model_spec.rb +1 -1
  74. data/spec/models/customer_bank_model_spec.rb +1 -1
  75. data/spec/models/customer_list_bank_model_spec.rb +1 -1
  76. data/spec/models/exchange_account_bank_model_spec.rb +1 -1
  77. data/spec/models/exchange_bank_model_spec.rb +1 -1
  78. data/spec/models/fee_bank_model_spec.rb +1 -1
  79. data/spec/models/identity_record_bank_model_spec.rb +1 -1
  80. data/spec/models/post_account_bank_model_spec.rb +1 -1
  81. data/spec/models/post_bank_bank_model_spec.rb +1 -1
  82. data/spec/models/post_customer_bank_model_spec.rb +1 -1
  83. data/spec/models/post_fee_bank_model_spec.rb +1 -1
  84. data/spec/models/post_identity_record_attestation_details_bank_model_spec.rb +1 -1
  85. data/spec/models/post_identity_record_bank_model_spec.rb +1 -1
  86. data/spec/models/post_quote_bank_model_spec.rb +1 -1
  87. data/spec/models/post_trade_bank_model_spec.rb +1 -1
  88. data/spec/models/post_trading_configuration_bank_model_spec.rb +1 -1
  89. data/spec/models/post_verification_key_bank_model_spec.rb +1 -1
  90. data/spec/models/quote_bank_model_spec.rb +1 -1
  91. data/spec/models/quote_list_bank_model_spec.rb +1 -1
  92. data/spec/models/symbol_price_bank_model_spec.rb +1 -1
  93. data/spec/models/system_account_bank_model_spec.rb +1 -1
  94. data/spec/models/trade_bank_model_spec.rb +1 -1
  95. data/spec/models/trade_list_bank_model_spec.rb +1 -1
  96. data/spec/models/trading_configuration_bank_model_spec.rb +1 -1
  97. data/spec/models/trading_configuration_list_bank_model_spec.rb +1 -1
  98. data/spec/models/verification_key_bank_model_spec.rb +1 -1
  99. data/spec/models/verification_key_list_bank_model_spec.rb +1 -1
  100. data/spec/spec_helper.rb +1 -1
  101. data/vendor/bundle/ruby/3.1.0/cache/psych-4.0.4.gem +0 -0
  102. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/byebug-11.1.3/gem_make.out +2 -2
  103. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/ffi-1.15.5/gem_make.out +2 -2
  104. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/jaro_winkler-1.5.4/gem_make.out +2 -2
  105. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/psych-4.0.4/gem.build_complete +0 -0
  106. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/psych-4.0.4/gem_make.out +27 -0
  107. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/psych-4.0.4/mkmf.log +75 -0
  108. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/psych-4.0.4/psych.so +0 -0
  109. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/stringio-3.0.2/gem_make.out +2 -2
  110. data/vendor/bundle/ruby/3.1.0/gems/byebug-11.1.3/ext/byebug/Makefile +2 -2
  111. data/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/ext/ffi_c/Makefile +2 -2
  112. data/vendor/bundle/ruby/3.1.0/gems/jaro_winkler-1.5.4/ext/jaro_winkler/Makefile +2 -2
  113. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/.gitignore +16 -0
  114. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/Gemfile +9 -0
  115. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/LICENSE +21 -0
  116. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/Mavenfile +7 -0
  117. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/README.md +72 -0
  118. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/Rakefile +41 -0
  119. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/bin/console +7 -0
  120. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/bin/setup +6 -0
  121. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/.sitearchdir.time +0 -0
  122. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/Makefile +274 -0
  123. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/depend +5 -0
  124. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/extconf.rb +43 -0
  125. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych.c +37 -0
  126. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych.h +17 -0
  127. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych.o +0 -0
  128. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych.so +0 -0
  129. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_emitter.c +555 -0
  130. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_emitter.h +8 -0
  131. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_emitter.o +0 -0
  132. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_parser.c +579 -0
  133. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_parser.h +6 -0
  134. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_parser.o +0 -0
  135. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_to_ruby.c +39 -0
  136. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_to_ruby.h +8 -0
  137. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_to_ruby.o +0 -0
  138. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_yaml_tree.c +12 -0
  139. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_yaml_tree.h +8 -0
  140. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_yaml_tree.o +0 -0
  141. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/LICENSE +19 -0
  142. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/api.c +1393 -0
  143. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/config.h +80 -0
  144. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/dumper.c +394 -0
  145. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/emitter.c +2358 -0
  146. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/loader.c +544 -0
  147. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/parser.c +1375 -0
  148. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/reader.c +469 -0
  149. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/scanner.c +3598 -0
  150. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/writer.c +141 -0
  151. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/yaml.h +1985 -0
  152. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/yaml_private.h +688 -0
  153. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/class_loader.rb +104 -0
  154. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/coder.rb +95 -0
  155. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/core_ext.rb +19 -0
  156. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/exception.rb +14 -0
  157. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/handler.rb +255 -0
  158. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/handlers/document_stream.rb +23 -0
  159. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/handlers/recorder.rb +40 -0
  160. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/json/ruby_events.rb +20 -0
  161. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/json/stream.rb +17 -0
  162. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/json/tree_builder.rb +13 -0
  163. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/json/yaml_events.rb +30 -0
  164. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/alias.rb +21 -0
  165. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/document.rb +63 -0
  166. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/mapping.rb +59 -0
  167. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/node.rb +75 -0
  168. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/scalar.rb +70 -0
  169. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/sequence.rb +84 -0
  170. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/stream.rb +40 -0
  171. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes.rb +78 -0
  172. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/omap.rb +5 -0
  173. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/parser.rb +52 -0
  174. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/scalar_scanner.rb +142 -0
  175. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/set.rb +5 -0
  176. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/stream.rb +38 -0
  177. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/streaming.rb +28 -0
  178. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/syntax_error.rb +22 -0
  179. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/tree_builder.rb +137 -0
  180. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/versions.rb +10 -0
  181. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors/depth_first.rb +27 -0
  182. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors/emitter.rb +52 -0
  183. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors/json_tree.rb +25 -0
  184. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors/to_ruby.rb +434 -0
  185. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors/visitor.rb +34 -0
  186. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors/yaml_tree.rb +587 -0
  187. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors.rb +7 -0
  188. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/y.rb +10 -0
  189. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych.rb +741 -0
  190. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych.so +0 -0
  191. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/psych.gemspec +69 -0
  192. data/vendor/bundle/ruby/3.1.0/gems/stringio-3.0.2/ext/stringio/Makefile +2 -2
  193. data/vendor/bundle/ruby/3.1.0/specifications/psych-4.0.4.gemspec +36 -0
  194. metadata +86 -1
@@ -0,0 +1,544 @@
1
+
2
+ #include "yaml_private.h"
3
+
4
+ /*
5
+ * API functions.
6
+ */
7
+
8
+ YAML_DECLARE(int)
9
+ yaml_parser_load(yaml_parser_t *parser, yaml_document_t *document);
10
+
11
+ /*
12
+ * Error handling.
13
+ */
14
+
15
+ static int
16
+ yaml_parser_set_composer_error(yaml_parser_t *parser,
17
+ const char *problem, yaml_mark_t problem_mark);
18
+
19
+ static int
20
+ yaml_parser_set_composer_error_context(yaml_parser_t *parser,
21
+ const char *context, yaml_mark_t context_mark,
22
+ const char *problem, yaml_mark_t problem_mark);
23
+
24
+
25
+ /*
26
+ * Alias handling.
27
+ */
28
+
29
+ static int
30
+ yaml_parser_register_anchor(yaml_parser_t *parser,
31
+ int index, yaml_char_t *anchor);
32
+
33
+ /*
34
+ * Clean up functions.
35
+ */
36
+
37
+ static void
38
+ yaml_parser_delete_aliases(yaml_parser_t *parser);
39
+
40
+ /*
41
+ * Document loading context.
42
+ */
43
+ struct loader_ctx {
44
+ int *start;
45
+ int *end;
46
+ int *top;
47
+ };
48
+
49
+ /*
50
+ * Composer functions.
51
+ */
52
+ static int
53
+ yaml_parser_load_nodes(yaml_parser_t *parser, struct loader_ctx *ctx);
54
+
55
+ static int
56
+ yaml_parser_load_document(yaml_parser_t *parser, yaml_event_t *event);
57
+
58
+ static int
59
+ yaml_parser_load_alias(yaml_parser_t *parser, yaml_event_t *event,
60
+ struct loader_ctx *ctx);
61
+
62
+ static int
63
+ yaml_parser_load_scalar(yaml_parser_t *parser, yaml_event_t *event,
64
+ struct loader_ctx *ctx);
65
+
66
+ static int
67
+ yaml_parser_load_sequence(yaml_parser_t *parser, yaml_event_t *event,
68
+ struct loader_ctx *ctx);
69
+
70
+ static int
71
+ yaml_parser_load_mapping(yaml_parser_t *parser, yaml_event_t *event,
72
+ struct loader_ctx *ctx);
73
+
74
+ static int
75
+ yaml_parser_load_sequence_end(yaml_parser_t *parser, yaml_event_t *event,
76
+ struct loader_ctx *ctx);
77
+
78
+ static int
79
+ yaml_parser_load_mapping_end(yaml_parser_t *parser, yaml_event_t *event,
80
+ struct loader_ctx *ctx);
81
+
82
+ /*
83
+ * Load the next document of the stream.
84
+ */
85
+
86
+ YAML_DECLARE(int)
87
+ yaml_parser_load(yaml_parser_t *parser, yaml_document_t *document)
88
+ {
89
+ yaml_event_t event;
90
+
91
+ assert(parser); /* Non-NULL parser object is expected. */
92
+ assert(document); /* Non-NULL document object is expected. */
93
+
94
+ memset(document, 0, sizeof(yaml_document_t));
95
+ if (!STACK_INIT(parser, document->nodes, yaml_node_t*))
96
+ goto error;
97
+
98
+ if (!parser->stream_start_produced) {
99
+ if (!yaml_parser_parse(parser, &event)) goto error;
100
+ assert(event.type == YAML_STREAM_START_EVENT);
101
+ /* STREAM-START is expected. */
102
+ }
103
+
104
+ if (parser->stream_end_produced) {
105
+ return 1;
106
+ }
107
+
108
+ if (!yaml_parser_parse(parser, &event)) goto error;
109
+ if (event.type == YAML_STREAM_END_EVENT) {
110
+ return 1;
111
+ }
112
+
113
+ if (!STACK_INIT(parser, parser->aliases, yaml_alias_data_t*))
114
+ goto error;
115
+
116
+ parser->document = document;
117
+
118
+ if (!yaml_parser_load_document(parser, &event)) goto error;
119
+
120
+ yaml_parser_delete_aliases(parser);
121
+ parser->document = NULL;
122
+
123
+ return 1;
124
+
125
+ error:
126
+
127
+ yaml_parser_delete_aliases(parser);
128
+ yaml_document_delete(document);
129
+ parser->document = NULL;
130
+
131
+ return 0;
132
+ }
133
+
134
+ /*
135
+ * Set composer error.
136
+ */
137
+
138
+ static int
139
+ yaml_parser_set_composer_error(yaml_parser_t *parser,
140
+ const char *problem, yaml_mark_t problem_mark)
141
+ {
142
+ parser->error = YAML_COMPOSER_ERROR;
143
+ parser->problem = problem;
144
+ parser->problem_mark = problem_mark;
145
+
146
+ return 0;
147
+ }
148
+
149
+ /*
150
+ * Set composer error with context.
151
+ */
152
+
153
+ static int
154
+ yaml_parser_set_composer_error_context(yaml_parser_t *parser,
155
+ const char *context, yaml_mark_t context_mark,
156
+ const char *problem, yaml_mark_t problem_mark)
157
+ {
158
+ parser->error = YAML_COMPOSER_ERROR;
159
+ parser->context = context;
160
+ parser->context_mark = context_mark;
161
+ parser->problem = problem;
162
+ parser->problem_mark = problem_mark;
163
+
164
+ return 0;
165
+ }
166
+
167
+ /*
168
+ * Delete the stack of aliases.
169
+ */
170
+
171
+ static void
172
+ yaml_parser_delete_aliases(yaml_parser_t *parser)
173
+ {
174
+ while (!STACK_EMPTY(parser, parser->aliases)) {
175
+ yaml_free(POP(parser, parser->aliases).anchor);
176
+ }
177
+ STACK_DEL(parser, parser->aliases);
178
+ }
179
+
180
+ /*
181
+ * Compose a document object.
182
+ */
183
+
184
+ static int
185
+ yaml_parser_load_document(yaml_parser_t *parser, yaml_event_t *event)
186
+ {
187
+ struct loader_ctx ctx = { NULL, NULL, NULL };
188
+
189
+ assert(event->type == YAML_DOCUMENT_START_EVENT);
190
+ /* DOCUMENT-START is expected. */
191
+
192
+ parser->document->version_directive
193
+ = event->data.document_start.version_directive;
194
+ parser->document->tag_directives.start
195
+ = event->data.document_start.tag_directives.start;
196
+ parser->document->tag_directives.end
197
+ = event->data.document_start.tag_directives.end;
198
+ parser->document->start_implicit
199
+ = event->data.document_start.implicit;
200
+ parser->document->start_mark = event->start_mark;
201
+
202
+ if (!STACK_INIT(parser, ctx, int*)) return 0;
203
+ if (!yaml_parser_load_nodes(parser, &ctx)) {
204
+ STACK_DEL(parser, ctx);
205
+ return 0;
206
+ }
207
+ STACK_DEL(parser, ctx);
208
+
209
+ return 1;
210
+ }
211
+
212
+ /*
213
+ * Compose a node tree.
214
+ */
215
+
216
+ static int
217
+ yaml_parser_load_nodes(yaml_parser_t *parser, struct loader_ctx *ctx)
218
+ {
219
+ yaml_event_t event;
220
+
221
+ do {
222
+ if (!yaml_parser_parse(parser, &event)) return 0;
223
+
224
+ switch (event.type) {
225
+ case YAML_ALIAS_EVENT:
226
+ if (!yaml_parser_load_alias(parser, &event, ctx)) return 0;
227
+ break;
228
+ case YAML_SCALAR_EVENT:
229
+ if (!yaml_parser_load_scalar(parser, &event, ctx)) return 0;
230
+ break;
231
+ case YAML_SEQUENCE_START_EVENT:
232
+ if (!yaml_parser_load_sequence(parser, &event, ctx)) return 0;
233
+ break;
234
+ case YAML_SEQUENCE_END_EVENT:
235
+ if (!yaml_parser_load_sequence_end(parser, &event, ctx))
236
+ return 0;
237
+ break;
238
+ case YAML_MAPPING_START_EVENT:
239
+ if (!yaml_parser_load_mapping(parser, &event, ctx)) return 0;
240
+ break;
241
+ case YAML_MAPPING_END_EVENT:
242
+ if (!yaml_parser_load_mapping_end(parser, &event, ctx))
243
+ return 0;
244
+ break;
245
+ default:
246
+ assert(0); /* Could not happen. */
247
+ return 0;
248
+ case YAML_DOCUMENT_END_EVENT:
249
+ break;
250
+ }
251
+ } while (event.type != YAML_DOCUMENT_END_EVENT);
252
+
253
+ parser->document->end_implicit = event.data.document_end.implicit;
254
+ parser->document->end_mark = event.end_mark;
255
+
256
+ return 1;
257
+ }
258
+
259
+ /*
260
+ * Add an anchor.
261
+ */
262
+
263
+ static int
264
+ yaml_parser_register_anchor(yaml_parser_t *parser,
265
+ int index, yaml_char_t *anchor)
266
+ {
267
+ yaml_alias_data_t data;
268
+ yaml_alias_data_t *alias_data;
269
+
270
+ if (!anchor) return 1;
271
+
272
+ data.anchor = anchor;
273
+ data.index = index;
274
+ data.mark = parser->document->nodes.start[index-1].start_mark;
275
+
276
+ for (alias_data = parser->aliases.start;
277
+ alias_data != parser->aliases.top; alias_data ++) {
278
+ if (strcmp((char *)alias_data->anchor, (char *)anchor) == 0) {
279
+ yaml_free(anchor);
280
+ return yaml_parser_set_composer_error_context(parser,
281
+ "found duplicate anchor; first occurrence",
282
+ alias_data->mark, "second occurrence", data.mark);
283
+ }
284
+ }
285
+
286
+ if (!PUSH(parser, parser->aliases, data)) {
287
+ yaml_free(anchor);
288
+ return 0;
289
+ }
290
+
291
+ return 1;
292
+ }
293
+
294
+ /*
295
+ * Compose node into its parent in the stree.
296
+ */
297
+
298
+ static int
299
+ yaml_parser_load_node_add(yaml_parser_t *parser, struct loader_ctx *ctx,
300
+ int index)
301
+ {
302
+ struct yaml_node_s *parent;
303
+ int parent_index;
304
+
305
+ if (STACK_EMPTY(parser, *ctx)) {
306
+ /* This is the root node, there's no tree to add it to. */
307
+ return 1;
308
+ }
309
+
310
+ parent_index = *((*ctx).top - 1);
311
+ parent = &parser->document->nodes.start[parent_index-1];
312
+
313
+ switch (parent->type) {
314
+ case YAML_SEQUENCE_NODE:
315
+ if (!STACK_LIMIT(parser, parent->data.sequence.items, INT_MAX-1))
316
+ return 0;
317
+ if (!PUSH(parser, parent->data.sequence.items, index))
318
+ return 0;
319
+ break;
320
+ case YAML_MAPPING_NODE: {
321
+ yaml_node_pair_t pair;
322
+ if (!STACK_EMPTY(parser, parent->data.mapping.pairs)) {
323
+ yaml_node_pair_t *p = parent->data.mapping.pairs.top - 1;
324
+ if (p->key != 0 && p->value == 0) {
325
+ p->value = index;
326
+ break;
327
+ }
328
+ }
329
+
330
+ pair.key = index;
331
+ pair.value = 0;
332
+ if (!STACK_LIMIT(parser, parent->data.mapping.pairs, INT_MAX-1))
333
+ return 0;
334
+ if (!PUSH(parser, parent->data.mapping.pairs, pair))
335
+ return 0;
336
+
337
+ break;
338
+ }
339
+ default:
340
+ assert(0); /* Could not happen. */
341
+ return 0;
342
+ }
343
+ return 1;
344
+ }
345
+
346
+ /*
347
+ * Compose a node corresponding to an alias.
348
+ */
349
+
350
+ static int
351
+ yaml_parser_load_alias(yaml_parser_t *parser, yaml_event_t *event,
352
+ struct loader_ctx *ctx)
353
+ {
354
+ yaml_char_t *anchor = event->data.alias.anchor;
355
+ yaml_alias_data_t *alias_data;
356
+
357
+ for (alias_data = parser->aliases.start;
358
+ alias_data != parser->aliases.top; alias_data ++) {
359
+ if (strcmp((char *)alias_data->anchor, (char *)anchor) == 0) {
360
+ yaml_free(anchor);
361
+ return yaml_parser_load_node_add(parser, ctx, alias_data->index);
362
+ }
363
+ }
364
+
365
+ yaml_free(anchor);
366
+ return yaml_parser_set_composer_error(parser, "found undefined alias",
367
+ event->start_mark);
368
+ }
369
+
370
+ /*
371
+ * Compose a scalar node.
372
+ */
373
+
374
+ static int
375
+ yaml_parser_load_scalar(yaml_parser_t *parser, yaml_event_t *event,
376
+ struct loader_ctx *ctx)
377
+ {
378
+ yaml_node_t node;
379
+ int index;
380
+ yaml_char_t *tag = event->data.scalar.tag;
381
+
382
+ if (!STACK_LIMIT(parser, parser->document->nodes, INT_MAX-1)) goto error;
383
+
384
+ if (!tag || strcmp((char *)tag, "!") == 0) {
385
+ yaml_free(tag);
386
+ tag = yaml_strdup((yaml_char_t *)YAML_DEFAULT_SCALAR_TAG);
387
+ if (!tag) goto error;
388
+ }
389
+
390
+ SCALAR_NODE_INIT(node, tag, event->data.scalar.value,
391
+ event->data.scalar.length, event->data.scalar.style,
392
+ event->start_mark, event->end_mark);
393
+
394
+ if (!PUSH(parser, parser->document->nodes, node)) goto error;
395
+
396
+ index = (int)(parser->document->nodes.top - parser->document->nodes.start);
397
+
398
+ if (!yaml_parser_register_anchor(parser, index,
399
+ event->data.scalar.anchor)) return 0;
400
+
401
+ return yaml_parser_load_node_add(parser, ctx, index);
402
+
403
+ error:
404
+ yaml_free(tag);
405
+ yaml_free(event->data.scalar.anchor);
406
+ yaml_free(event->data.scalar.value);
407
+ return 0;
408
+ }
409
+
410
+ /*
411
+ * Compose a sequence node.
412
+ */
413
+
414
+ static int
415
+ yaml_parser_load_sequence(yaml_parser_t *parser, yaml_event_t *event,
416
+ struct loader_ctx *ctx)
417
+ {
418
+ yaml_node_t node;
419
+ struct {
420
+ yaml_node_item_t *start;
421
+ yaml_node_item_t *end;
422
+ yaml_node_item_t *top;
423
+ } items = { NULL, NULL, NULL };
424
+ int index;
425
+ yaml_char_t *tag = event->data.sequence_start.tag;
426
+
427
+ if (!STACK_LIMIT(parser, parser->document->nodes, INT_MAX-1)) goto error;
428
+
429
+ if (!tag || strcmp((char *)tag, "!") == 0) {
430
+ yaml_free(tag);
431
+ tag = yaml_strdup((yaml_char_t *)YAML_DEFAULT_SEQUENCE_TAG);
432
+ if (!tag) goto error;
433
+ }
434
+
435
+ if (!STACK_INIT(parser, items, yaml_node_item_t*)) goto error;
436
+
437
+ SEQUENCE_NODE_INIT(node, tag, items.start, items.end,
438
+ event->data.sequence_start.style,
439
+ event->start_mark, event->end_mark);
440
+
441
+ if (!PUSH(parser, parser->document->nodes, node)) goto error;
442
+
443
+ index = (int)(parser->document->nodes.top - parser->document->nodes.start);
444
+
445
+ if (!yaml_parser_register_anchor(parser, index,
446
+ event->data.sequence_start.anchor)) return 0;
447
+
448
+ if (!yaml_parser_load_node_add(parser, ctx, index)) return 0;
449
+
450
+ if (!STACK_LIMIT(parser, *ctx, INT_MAX-1)) return 0;
451
+ if (!PUSH(parser, *ctx, index)) return 0;
452
+
453
+ return 1;
454
+
455
+ error:
456
+ yaml_free(tag);
457
+ yaml_free(event->data.sequence_start.anchor);
458
+ return 0;
459
+ }
460
+
461
+ static int
462
+ yaml_parser_load_sequence_end(yaml_parser_t *parser, yaml_event_t *event,
463
+ struct loader_ctx *ctx)
464
+ {
465
+ int index;
466
+
467
+ assert(((*ctx).top - (*ctx).start) > 0);
468
+
469
+ index = *((*ctx).top - 1);
470
+ assert(parser->document->nodes.start[index-1].type == YAML_SEQUENCE_NODE);
471
+ parser->document->nodes.start[index-1].end_mark = event->end_mark;
472
+
473
+ (void)POP(parser, *ctx);
474
+
475
+ return 1;
476
+ }
477
+
478
+ /*
479
+ * Compose a mapping node.
480
+ */
481
+
482
+ static int
483
+ yaml_parser_load_mapping(yaml_parser_t *parser, yaml_event_t *event,
484
+ struct loader_ctx *ctx)
485
+ {
486
+ yaml_node_t node;
487
+ struct {
488
+ yaml_node_pair_t *start;
489
+ yaml_node_pair_t *end;
490
+ yaml_node_pair_t *top;
491
+ } pairs = { NULL, NULL, NULL };
492
+ int index;
493
+ yaml_char_t *tag = event->data.mapping_start.tag;
494
+
495
+ if (!STACK_LIMIT(parser, parser->document->nodes, INT_MAX-1)) goto error;
496
+
497
+ if (!tag || strcmp((char *)tag, "!") == 0) {
498
+ yaml_free(tag);
499
+ tag = yaml_strdup((yaml_char_t *)YAML_DEFAULT_MAPPING_TAG);
500
+ if (!tag) goto error;
501
+ }
502
+
503
+ if (!STACK_INIT(parser, pairs, yaml_node_pair_t*)) goto error;
504
+
505
+ MAPPING_NODE_INIT(node, tag, pairs.start, pairs.end,
506
+ event->data.mapping_start.style,
507
+ event->start_mark, event->end_mark);
508
+
509
+ if (!PUSH(parser, parser->document->nodes, node)) goto error;
510
+
511
+ index = (int)(parser->document->nodes.top - parser->document->nodes.start);
512
+
513
+ if (!yaml_parser_register_anchor(parser, index,
514
+ event->data.mapping_start.anchor)) return 0;
515
+
516
+ if (!yaml_parser_load_node_add(parser, ctx, index)) return 0;
517
+
518
+ if (!STACK_LIMIT(parser, *ctx, INT_MAX-1)) return 0;
519
+ if (!PUSH(parser, *ctx, index)) return 0;
520
+
521
+ return 1;
522
+
523
+ error:
524
+ yaml_free(tag);
525
+ yaml_free(event->data.mapping_start.anchor);
526
+ return 0;
527
+ }
528
+
529
+ static int
530
+ yaml_parser_load_mapping_end(yaml_parser_t *parser, yaml_event_t *event,
531
+ struct loader_ctx *ctx)
532
+ {
533
+ int index;
534
+
535
+ assert(((*ctx).top - (*ctx).start) > 0);
536
+
537
+ index = *((*ctx).top - 1);
538
+ assert(parser->document->nodes.start[index-1].type == YAML_MAPPING_NODE);
539
+ parser->document->nodes.start[index-1].end_mark = event->end_mark;
540
+
541
+ (void)POP(parser, *ctx);
542
+
543
+ return 1;
544
+ }