mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge revision(s) 55497,55498,55504: [Backport #11988]
* ext/psych/*, test/psych/*: Upate psych 2.1.0 This version fixed [Bug #11988][ruby-core:72850] * ext/psych/*, test/psych/*: Update psych 2.1.0 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@55902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
72e63983e6
commit
686fbc8e5f
9 changed files with 78 additions and 37 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Tue Aug 16 02:45:52 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/psych/*, test/psych/*: Update psych 2.1.0
|
||||||
|
This version fixed [Bug #11988][ruby-core:72850]
|
||||||
|
|
||||||
Fri Aug 12 04:15:10 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Fri Aug 12 04:15:10 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* common.mk (build-ext), ext/extmk.rb: use variable EXTENCS
|
* common.mk (build-ext), ext/extmk.rb: use variable EXTENCS
|
||||||
|
|
|
@ -224,11 +224,13 @@ require 'psych/class_loader'
|
||||||
|
|
||||||
module Psych
|
module Psych
|
||||||
# The version is Psych you're using
|
# The version is Psych you're using
|
||||||
VERSION = '2.0.17'
|
VERSION = '2.1.0'
|
||||||
|
|
||||||
# The version of libyaml Psych is using
|
# The version of libyaml Psych is using
|
||||||
LIBYAML_VERSION = Psych.libyaml_version.join '.'
|
LIBYAML_VERSION = Psych.libyaml_version.join '.'
|
||||||
|
|
||||||
|
FALLBACK = Struct.new :to_ruby # :nodoc:
|
||||||
|
|
||||||
###
|
###
|
||||||
# Load +yaml+ in to a Ruby data structure. If multiple documents are
|
# Load +yaml+ in to a Ruby data structure. If multiple documents are
|
||||||
# provided, the object contained in the first document will be returned.
|
# provided, the object contained in the first document will be returned.
|
||||||
|
@ -248,8 +250,8 @@ module Psych
|
||||||
# ex.file # => 'file.txt'
|
# ex.file # => 'file.txt'
|
||||||
# ex.message # => "(file.txt): found character that cannot start any token"
|
# ex.message # => "(file.txt): found character that cannot start any token"
|
||||||
# end
|
# end
|
||||||
def self.load yaml, filename = nil
|
def self.load yaml, filename = nil, fallback = false
|
||||||
result = parse(yaml, filename)
|
result = parse(yaml, filename, fallback)
|
||||||
result ? result.to_ruby : result
|
result ? result.to_ruby : result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -321,11 +323,11 @@ module Psych
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# See Psych::Nodes for more information about YAML AST.
|
# See Psych::Nodes for more information about YAML AST.
|
||||||
def self.parse yaml, filename = nil
|
def self.parse yaml, filename = nil, fallback = false
|
||||||
parse_stream(yaml, filename) do |node|
|
parse_stream(yaml, filename) do |node|
|
||||||
return node
|
return node
|
||||||
end
|
end
|
||||||
false
|
fallback
|
||||||
end
|
end
|
||||||
|
|
||||||
###
|
###
|
||||||
|
@ -466,9 +468,12 @@ module Psych
|
||||||
|
|
||||||
###
|
###
|
||||||
# Load the document contained in +filename+. Returns the yaml contained in
|
# Load the document contained in +filename+. Returns the yaml contained in
|
||||||
# +filename+ as a Ruby object
|
# +filename+ as a Ruby object, or if the file is empty, it returns
|
||||||
def self.load_file filename
|
# the specified default return value, which defaults to an empty Hash
|
||||||
File.open(filename, 'r:bom|utf-8') { |f| self.load f, filename }
|
def self.load_file filename, fallback = false
|
||||||
|
File.open(filename, 'r:bom|utf-8') { |f|
|
||||||
|
self.load f, filename, FALLBACK.new(fallback)
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
# :stopdoc:
|
# :stopdoc:
|
||||||
|
|
|
@ -331,7 +331,7 @@ module Psych
|
||||||
style = Nodes::Scalar::FOLDED
|
style = Nodes::Scalar::FOLDED
|
||||||
elsif o =~ /^[^[:word:]][^"]*$/
|
elsif o =~ /^[^[:word:]][^"]*$/
|
||||||
style = Nodes::Scalar::DOUBLE_QUOTED
|
style = Nodes::Scalar::DOUBLE_QUOTED
|
||||||
elsif not String === @ss.tokenize(o)
|
elsif not String === @ss.tokenize(o) or /\A0[0-7]*[89]/ =~ o
|
||||||
style = Nodes::Scalar::SINGLE_QUOTED
|
style = Nodes::Scalar::SINGLE_QUOTED
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,45 @@
|
||||||
# -*- encoding: utf-8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
# stub: psych 2.0.17 ruby lib
|
# stub: psych 2.1.0 ruby lib
|
||||||
# stub: ext/psych/extconf.rb
|
# stub: ext/psych/extconf.rb
|
||||||
|
|
||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = "psych"
|
s.name = "psych"
|
||||||
s.version = "2.0.17"
|
s.version = "2.1.0"
|
||||||
|
|
||||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||||
s.require_paths = ["lib"]
|
s.require_paths = ["lib"]
|
||||||
s.authors = ["Aaron Patterson"]
|
s.authors = ["Aaron Patterson"]
|
||||||
s.date = "2015-12-07"
|
s.date = "2016-06-24"
|
||||||
s.description = "Psych is a YAML parser and emitter. Psych leverages libyaml[http://pyyaml.org/wiki/LibYAML]\nfor its YAML parsing and emitting capabilities. In addition to wrapping\nlibyaml, Psych also knows how to serialize and de-serialize most Ruby objects\nto and from the YAML format."
|
s.description = "Psych is a YAML parser and emitter. Psych leverages libyaml[http://pyyaml.org/wiki/LibYAML]\nfor its YAML parsing and emitting capabilities. In addition to wrapping\nlibyaml, Psych also knows how to serialize and de-serialize most Ruby objects\nto and from the YAML format."
|
||||||
s.email = ["aaron@tenderlovemaking.com"]
|
s.email = ["aaron@tenderlovemaking.com"]
|
||||||
s.extensions = ["ext/psych/extconf.rb"]
|
s.extensions = ["ext/psych/extconf.rb"]
|
||||||
s.extra_rdoc_files = ["CHANGELOG.rdoc", "README.rdoc"]
|
s.extra_rdoc_files = ["CHANGELOG.rdoc", "Manifest.txt", "README.rdoc", "CHANGELOG.rdoc", "README.rdoc"]
|
||||||
s.files = [".autotest", ".travis.yml", "CHANGELOG.rdoc", "Manifest.txt", "README.rdoc", "Rakefile", "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", "test/psych/handlers/test_recorder.rb", "test/psych/helper.rb", "test/psych/json/test_stream.rb", "test/psych/nodes/test_enumerable.rb", "test/psych/test_alias_and_anchor.rb", "test/psych/test_array.rb", "test/psych/test_boolean.rb", "test/psych/test_class.rb", "test/psych/test_coder.rb", "test/psych/test_date_time.rb", "test/psych/test_deprecated.rb", "test/psych/test_document.rb", "test/psych/test_emitter.rb", "test/psych/test_encoding.rb", "test/psych/test_exception.rb", "test/psych/test_hash.rb", "test/psych/test_json_tree.rb", "test/psych/test_merge_keys.rb", "test/psych/test_nil.rb", "test/psych/test_null.rb", "test/psych/test_numeric.rb", "test/psych/test_object.rb", "test/psych/test_object_references.rb", "test/psych/test_omap.rb", "test/psych/test_parser.rb", "test/psych/test_psych.rb", "test/psych/test_safe_load.rb", "test/psych/test_scalar.rb", "test/psych/test_scalar_scanner.rb", "test/psych/test_serialize_subclasses.rb", "test/psych/test_set.rb", "test/psych/test_stream.rb", "test/psych/test_string.rb", "test/psych/test_struct.rb", "test/psych/test_symbol.rb", "test/psych/test_tainted.rb", "test/psych/test_to_yaml_properties.rb", "test/psych/test_tree_builder.rb", "test/psych/test_yaml.rb", "test/psych/test_yamldbm.rb", "test/psych/test_yamlstore.rb", "test/psych/visitors/test_depth_first.rb", "test/psych/visitors/test_emitter.rb", "test/psych/visitors/test_to_ruby.rb", "test/psych/visitors/test_yaml_tree.rb"]
|
s.files = [".autotest", ".travis.yml", "CHANGELOG.rdoc", "Manifest.txt", "README.rdoc", "Rakefile", "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", "test/psych/handlers/test_recorder.rb", "test/psych/helper.rb", "test/psych/json/test_stream.rb", "test/psych/nodes/test_enumerable.rb", "test/psych/test_alias_and_anchor.rb", "test/psych/test_array.rb", "test/psych/test_boolean.rb", "test/psych/test_class.rb", "test/psych/test_coder.rb", "test/psych/test_date_time.rb", "test/psych/test_deprecated.rb", "test/psych/test_document.rb", "test/psych/test_emitter.rb", "test/psych/test_encoding.rb", "test/psych/test_exception.rb", "test/psych/test_hash.rb", "test/psych/test_json_tree.rb", "test/psych/test_merge_keys.rb", "test/psych/test_nil.rb", "test/psych/test_null.rb", "test/psych/test_numeric.rb", "test/psych/test_object.rb", "test/psych/test_object_references.rb", "test/psych/test_omap.rb", "test/psych/test_parser.rb", "test/psych/test_psych.rb", "test/psych/test_safe_load.rb", "test/psych/test_scalar.rb", "test/psych/test_scalar_scanner.rb", "test/psych/test_serialize_subclasses.rb", "test/psych/test_set.rb", "test/psych/test_stream.rb", "test/psych/test_string.rb", "test/psych/test_struct.rb", "test/psych/test_symbol.rb", "test/psych/test_tainted.rb", "test/psych/test_to_yaml_properties.rb", "test/psych/test_tree_builder.rb", "test/psych/test_yaml.rb", "test/psych/test_yamldbm.rb", "test/psych/test_yamlstore.rb", "test/psych/visitors/test_depth_first.rb", "test/psych/visitors/test_emitter.rb", "test/psych/visitors/test_to_ruby.rb", "test/psych/visitors/test_yaml_tree.rb"]
|
||||||
s.homepage = "http://github.com/tenderlove/psych"
|
s.homepage = "http://github.com/tenderlove/psych"
|
||||||
s.licenses = ["MIT"]
|
s.licenses = ["MIT"]
|
||||||
s.rdoc_options = ["--main", "README.rdoc"]
|
s.rdoc_options = ["--main", "README.rdoc"]
|
||||||
s.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
|
s.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
|
||||||
s.rubygems_version = "2.5.0"
|
s.rubygems_version = "2.5.1"
|
||||||
s.summary = "Psych is a YAML parser and emitter"
|
s.summary = "Psych is a YAML parser and emitter"
|
||||||
s.test_files = ["test/psych/handlers/test_recorder.rb", "test/psych/json/test_stream.rb", "test/psych/nodes/test_enumerable.rb", "test/psych/test_alias_and_anchor.rb", "test/psych/test_array.rb", "test/psych/test_boolean.rb", "test/psych/test_class.rb", "test/psych/test_coder.rb", "test/psych/test_date_time.rb", "test/psych/test_deprecated.rb", "test/psych/test_document.rb", "test/psych/test_emitter.rb", "test/psych/test_encoding.rb", "test/psych/test_exception.rb", "test/psych/test_hash.rb", "test/psych/test_json_tree.rb", "test/psych/test_marshalable.rb", "test/psych/test_merge_keys.rb", "test/psych/test_nil.rb", "test/psych/test_null.rb", "test/psych/test_numeric.rb", "test/psych/test_object.rb", "test/psych/test_object_references.rb", "test/psych/test_omap.rb", "test/psych/test_parser.rb", "test/psych/test_psych.rb", "test/psych/test_safe_load.rb", "test/psych/test_scalar.rb", "test/psych/test_scalar_scanner.rb", "test/psych/test_serialize_subclasses.rb", "test/psych/test_set.rb", "test/psych/test_stream.rb", "test/psych/test_string.rb", "test/psych/test_struct.rb", "test/psych/test_symbol.rb", "test/psych/test_tainted.rb", "test/psych/test_to_yaml_properties.rb", "test/psych/test_tree_builder.rb", "test/psych/test_yaml.rb", "test/psych/test_yamldbm.rb", "test/psych/test_yamlstore.rb", "test/psych/visitors/test_depth_first.rb", "test/psych/visitors/test_emitter.rb", "test/psych/visitors/test_to_ruby.rb", "test/psych/visitors/test_yaml_tree.rb"]
|
|
||||||
|
if s.respond_to? :specification_version then
|
||||||
|
s.specification_version = 4
|
||||||
|
|
||||||
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
||||||
|
s.add_development_dependency(%q<rdoc>, ["~> 4.0"])
|
||||||
|
s.add_development_dependency(%q<rake-compiler>, [">= 0.4.1"])
|
||||||
|
s.add_development_dependency(%q<minitest>, ["~> 5.0"])
|
||||||
|
s.add_development_dependency(%q<hoe>, ["~> 3.15"])
|
||||||
|
else
|
||||||
|
s.add_dependency(%q<rdoc>, ["~> 4.0"])
|
||||||
|
s.add_dependency(%q<rake-compiler>, [">= 0.4.1"])
|
||||||
|
s.add_dependency(%q<minitest>, ["~> 5.0"])
|
||||||
|
s.add_dependency(%q<hoe>, ["~> 3.15"])
|
||||||
|
end
|
||||||
|
else
|
||||||
|
s.add_dependency(%q<rdoc>, ["~> 4.0"])
|
||||||
|
s.add_dependency(%q<rake-compiler>, [">= 0.4.1"])
|
||||||
|
s.add_dependency(%q<minitest>, ["~> 5.0"])
|
||||||
|
s.add_dependency(%q<hoe>, ["~> 3.15"])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -239,8 +239,8 @@ yaml_parser_register_anchor(yaml_parser_t *parser,
|
||||||
if (strcmp((char *)alias_data->anchor, (char *)anchor) == 0) {
|
if (strcmp((char *)alias_data->anchor, (char *)anchor) == 0) {
|
||||||
yaml_free(anchor);
|
yaml_free(anchor);
|
||||||
return yaml_parser_set_composer_error_context(parser,
|
return yaml_parser_set_composer_error_context(parser,
|
||||||
"found duplicate anchor; first occurence",
|
"found duplicate anchor; first occurrence",
|
||||||
alias_data->mark, "second occurence", data.mark);
|
alias_data->mark, "second occurrence", data.mark);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1251,7 +1251,7 @@ yaml_parser_roll_indent(yaml_parser_t *parser, ptrdiff_t column,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pop indentation levels from the indents stack until the current level
|
* Pop indentation levels from the indents stack until the current level
|
||||||
* becomes less or equal to the column. For each intendation level, append
|
* becomes less or equal to the column. For each indentation level, append
|
||||||
* the BLOCK-END token.
|
* the BLOCK-END token.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -1266,7 +1266,7 @@ yaml_parser_unroll_indent(yaml_parser_t *parser, ptrdiff_t column)
|
||||||
if (parser->flow_level)
|
if (parser->flow_level)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* Loop through the intendation levels in the stack. */
|
/* Loop through the indentation levels in the stack. */
|
||||||
|
|
||||||
while (parser->indent > column)
|
while (parser->indent > column)
|
||||||
{
|
{
|
||||||
|
@ -2775,15 +2775,15 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token,
|
||||||
|
|
||||||
if (IS_DIGIT(parser->buffer))
|
if (IS_DIGIT(parser->buffer))
|
||||||
{
|
{
|
||||||
/* Check that the intendation is greater than 0. */
|
/* Check that the indentation is greater than 0. */
|
||||||
|
|
||||||
if (CHECK(parser->buffer, '0')) {
|
if (CHECK(parser->buffer, '0')) {
|
||||||
yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
|
yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
|
||||||
start_mark, "found an intendation indicator equal to 0");
|
start_mark, "found an indentation indicator equal to 0");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the intendation level and eat the indicator. */
|
/* Get the indentation level and eat the indicator. */
|
||||||
|
|
||||||
increment = AS_DIGIT(parser->buffer);
|
increment = AS_DIGIT(parser->buffer);
|
||||||
|
|
||||||
|
@ -2797,7 +2797,7 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token,
|
||||||
{
|
{
|
||||||
if (CHECK(parser->buffer, '0')) {
|
if (CHECK(parser->buffer, '0')) {
|
||||||
yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
|
yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
|
||||||
start_mark, "found an intendation indicator equal to 0");
|
start_mark, "found an indentation indicator equal to 0");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2847,7 +2847,7 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token,
|
||||||
|
|
||||||
end_mark = parser->mark;
|
end_mark = parser->mark;
|
||||||
|
|
||||||
/* Set the intendation level if it was specified. */
|
/* Set the indentation level if it was specified. */
|
||||||
|
|
||||||
if (increment) {
|
if (increment) {
|
||||||
indent = parser->indent >= 0 ? parser->indent+increment : increment;
|
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,
|
||||||
|
|
||||||
if (!READ_LINE(parser, leading_break)) goto error;
|
if (!READ_LINE(parser, leading_break)) goto error;
|
||||||
|
|
||||||
/* Eat the following intendation spaces and line breaks. */
|
/* Eat the following indentation spaces and line breaks. */
|
||||||
|
|
||||||
if (!yaml_parser_scan_block_scalar_breaks(parser,
|
if (!yaml_parser_scan_block_scalar_breaks(parser,
|
||||||
&indent, &trailing_breaks, start_mark, &end_mark)) goto error;
|
&indent, &trailing_breaks, start_mark, &end_mark)) goto error;
|
||||||
|
@ -2948,8 +2948,8 @@ error:
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scan intendation spaces and line breaks for a block scalar. Determine the
|
* Scan indentation spaces and line breaks for a block scalar. Determine the
|
||||||
* intendation level if needed.
|
* indentation level if needed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -2961,11 +2961,11 @@ yaml_parser_scan_block_scalar_breaks(yaml_parser_t *parser,
|
||||||
|
|
||||||
*end_mark = parser->mark;
|
*end_mark = parser->mark;
|
||||||
|
|
||||||
/* Eat the intendation spaces and line breaks. */
|
/* Eat the indentation spaces and line breaks. */
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
/* Eat the intendation spaces. */
|
/* Eat the indentation spaces. */
|
||||||
|
|
||||||
if (!CACHE(parser, 1)) return 0;
|
if (!CACHE(parser, 1)) return 0;
|
||||||
|
|
||||||
|
@ -2978,12 +2978,12 @@ yaml_parser_scan_block_scalar_breaks(yaml_parser_t *parser,
|
||||||
if ((int)parser->mark.column > max_indent)
|
if ((int)parser->mark.column > max_indent)
|
||||||
max_indent = (int)parser->mark.column;
|
max_indent = (int)parser->mark.column;
|
||||||
|
|
||||||
/* Check for a tab character messing the intendation. */
|
/* Check for a tab character messing the indentation. */
|
||||||
|
|
||||||
if ((!*indent || (int)parser->mark.column < *indent)
|
if ((!*indent || (int)parser->mark.column < *indent)
|
||||||
&& IS_TAB(parser->buffer)) {
|
&& IS_TAB(parser->buffer)) {
|
||||||
return yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
|
return yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
|
||||||
start_mark, "found a tab character where an intendation space is expected");
|
start_mark, "found a tab character where an indentation space is expected");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Have we found a non-empty line? */
|
/* Have we found a non-empty line? */
|
||||||
|
@ -3504,12 +3504,12 @@ yaml_parser_scan_plain_scalar(yaml_parser_t *parser, yaml_token_t *token)
|
||||||
{
|
{
|
||||||
if (IS_BLANK(parser->buffer))
|
if (IS_BLANK(parser->buffer))
|
||||||
{
|
{
|
||||||
/* Check for tab character that abuse intendation. */
|
/* Check for tab character that abuse indentation. */
|
||||||
|
|
||||||
if (leading_blanks && (int)parser->mark.column < indent
|
if (leading_blanks && (int)parser->mark.column < indent
|
||||||
&& IS_TAB(parser->buffer)) {
|
&& IS_TAB(parser->buffer)) {
|
||||||
yaml_parser_set_scanner_error(parser, "while scanning a plain scalar",
|
yaml_parser_set_scanner_error(parser, "while scanning a plain scalar",
|
||||||
start_mark, "found a tab character that violate intendation");
|
start_mark, "found a tab character that violate indentation");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3542,7 +3542,7 @@ yaml_parser_scan_plain_scalar(yaml_parser_t *parser, yaml_token_t *token)
|
||||||
if (!CACHE(parser, 1)) goto error;
|
if (!CACHE(parser, 1)) goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check intendation level. */
|
/* Check indentation level. */
|
||||||
|
|
||||||
if (!parser->flow_level && (int)parser->mark.column < indent)
|
if (!parser->flow_level && (int)parser->mark.column < indent)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -144,6 +144,11 @@ class TestPsych < Psych::TestCase
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_load_file_with_fallback
|
||||||
|
t = Tempfile.create(['empty', 'yml'])
|
||||||
|
assert_equal Hash.new, Psych.load_file(t.path, Hash.new)
|
||||||
|
end
|
||||||
|
|
||||||
def test_parse_file
|
def test_parse_file
|
||||||
Tempfile.create(['yikes', 'yml']) {|t|
|
Tempfile.create(['yikes', 'yml']) {|t|
|
||||||
t.binmode
|
t.binmode
|
||||||
|
|
|
@ -156,6 +156,12 @@ module Psych
|
||||||
assert_equal(-1, Psych.load(Psych.dump(-1 / 0.0)).infinite?)
|
assert_equal(-1, Psych.load(Psych.dump(-1 / 0.0)).infinite?)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_string
|
||||||
|
assert_match(/'017'/, Psych.dump({'a' => '017'}))
|
||||||
|
assert_match(/'019'/, Psych.dump({'a' => '019'}))
|
||||||
|
assert_match(/'01818'/, Psych.dump({'a' => '01818'}))
|
||||||
|
end
|
||||||
|
|
||||||
# http://yaml.org/type/null.html
|
# http://yaml.org/type/null.html
|
||||||
def test_nil
|
def test_nil
|
||||||
assert_cycle nil
|
assert_cycle nil
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#define RUBY_VERSION "2.3.2"
|
#define RUBY_VERSION "2.3.2"
|
||||||
#define RUBY_RELEASE_DATE "2016-08-12"
|
#define RUBY_RELEASE_DATE "2016-08-16"
|
||||||
#define RUBY_PATCHLEVEL 152
|
#define RUBY_PATCHLEVEL 153
|
||||||
|
|
||||||
#define RUBY_RELEASE_YEAR 2016
|
#define RUBY_RELEASE_YEAR 2016
|
||||||
#define RUBY_RELEASE_MONTH 8
|
#define RUBY_RELEASE_MONTH 8
|
||||||
#define RUBY_RELEASE_DAY 12
|
#define RUBY_RELEASE_DAY 16
|
||||||
|
|
||||||
#include "ruby/version.h"
|
#include "ruby/version.h"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue