syck 1.4.1 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/ext/syck/gram.h CHANGED
@@ -1,12 +1,14 @@
1
- /* A Bison parser, made by GNU Bison 1.875d. */
1
+ /* A Bison parser, made by GNU Bison 3.8.2. */
2
2
 
3
- /* Skeleton parser for Yacc-like parsing with Bison,
4
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
3
+ /* Bison interface for Yacc-like parsers in C
5
4
 
6
- This program is free software; you can redistribute it and/or modify
5
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
6
+ Inc.
7
+
8
+ This program is free software: you can redistribute it and/or modify
7
9
  it under the terms of the GNU General Public License as published by
8
- the Free Software Foundation; either version 2, or (at your option)
9
- any later version.
10
+ the Free Software Foundation, either version 3 of the License, or
11
+ (at your option) any later version.
10
12
 
11
13
  This program is distributed in the hope that it will be useful,
12
14
  but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,66 +16,82 @@
14
16
  GNU General Public License for more details.
15
17
 
16
18
  You should have received a copy of the GNU General Public License
17
- along with this program; if not, write to the Free Software
18
- Foundation, Inc., 59 Temple Place - Suite 330,
19
- Boston, MA 02111-1307, USA. */
19
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
20
20
 
21
- /* As a special exception, when this file is copied by Bison into a
22
- Bison output file, you may use that output file without restriction.
23
- This special exception was added by the Free Software Foundation
24
- in version 1.24 of Bison. */
21
+ /* As a special exception, you may create a larger work that contains
22
+ part or all of the Bison parser skeleton and distribute that work
23
+ under terms of your choice, so long as that work isn't itself a
24
+ parser generator using the skeleton or a modified version thereof
25
+ as a parser skeleton. Alternatively, if you modify or redistribute
26
+ the parser skeleton itself, you may (at your option) remove this
27
+ special exception, which will cause the skeleton and the resulting
28
+ Bison output files to be licensed under the GNU General Public
29
+ License without this special exception.
25
30
 
26
- /* Tokens. */
27
- #ifndef YYTOKENTYPE
28
- # define YYTOKENTYPE
29
- /* Put the tokens into the symbol table, so that GDB and other debuggers
30
- know about them. */
31
- enum yytokentype {
32
- YAML_ANCHOR = 258,
33
- YAML_ALIAS = 259,
34
- YAML_TRANSFER = 260,
35
- YAML_TAGURI = 261,
36
- YAML_ITRANSFER = 262,
37
- YAML_WORD = 263,
38
- YAML_PLAIN = 264,
39
- YAML_BLOCK = 265,
40
- YAML_DOCSEP = 266,
41
- YAML_IOPEN = 267,
42
- YAML_INDENT = 268,
43
- YAML_IEND = 269
44
- };
45
- #endif
46
- #define YAML_ANCHOR 258
47
- #define YAML_ALIAS 259
48
- #define YAML_TRANSFER 260
49
- #define YAML_TAGURI 261
50
- #define YAML_ITRANSFER 262
51
- #define YAML_WORD 263
52
- #define YAML_PLAIN 264
53
- #define YAML_BLOCK 265
54
- #define YAML_DOCSEP 266
55
- #define YAML_IOPEN 267
56
- #define YAML_INDENT 268
57
- #define YAML_IEND 269
31
+ This special exception was added by the Free Software Foundation in
32
+ version 2.2 of Bison. */
58
33
 
34
+ /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
35
+ especially those whose name start with YY_ or yy_. They are
36
+ private implementation details that can be changed or removed. */
59
37
 
38
+ #ifndef YY_YY_GRAM_H_INCLUDED
39
+ # define YY_YY_GRAM_H_INCLUDED
40
+ /* Debug traces. */
41
+ #ifndef YYDEBUG
42
+ # define YYDEBUG 0
43
+ #endif
44
+ #if YYDEBUG
45
+ extern int yydebug;
46
+ #endif
60
47
 
48
+ /* Token kinds. */
49
+ #ifndef YYTOKENTYPE
50
+ # define YYTOKENTYPE
51
+ enum yytokentype
52
+ {
53
+ YYEMPTY = -2,
54
+ YYEOF = 0, /* "end of file" */
55
+ YYerror = 256, /* error */
56
+ YYUNDEF = 257, /* "invalid token" */
57
+ YAML_ANCHOR = 258, /* YAML_ANCHOR */
58
+ YAML_ALIAS = 259, /* YAML_ALIAS */
59
+ YAML_TRANSFER = 260, /* YAML_TRANSFER */
60
+ YAML_TAGURI = 261, /* YAML_TAGURI */
61
+ YAML_ITRANSFER = 262, /* YAML_ITRANSFER */
62
+ YAML_WORD = 263, /* YAML_WORD */
63
+ YAML_PLAIN = 264, /* YAML_PLAIN */
64
+ YAML_BLOCK = 265, /* YAML_BLOCK */
65
+ YAML_DOCSEP = 266, /* YAML_DOCSEP */
66
+ YAML_IOPEN = 267, /* YAML_IOPEN */
67
+ YAML_INDENT = 268, /* YAML_INDENT */
68
+ YAML_IEND = 269 /* YAML_IEND */
69
+ };
70
+ typedef enum yytokentype yytoken_kind_t;
71
+ #endif
61
72
 
62
- #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
73
+ /* Value type. */
74
+ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
75
+ union YYSTYPE
76
+ {
63
77
  #line 35 "gram.y"
64
- typedef union YYSTYPE {
78
+
65
79
  SYMID nodeId;
66
80
  SyckNode *nodeData;
67
81
  char *name;
68
- } YYSTYPE;
69
- /* Line 1285 of yacc.c. */
70
- #line 71 "gram.h"
71
- # define yystype YYSTYPE /* obsolescent; will be withdrawn */
72
- # define YYSTYPE_IS_DECLARED 1
82
+
83
+ #line 84 "gram.h"
84
+
85
+ };
86
+ typedef union YYSTYPE YYSTYPE;
73
87
  # define YYSTYPE_IS_TRIVIAL 1
88
+ # define YYSTYPE_IS_DECLARED 1
74
89
  #endif
75
90
 
76
91
 
77
92
 
78
93
 
94
+ int yyparse (void *YYPARSE_PARAM);
95
+
79
96
 
97
+ #endif /* !YY_YY_GRAM_H_INCLUDED */
data/ext/syck/rubyext.c CHANGED
@@ -322,7 +322,7 @@ mktime_do(VALUE varg)
322
322
  }
323
323
 
324
324
  VALUE
325
- mktime_r(VALUE varg)
325
+ mktime_r(VALUE varg, VALUE errinfo)
326
326
  {
327
327
  struct mktime_arg *arg = (struct mktime_arg *)varg;
328
328
 
@@ -351,7 +351,13 @@ rb_syck_mktime(const char *str, long len)
351
351
  * (see http://www.yaml.org/type/merge/)
352
352
  */
353
353
  VALUE
354
- syck_merge_i(VALUE entry, VALUE hsh )
354
+ syck_merge_i(
355
+ #ifdef RB_BLOCK_CALL_FUNC_ARGLIST
356
+ RB_BLOCK_CALL_FUNC_ARGLIST(entry, hsh)
357
+ #else
358
+ VALUE entry, VALUE hsh
359
+ #endif
360
+ )
355
361
  {
356
362
  VALUE tmp;
357
363
  if ( !NIL_P(tmp = rb_check_convert_type(entry, T_HASH, "Hash", "to_hash")) )
@@ -649,7 +655,7 @@ rb_syck_load_handler(SyckParser *p, SyckNode *n)
649
655
  /*
650
656
  * Create node,
651
657
  */
652
- obj = rb_funcall( resolver, s_node_import, 1, Data_Wrap_Struct( cNode, NULL, NULL, n ) );
658
+ obj = rb_funcall( resolver, s_node_import, 1, Data_Wrap_Struct( cNode, syck_node_mark, NULL, n ) );
653
659
 
654
660
  /*
655
661
  * ID already set, let's alter the symbol table to accept the new object
@@ -733,9 +739,9 @@ syck_set_model(VALUE p, VALUE input, VALUE model)
733
739
  }
734
740
 
735
741
  static int
736
- syck_st_mark_nodes( char *key, SyckNode *n, char *arg )
742
+ syck_st_mark_nodes( st_data_t key, st_data_t n, st_data_t arg )
737
743
  {
738
- if ( n != (void *)1 ) syck_node_mark( n );
744
+ if ( n != 1 ) syck_node_mark( (SyckNode *)n );
739
745
  return ST_CONTINUE;
740
746
  }
741
747
 
@@ -1042,7 +1048,13 @@ syck_resolver_node_import(VALUE self, VALUE node)
1042
1048
  * Set instance variables
1043
1049
  */
1044
1050
  VALUE
1045
- syck_set_ivars(VALUE vars, VALUE obj)
1051
+ syck_set_ivars(
1052
+ #ifdef RB_BLOCK_CALL_FUNC_ARGLIST
1053
+ RB_BLOCK_CALL_FUNC_ARGLIST(vars, obj)
1054
+ #else
1055
+ VALUE vars, VALUE obj
1056
+ #endif
1057
+ )
1046
1058
  {
1047
1059
  VALUE ivname = rb_ary_entry( vars, 0 );
1048
1060
  char *ivn;
@@ -2231,6 +2243,7 @@ Init_syck()
2231
2243
  * Define YAML::Syck::Node class
2232
2244
  */
2233
2245
  cNode = rb_define_class_under( rb_syck, "Node", rb_cObject );
2246
+ rb_undef_alloc_func(cNode);
2234
2247
  rb_undef( cNode, rb_intern("initialize_copy") );
2235
2248
  rb_define_attr( cNode, "emitter", 1, 1 );
2236
2249
  rb_define_attr( cNode, "resolver", 1, 1 );
data/ext/syck/syck.c CHANGED
@@ -201,10 +201,14 @@ syck_lookup_sym( SyckParser *p, SYMID id, void **datap )
201
201
  }
202
202
 
203
203
  int
204
- syck_st_free_nodes( char *key, SyckNode *n, char *arg )
205
- {
206
- if ( n != (void *)1 ) syck_free_node( n );
207
- n = NULL;
204
+ syck_st_free_nodes( st_data_t key, st_data_t n, st_data_t arg )
205
+ {
206
+ if ( n != 1 ) syck_free_node( (SyckNode *)n );
207
+ /* Previously, this codde declared the `n` parameter as `SyckNode *`, and this
208
+ * code said `n = NULL`. That's obviously a no-op, and this code _probably_ should
209
+ * have said `*n = NULL`. However I'm terrified of actually changing Syck's behaviour
210
+ * at this juncture, so I'll just adjust the type of the assignment to 0 from NULL. */
211
+ n = 0;
208
212
  return ST_CONTINUE;
209
213
  }
210
214
 
@@ -238,10 +242,11 @@ typedef struct {
238
242
  } bytestring_t;
239
243
 
240
244
  int
241
- syck_st_free_syms( void *key, bytestring_t *sav, void *dummy )
245
+ syck_st_free_syms( st_data_t key, st_data_t sav, st_data_t dummy )
242
246
  {
243
- S_FREE(sav->buffer);
244
- S_FREE(sav);
247
+ bytestring_t *sav_ptr = (bytestring_t *)sav;
248
+ S_FREE(sav_ptr->buffer);
249
+ S_FREE(sav_ptr);
245
250
  return ST_CONTINUE;
246
251
  }
247
252
 
@@ -6,7 +6,7 @@ module Syck
6
6
  #
7
7
  # Constants
8
8
  #
9
- VERSION = '1.4.1'
9
+ VERSION = '1.5.1'
10
10
  SUPPORTED_YAML_VERSIONS = ['1.0']
11
11
 
12
12
  #
data/syck-1.5.0.gem ADDED
Binary file
data/syck.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "syck"
5
- s.version = "1.4.1"
5
+ s.version = "1.5.1"
6
6
 
7
7
  s.summary = "A gemified version of Syck from Ruby's stdlib"
8
8
  s.description = "A gemified version of Syck from Ruby's stdlib. Syck has been removed from\nRuby's stdlib, and this gem is meant to bridge the gap for people that haven't\nupdated their YAML yet."
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
12
12
  s.license = "MIT"
13
13
  s.require_paths = ["lib"]
14
14
  s.extensions = ["ext/syck/extconf.rb"]
15
- s.files = Dir["[A-Z]*", "ext/**/*", "lib/**/*.rb", "test/**/*.rb"] - %w[Gemfile.lock]
16
- s.extra_rdoc_files = ["CHANGELOG.rdoc", "README.rdoc"]
15
+ s.files = Dir["[A-Z]*", "ext/**/*", "lib/**/*.rb", "test/**/*.rb"] - %w[Gemfile.lock ext/syck/gram.y]
16
+ s.extra_rdoc_files = ["README.rdoc"]
17
17
  s.test_files = Dir["test/**/*.rb"]
18
18
  s.rdoc_options = ["--main", "README.rdoc"]
19
19
  s.required_ruby_version = Gem::Requirement.new(">= 2.0.0")
data/test/test_gc.rb ADDED
@@ -0,0 +1,34 @@
1
+ require 'helper'
2
+
3
+ module Syck
4
+ class TestGC < Test::Unit::TestCase
5
+ def setup
6
+ @big_array = 20.times.map do |i|
7
+ h = {}
8
+ %w[a b c].each do |k|
9
+ h[k] = Random.bytes(16).unpack('H*').first
10
+ end
11
+ %w[d e f].each do |k|
12
+ h[k] = Random.rand(0...100_000)
13
+ end
14
+ h
15
+ end
16
+ GC.stress = true
17
+ end
18
+
19
+ def teardown
20
+ GC.stress = false
21
+ end
22
+
23
+ def test_dump_load_many_hashes
24
+ yaml = Syck.dump(@big_array)
25
+ 2.times { Syck.load(yaml) }
26
+ # If it doesn't segfault, it passed
27
+ end
28
+
29
+ def test_dump_parse_many_hashes
30
+ yaml = Syck.dump(@big_array)
31
+ 2.times { Syck.parse(yaml) }
32
+ end
33
+ end
34
+ end
data/test/test_yaml.rb CHANGED
@@ -15,7 +15,7 @@ module Syck
15
15
  class YAML_Unit_Tests < Test::Unit::TestCase
16
16
  # [ruby-core:34969]
17
17
  def test_regexp_with_n
18
- assert_cycle(Regexp.new('',0,'n'))
18
+ assert_cycle(Regexp.new('', 0))
19
19
  end
20
20
 
21
21
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syck
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroshi SHIBATA
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-01-11 00:00:00.000000000 Z
13
+ date: 2024-08-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -65,14 +65,13 @@ executables: []
65
65
  extensions:
66
66
  - ext/syck/extconf.rb
67
67
  extra_rdoc_files:
68
- - CHANGELOG.rdoc
69
68
  - README.rdoc
70
69
  files:
71
- - CHANGELOG.rdoc
72
70
  - Gemfile
73
71
  - README.rdoc
74
72
  - Rakefile
75
73
  - ext/syck/bytecode.c
74
+ - ext/syck/compile_commands.json
76
75
  - ext/syck/emitter.c
77
76
  - ext/syck/extconf.h
78
77
  - ext/syck/extconf.rb
@@ -103,12 +102,14 @@ files:
103
102
  - lib/syck/yamlnode.rb
104
103
  - lib/syck/ypath.rb
105
104
  - lib/yaml/syck.rb
105
+ - syck-1.5.0.gem
106
106
  - syck.gemspec
107
107
  - test/helper.rb
108
108
  - test/test_array.rb
109
109
  - test/test_boolean.rb
110
110
  - test/test_class.rb
111
111
  - test/test_exception.rb
112
+ - test/test_gc.rb
112
113
  - test/test_hash.rb
113
114
  - test/test_null.rb
114
115
  - test/test_omap.rb
@@ -140,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
141
  - !ruby/object:Gem::Version
141
142
  version: 0.9.5
142
143
  requirements: []
143
- rubygems_version: 3.4.0.dev
144
+ rubygems_version: 3.5.9
144
145
  signing_key:
145
146
  specification_version: 4
146
147
  summary: A gemified version of Syck from Ruby's stdlib
@@ -150,6 +151,7 @@ test_files:
150
151
  - test/test_boolean.rb
151
152
  - test/test_class.rb
152
153
  - test/test_exception.rb
154
+ - test/test_gc.rb
153
155
  - test/test_hash.rb
154
156
  - test/test_null.rb
155
157
  - test/test_omap.rb
data/CHANGELOG.rdoc DELETED
@@ -1,36 +0,0 @@
1
- === 1.4.0 / 2019-01-04
2
-
3
- * Support to build with Ruby 2.6.
4
-
5
- === 1.3.0 / 2017-05-02
6
-
7
- Compatibility Changes:
8
-
9
- * Removed `YAML::EngineManager`. It's not working after Ruby 2.2.
10
- We completely gave up to support it.
11
-
12
- === 1.2.0 / 2016-11-12
13
-
14
- Bug fixes:
15
-
16
- * Fix build error with Ruby 2.4.0
17
-
18
- === 1.1.0 / 2016-03-22
19
-
20
- Bug fixes:
21
-
22
- * Fix broken tests with Ruby 2.0.0 or later.
23
-
24
- Enhancements:
25
-
26
- * Skipped Syck specific methods on Psych engine.
27
-
28
- Known issues:
29
-
30
- * Can't switch back to Psych.
31
-
32
- === 1.0.0 / 2012-09-24
33
-
34
- * 1 major enhancement
35
-
36
- * Birthday!