psych 2.0.13 → 2.1.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.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +9 -4
  3. data/Manifest.txt +2 -0
  4. data/Rakefile +55 -6
  5. data/ext/psych/extconf.rb +1 -0
  6. data/ext/psych/psych_emitter.c +25 -11
  7. data/ext/psych/psych_parser.c +2 -2
  8. data/ext/psych/yaml/loader.c +2 -2
  9. data/ext/psych/yaml/scanner.c +18 -18
  10. data/lib/psych/class_loader.rb +1 -0
  11. data/lib/psych/coder.rb +1 -0
  12. data/lib/psych/core_ext.rb +1 -0
  13. data/lib/psych/deprecated.rb +1 -0
  14. data/lib/psych/exception.rb +1 -0
  15. data/lib/psych/handler.rb +1 -0
  16. data/lib/psych/handlers/document_stream.rb +1 -0
  17. data/lib/psych/handlers/recorder.rb +1 -0
  18. data/lib/psych/json/ruby_events.rb +1 -0
  19. data/lib/psych/json/stream.rb +1 -0
  20. data/lib/psych/json/tree_builder.rb +1 -0
  21. data/lib/psych/json/yaml_events.rb +1 -0
  22. data/lib/psych/nodes/alias.rb +1 -0
  23. data/lib/psych/nodes/document.rb +1 -0
  24. data/lib/psych/nodes/mapping.rb +1 -0
  25. data/lib/psych/nodes/node.rb +1 -0
  26. data/lib/psych/nodes/scalar.rb +1 -0
  27. data/lib/psych/nodes/sequence.rb +1 -0
  28. data/lib/psych/nodes/stream.rb +1 -0
  29. data/lib/psych/nodes.rb +1 -0
  30. data/lib/psych/omap.rb +1 -0
  31. data/lib/psych/parser.rb +1 -0
  32. data/lib/psych/scalar_scanner.rb +1 -0
  33. data/lib/psych/set.rb +1 -0
  34. data/lib/psych/stream.rb +1 -0
  35. data/lib/psych/streaming.rb +1 -0
  36. data/lib/psych/syntax_error.rb +1 -0
  37. data/lib/psych/tree_builder.rb +1 -0
  38. data/lib/psych/versions.rb +4 -0
  39. data/lib/psych/visitors/depth_first.rb +1 -0
  40. data/lib/psych/visitors/emitter.rb +1 -0
  41. data/lib/psych/visitors/json_tree.rb +1 -0
  42. data/lib/psych/visitors/to_ruby.rb +5 -3
  43. data/lib/psych/visitors/visitor.rb +1 -0
  44. data/lib/psych/visitors/yaml_tree.rb +17 -24
  45. data/lib/psych/visitors.rb +1 -0
  46. data/lib/psych/y.rb +1 -0
  47. data/lib/psych.rb +21 -9
  48. data/lib/psych_jars.rb +6 -0
  49. data/test/psych/handlers/test_recorder.rb +1 -0
  50. data/test/psych/helper.rb +3 -1
  51. data/test/psych/json/test_stream.rb +1 -0
  52. data/test/psych/nodes/test_enumerable.rb +1 -0
  53. data/test/psych/test_alias_and_anchor.rb +1 -0
  54. data/test/psych/test_array.rb +1 -0
  55. data/test/psych/test_boolean.rb +1 -0
  56. data/test/psych/test_class.rb +1 -0
  57. data/test/psych/test_coder.rb +1 -0
  58. data/test/psych/test_date_time.rb +1 -0
  59. data/test/psych/test_deprecated.rb +1 -0
  60. data/test/psych/test_document.rb +1 -0
  61. data/test/psych/test_emitter.rb +18 -0
  62. data/test/psych/test_encoding.rb +10 -0
  63. data/test/psych/test_exception.rb +1 -0
  64. data/test/psych/test_hash.rb +1 -0
  65. data/test/psych/test_json_tree.rb +1 -0
  66. data/test/psych/test_merge_keys.rb +1 -0
  67. data/test/psych/test_nil.rb +1 -0
  68. data/test/psych/test_null.rb +1 -0
  69. data/test/psych/test_numeric.rb +1 -0
  70. data/test/psych/test_object.rb +1 -0
  71. data/test/psych/test_object_references.rb +1 -0
  72. data/test/psych/test_omap.rb +1 -0
  73. data/test/psych/test_parser.rb +1 -0
  74. data/test/psych/test_psych.rb +17 -1
  75. data/test/psych/test_safe_load.rb +1 -0
  76. data/test/psych/test_scalar.rb +1 -0
  77. data/test/psych/test_scalar_scanner.rb +1 -0
  78. data/test/psych/test_serialize_subclasses.rb +1 -0
  79. data/test/psych/test_set.rb +1 -0
  80. data/test/psych/test_stream.rb +1 -0
  81. data/test/psych/test_string.rb +1 -0
  82. data/test/psych/test_struct.rb +1 -0
  83. data/test/psych/test_symbol.rb +1 -0
  84. data/test/psych/test_tainted.rb +1 -0
  85. data/test/psych/test_to_yaml_properties.rb +1 -0
  86. data/test/psych/test_tree_builder.rb +1 -0
  87. data/test/psych/test_yaml.rb +1 -0
  88. data/test/psych/test_yamldbm.rb +1 -1
  89. data/test/psych/test_yamlstore.rb +1 -0
  90. data/test/psych/visitors/test_depth_first.rb +1 -0
  91. data/test/psych/visitors/test_emitter.rb +1 -0
  92. data/test/psych/visitors/test_to_ruby.rb +15 -9
  93. data/test/psych/visitors/test_yaml_tree.rb +7 -0
  94. metadata +10 -55
  95. data/.gemtest +0 -0
  96. data/test/psych/test_marshalable.rb +0 -54
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98ff80d57bc20b6d84ee24df83966f0feebfbe3f
4
- data.tar.gz: afa7e8005ce6e5ce2867e4c3d06793d94c2af627
3
+ metadata.gz: b60d3bf3233df7c3abe9184e81b79eed85129ba1
4
+ data.tar.gz: b06bdbf39cd19feaf29b19d5fb49f2d0ae6cfe0e
5
5
  SHA512:
6
- metadata.gz: d219a2267fdb9c6471a9e27e18242e572bcbf259207d78b4a8948dd812fc1da23bde5b24850e099961c4d0384a71d2bb2177c02b8131d771d8c726924ec693f0
7
- data.tar.gz: 0ae5569645a513442d8f7859b2ab3154a42c8fc728ec9a82f6a40971554eab5907338032352522755cc59666d13f58d42304f71aaacd6f86b5fc9c7c3f4f9dc9
6
+ metadata.gz: d9a6914218ecaece3214bb8698a6589bb67b3ded99be295fee23894be97e40dac2c67ca730c4c8c7bf12bc89e68ec7974132adb3a81f6f8f54ae8507fda324a6
7
+ data.tar.gz: 105c008b421b79781e25f041a4f5d9ddc99fbf79b8a0db1fad1329abee305387fd10156612279daf0bdcaa4baaf1c13382cef0164833ca9e4fc52448e87060c4
data/.travis.yml CHANGED
@@ -1,11 +1,16 @@
1
1
  rvm:
2
- - 1.9.2
3
- - 1.9.3
4
2
  - 2.0.0
5
- - 2.1.0
3
+ - 2.1
4
+ - 2.2
5
+ - 2.3.0
6
6
  - ruby-head
7
+ - rbx-2
7
8
  before_script:
8
9
  - gem install hoe
9
10
  - gem install rake-compiler
10
- - gem install minitest -v '~> 4.0'
11
+ - gem install minitest -v '~> 5.0'
11
12
  script: rake test
13
+ matrix:
14
+ allow_failures:
15
+ - rvm: ruby-head
16
+ - rvm: rbx-2
data/Manifest.txt CHANGED
@@ -57,6 +57,7 @@ lib/psych/stream.rb
57
57
  lib/psych/streaming.rb
58
58
  lib/psych/syntax_error.rb
59
59
  lib/psych/tree_builder.rb
60
+ lib/psych/versions.rb
60
61
  lib/psych/visitors.rb
61
62
  lib/psych/visitors/depth_first.rb
62
63
  lib/psych/visitors/emitter.rb
@@ -65,6 +66,7 @@ lib/psych/visitors/to_ruby.rb
65
66
  lib/psych/visitors/visitor.rb
66
67
  lib/psych/visitors/yaml_tree.rb
67
68
  lib/psych/y.rb
69
+ lib/psych_jars.rb
68
70
  test/psych/handlers/test_recorder.rb
69
71
  test/psych/helper.rb
70
72
  test/psych/json/test_stream.rb
data/Rakefile CHANGED
@@ -1,15 +1,22 @@
1
1
  # -*- ruby -*-
2
2
 
3
+ require 'psych'
3
4
  require 'rubygems'
4
5
  require 'hoe'
5
6
 
7
+ def java?
8
+ RUBY_PLATFORM =~ /java/
9
+ end
10
+
6
11
  class Hoe
7
12
  remove_const :RUBY_FLAGS
8
- RUBY_FLAGS = "-I#{%w(lib ext bin test).join(File::PATH_SEPARATOR)}"
13
+ flags = "-I#{%w(lib ext bin test).join(File::PATH_SEPARATOR)}"
14
+ flags = "--1.9 " + flags if java?
15
+ RUBY_FLAGS = flags
9
16
  end
10
17
 
11
18
  gem 'rake-compiler', '>= 0.4.1'
12
- gem 'minitest', '~> 4.0'
19
+ gem 'minitest', '~> 5.0'
13
20
  require "rake/extensiontask"
14
21
 
15
22
  Hoe.plugin :doofus, :git, :gemspec
@@ -24,15 +31,57 @@ $hoe = Hoe.spec 'psych' do
24
31
  self.testlib = :minitest
25
32
 
26
33
  extra_dev_deps << ['rake-compiler', '>= 0.4.1']
27
- extra_dev_deps << ['minitest', '~> 4.0']
34
+ extra_dev_deps << ['minitest', '~> 5.0']
28
35
 
29
36
  self.spec_extras = {
30
- :extensions => ["ext/psych/extconf.rb"],
31
37
  :required_ruby_version => '>= 1.9.2'
32
38
  }
33
39
 
34
- Rake::ExtensionTask.new "psych", spec do |ext|
35
- ext.lib_dir = File.join(*['lib', ENV['FAT_DIR']].compact)
40
+ if java?
41
+ require './lib/psych/versions.rb'
42
+ extra_deps << ['jar-dependencies', '>= 0.1.7']
43
+
44
+ # the jar declaration for jar-dependencies
45
+ self.spec_extras[ 'requirements' ] = "jar org.yaml:snakeyaml, #{Psych::DEFAULT_SNAKEYAML_VERSION}"
46
+ self.spec_extras[ 'platform' ] = 'java'
47
+ # TODO: clean this section up.
48
+ require "rake/javaextensiontask"
49
+ Rake::JavaExtensionTask.new("psych", spec) do |ext|
50
+ require 'maven/ruby/maven'
51
+ # uses Mavenfile to write classpath into pkg/classpath
52
+ # and tell maven via system properties the snakeyaml version
53
+ # this is basically the same as running from the commandline:
54
+ # rmvn dependency:build-classpath -Dsnakeyaml.version='use version from Psych::DEFAULT_SNAKEYAML_VERSION here'
55
+ Maven::Ruby::Maven.new.exec( 'dependency:build-classpath', "-Dsnakeyaml.version=#{Psych::DEFAULT_SNAKEYAML_VERSION}", '-Dverbose=true')#, '--quiet' )
56
+ ext.source_version = '1.7'
57
+ ext.target_version = '1.7'
58
+ ext.classpath = File.read('pkg/classpath')
59
+ ext.ext_dir = 'ext/java'
60
+ end
61
+ else
62
+ self.spec_extras[:extensions] = ["ext/psych/extconf.rb"]
63
+ Rake::ExtensionTask.new "psych", spec do |ext|
64
+ ext.lib_dir = File.join(*['lib', ENV['FAT_DIR']].compact)
65
+ end
66
+ end
67
+ end
68
+
69
+ def gem_build_path
70
+ File.join 'pkg', $hoe.spec.full_name
71
+ end
72
+
73
+ def add_file_to_gem relative_path
74
+ target_path = File.join gem_build_path, relative_path
75
+ target_dir = File.dirname(target_path)
76
+ mkdir_p target_dir unless File.directory?(target_dir)
77
+ rm_f target_path
78
+ safe_ln relative_path, target_path
79
+ $hoe.spec.files.concat [relative_path]
80
+ end
81
+
82
+ if java?
83
+ task gem_build_path => [:compile] do
84
+ add_file_to_gem 'lib/psych.jar'
36
85
  end
37
86
  end
38
87
 
data/ext/psych/extconf.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # -*- coding: us-ascii -*-
2
+ # frozen_string_literal: false
2
3
  require 'mkmf'
3
4
  require 'fileutils'
4
5
 
@@ -1,5 +1,12 @@
1
1
  #include <psych.h>
2
2
 
3
+ #if !defined(RARRAY_CONST_PTR)
4
+ #define RARRAY_CONST_PTR(s) (const VALUE *)RARRAY_PTR(s)
5
+ #endif
6
+ #if !defined(RARRAY_AREF)
7
+ #define RARRAY_AREF(a, i) RARRAY_CONST_PTR(a)[i]
8
+ #endif
9
+
3
10
  VALUE cPsychEmitter;
4
11
  static ID id_write;
5
12
  static ID id_line_width;
@@ -15,7 +22,11 @@ static void emit(yaml_emitter_t * emitter, yaml_event_t * event)
15
22
  static int writer(void *ctx, unsigned char *buffer, size_t size)
16
23
  {
17
24
  VALUE io = (VALUE)ctx;
25
+ #ifdef HAVE_RUBY_ENCODING_H
26
+ VALUE str = rb_enc_str_new((const char *)buffer, (long)size, rb_utf8_encoding());
27
+ #else
18
28
  VALUE str = rb_str_new((const char *)buffer, (long)size);
29
+ #endif
19
30
  VALUE wrote = rb_funcall(io, id_write, 1, str);
20
31
  return (int)NUM2INT(wrote);
21
32
  }
@@ -50,14 +61,13 @@ static const rb_data_type_t psych_emitter_type = {
50
61
  static VALUE allocate(VALUE klass)
51
62
  {
52
63
  yaml_emitter_t * emitter;
53
-
54
- emitter = xmalloc(sizeof(yaml_emitter_t));
64
+ VALUE obj = TypedData_Make_Struct(klass, yaml_emitter_t, &psych_emitter_type, emitter);
55
65
 
56
66
  yaml_emitter_initialize(emitter);
57
67
  yaml_emitter_set_unicode(emitter, 1);
58
68
  yaml_emitter_set_indent(emitter, 2);
59
69
 
60
- return TypedData_Wrap_Struct(klass, &psych_emitter_type, emitter);
70
+ return obj;
61
71
  }
62
72
 
63
73
  /* call-seq: Psych::Emitter.new(io, options = Psych::Emitter::OPTIONS)
@@ -156,18 +166,20 @@ static VALUE start_document(VALUE self, VALUE version, VALUE tags, VALUE imp)
156
166
  }
157
167
 
158
168
  if(RTEST(tags)) {
159
- int i = 0;
169
+ long i = 0;
170
+ long len;
160
171
  #ifdef HAVE_RUBY_ENCODING_H
161
172
  rb_encoding * encoding = rb_utf8_encoding();
162
173
  #endif
163
174
 
164
175
  Check_Type(tags, T_ARRAY);
165
176
 
166
- head = xcalloc((size_t)RARRAY_LEN(tags), sizeof(yaml_tag_directive_t));
177
+ len = RARRAY_LEN(tags);
178
+ head = xcalloc((size_t)len, sizeof(yaml_tag_directive_t));
167
179
  tail = head;
168
180
 
169
- for(i = 0; i < RARRAY_LEN(tags); i++) {
170
- VALUE tuple = RARRAY_PTR(tags)[i];
181
+ for(i = 0; i < len && i < RARRAY_LEN(tags); i++) {
182
+ VALUE tuple = RARRAY_AREF(tags, i);
171
183
  VALUE name;
172
184
  VALUE value;
173
185
 
@@ -177,15 +189,17 @@ static VALUE start_document(VALUE self, VALUE version, VALUE tags, VALUE imp)
177
189
  xfree(head);
178
190
  rb_raise(rb_eRuntimeError, "tag tuple must be of length 2");
179
191
  }
180
- name = RARRAY_PTR(tuple)[0];
181
- value = RARRAY_PTR(tuple)[1];
192
+ name = RARRAY_AREF(tuple, 0);
193
+ value = RARRAY_AREF(tuple, 1);
194
+ StringValue(name);
195
+ StringValue(value);
182
196
  #ifdef HAVE_RUBY_ENCODING_H
183
197
  name = rb_str_export_to_enc(name, encoding);
184
198
  value = rb_str_export_to_enc(value, encoding);
185
199
  #endif
186
200
 
187
- tail->handle = (yaml_char_t *)StringValuePtr(name);
188
- tail->prefix = (yaml_char_t *)StringValuePtr(value);
201
+ tail->handle = (yaml_char_t *)RSTRING_PTR(name);
202
+ tail->prefix = (yaml_char_t *)RSTRING_PTR(value);
189
203
 
190
204
  tail++;
191
205
  }
@@ -70,11 +70,11 @@ static const rb_data_type_t psych_parser_type = {
70
70
  static VALUE allocate(VALUE klass)
71
71
  {
72
72
  yaml_parser_t * parser;
73
+ VALUE obj = TypedData_Make_Struct(klass, yaml_parser_t, &psych_parser_type, parser);
73
74
 
74
- parser = xmalloc(sizeof(yaml_parser_t));
75
75
  yaml_parser_initialize(parser);
76
76
 
77
- return TypedData_Wrap_Struct(klass, &psych_parser_type, parser);
77
+ return obj;
78
78
  }
79
79
 
80
80
  static VALUE make_exception(yaml_parser_t * parser, VALUE path)
@@ -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 occurence",
243
- alias_data->mark, "second occurence", data.mark);
242
+ "found duplicate anchor; first occurrence",
243
+ alias_data->mark, "second occurrence", data.mark);
244
244
  }
245
245
  }
246
246
 
@@ -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 intendation level, append
1254
+ * becomes less or equal to the column. For each indentation 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 intendation levels in the stack. */
1269
+ /* Loop through the indentation levels in the stack. */
1270
1270
 
1271
1271
  while (parser->indent > column)
1272
1272
  {
@@ -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 uknown directive name");
2056
+ start_mark, "found unknown 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 intendation is greater than 0. */
2778
+ /* Check that the indentation 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 intendation indicator equal to 0");
2782
+ start_mark, "found an indentation indicator equal to 0");
2783
2783
  goto error;
2784
2784
  }
2785
2785
 
2786
- /* Get the intendation level and eat the indicator. */
2786
+ /* Get the indentation 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 intendation indicator equal to 0");
2800
+ start_mark, "found an indentation 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 intendation level if it was specified. */
2850
+ /* Set the indentation 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 intendation spaces and line breaks. */
2916
+ /* Eat the following indentation 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 intendation spaces and line breaks for a block scalar. Determine the
2952
- * intendation level if needed.
2951
+ * Scan indentation spaces and line breaks for a block scalar. Determine the
2952
+ * indentation 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 intendation spaces and line breaks. */
2964
+ /* Eat the indentation spaces and line breaks. */
2965
2965
 
2966
2966
  while (1)
2967
2967
  {
2968
- /* Eat the intendation spaces. */
2968
+ /* Eat the indentation 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 intendation. */
2981
+ /* Check for a tab character messing the indentation. */
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 intendation space is expected");
2986
+ start_mark, "found a tab character where an indentation space is expected");
2987
2987
  }
2988
2988
 
2989
2989
  /* Have we found a non-empty line? */
@@ -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 intendation. */
3507
+ /* Check for tab character that abuse indentation. */
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 intendation");
3512
+ start_mark, "found a tab character that violate indentation");
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 intendation level. */
3545
+ /* Check indentation level. */
3546
3546
 
3547
3547
  if (!parser->flow_level && (int)parser->mark.column < indent)
3548
3548
  break;
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/omap'
2
3
  require 'psych/set'
3
4
 
data/lib/psych/coder.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  ###
3
4
  # If an object defines +encode_with+, then an instance of Psych::Coder will
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  class Object
2
3
  def self.yaml_tag url
3
4
  Psych.add_tag(url, self)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'date'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  class Exception < RuntimeError
3
4
  end
data/lib/psych/handler.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  ###
3
4
  # Psych::Handler is an abstract base class that defines the events used
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/tree_builder'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/handler'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module JSON
3
4
  module RubyEvents # :nodoc:
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/json/ruby_events'
2
3
  require 'psych/json/yaml_events'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/json/yaml_events'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module JSON
3
4
  module YAMLEvents # :nodoc:
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Nodes
3
4
  ###
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Nodes
3
4
  ###
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Nodes
3
4
  ###
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'stringio'
2
3
  require 'psych/class_loader'
3
4
  require 'psych/scalar_scanner'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Nodes
3
4
  ###
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Nodes
3
4
  ###
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Nodes
3
4
  ###
data/lib/psych/nodes.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/nodes/node'
2
3
  require 'psych/nodes/stream'
3
4
  require 'psych/nodes/document'
data/lib/psych/omap.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  class Omap < ::Hash
3
4
  end
data/lib/psych/parser.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  ###
3
4
  # YAML event parser class. This class parses a YAML document and calls
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'strscan'
2
3
 
3
4
  module Psych
data/lib/psych/set.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  class Set < ::Hash
3
4
  end
data/lib/psych/stream.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  ###
3
4
  # Psych::Stream is a streaming YAML emitter. It will not buffer your YAML,
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Streaming
3
4
  module ClassMethods
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/exception'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/handler'
2
3
 
3
4
  module Psych
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: false
2
+ module Psych
3
+ DEFAULT_SNAKEYAML_VERSION = '1.14'.freeze
4
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Visitors
3
4
  class DepthFirst < Psych::Visitors::Visitor
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Visitors
3
4
  class Emitter < Psych::Visitors::Visitor
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/json/ruby_events'
2
3
 
3
4
  module Psych
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  require 'psych/scalar_scanner'
2
3
  require 'psych/class_loader'
3
4
  require 'psych/exception'
@@ -61,7 +62,7 @@ module Psych
61
62
  case o.tag
62
63
  when '!binary', 'tag:yaml.org,2002:binary'
63
64
  o.value.unpack('m').first
64
- when /^!(?:str|ruby\/string)(?::(.*))?/, 'tag:yaml.org,2002:str'
65
+ when /^!(?:str|ruby\/string)(?::(.*))?$/, 'tag:yaml.org,2002:str'
65
66
  klass = resolve_class($1)
66
67
  if klass
67
68
  klass.allocate.replace o.value
@@ -208,7 +209,7 @@ module Psych
208
209
  obj
209
210
  end
210
211
 
211
- when /^!(?:str|ruby\/string)(?::(.*))?/, 'tag:yaml.org,2002:str'
212
+ when /^!(?:str|ruby\/string)(?::(.*))?$/, 'tag:yaml.org,2002:str'
212
213
  klass = resolve_class($1)
213
214
  members = {}
214
215
  string = nil
@@ -330,12 +331,13 @@ module Psych
330
331
  list
331
332
  end
332
333
 
334
+ SHOVEL = '<<'
333
335
  def revive_hash hash, o
334
336
  o.children.each_slice(2) { |k,v|
335
337
  key = accept(k)
336
338
  val = accept(v)
337
339
 
338
- if key == '<<' && k.tag != "tag:yaml.org,2002:str"
340
+ if key == SHOVEL && k.tag != "tag:yaml.org,2002:str"
339
341
  case v
340
342
  when Nodes::Alias, Nodes::Mapping
341
343
  begin
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: false
1
2
  module Psych
2
3
  module Visitors
3
4
  class Visitor