syck 1.0.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 (54) hide show
  1. data/.autotest.erb +8 -0
  2. data/.gemtest +0 -0
  3. data/CHANGELOG.rdoc +6 -0
  4. data/Manifest.txt +52 -0
  5. data/README.rdoc +51 -0
  6. data/Rakefile +32 -0
  7. data/ext/syck/bytecode.c +1165 -0
  8. data/ext/syck/emitter.c +1247 -0
  9. data/ext/syck/extconf.h +3 -0
  10. data/ext/syck/extconf.rb +5 -0
  11. data/ext/syck/gram.c +1894 -0
  12. data/ext/syck/gram.h +79 -0
  13. data/ext/syck/handler.c +173 -0
  14. data/ext/syck/implicit.c +2990 -0
  15. data/ext/syck/node.c +407 -0
  16. data/ext/syck/rubyext.c +2328 -0
  17. data/ext/syck/syck.c +524 -0
  18. data/ext/syck/syck.h +453 -0
  19. data/ext/syck/token.c +2724 -0
  20. data/ext/syck/yaml2byte.c +259 -0
  21. data/ext/syck/yamlbyte.h +171 -0
  22. data/lib/syck.bundle +0 -0
  23. data/lib/syck.rb +447 -0
  24. data/lib/syck/baseemitter.rb +242 -0
  25. data/lib/syck/basenode.rb +222 -0
  26. data/lib/syck/constants.rb +45 -0
  27. data/lib/syck/encoding.rb +35 -0
  28. data/lib/syck/error.rb +34 -0
  29. data/lib/syck/loader.rb +14 -0
  30. data/lib/syck/rubytypes.rb +450 -0
  31. data/lib/syck/stream.rb +41 -0
  32. data/lib/syck/stringio.rb +85 -0
  33. data/lib/syck/syck.rb +16 -0
  34. data/lib/syck/tag.rb +95 -0
  35. data/lib/syck/types.rb +192 -0
  36. data/lib/syck/yamlnode.rb +54 -0
  37. data/lib/syck/ypath.rb +54 -0
  38. data/lib/yaml/syck.rb +14 -0
  39. data/test/helper.rb +2 -0
  40. data/test/test_array.rb +13 -0
  41. data/test/test_boolean.rb +36 -0
  42. data/test/test_class.rb +11 -0
  43. data/test/test_exception.rb +45 -0
  44. data/test/test_hash.rb +24 -0
  45. data/test/test_null.rb +19 -0
  46. data/test/test_omap.rb +55 -0
  47. data/test/test_set.rb +30 -0
  48. data/test/test_string.rb +44 -0
  49. data/test/test_struct.rb +32 -0
  50. data/test/test_symbol.rb +21 -0
  51. data/test/test_time.rb +23 -0
  52. data/test/test_yaml.rb +1403 -0
  53. data/test/test_yaml_properties.rb +63 -0
  54. metadata +187 -0
@@ -0,0 +1,8 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'autotest/restart'
4
+
5
+ Autotest.add_hook :initialize do |at|
6
+ at.testlib = 'minitest/autorun'
7
+ at.find_directories = ARGV unless ARGV.empty?
8
+ end
File without changes
@@ -0,0 +1,6 @@
1
+ === 1.0.0 / 2012-09-24
2
+
3
+ * 1 major enhancement
4
+
5
+ * Birthday!
6
+
@@ -0,0 +1,52 @@
1
+ .autotest.erb
2
+ CHANGELOG.rdoc
3
+ Manifest.txt
4
+ README.rdoc
5
+ Rakefile
6
+ ext/syck/bytecode.c
7
+ ext/syck/emitter.c
8
+ ext/syck/extconf.h
9
+ ext/syck/extconf.rb
10
+ ext/syck/gram.c
11
+ ext/syck/gram.h
12
+ ext/syck/handler.c
13
+ ext/syck/implicit.c
14
+ ext/syck/node.c
15
+ ext/syck/rubyext.c
16
+ ext/syck/syck.c
17
+ ext/syck/syck.h
18
+ ext/syck/token.c
19
+ ext/syck/yaml2byte.c
20
+ ext/syck/yamlbyte.h
21
+ lib/syck.bundle
22
+ lib/syck.rb
23
+ lib/syck/baseemitter.rb
24
+ lib/syck/basenode.rb
25
+ lib/syck/constants.rb
26
+ lib/syck/encoding.rb
27
+ lib/syck/error.rb
28
+ lib/syck/loader.rb
29
+ lib/syck/rubytypes.rb
30
+ lib/syck/stream.rb
31
+ lib/syck/stringio.rb
32
+ lib/syck/syck.rb
33
+ lib/syck/tag.rb
34
+ lib/syck/types.rb
35
+ lib/syck/yamlnode.rb
36
+ lib/syck/ypath.rb
37
+ lib/yaml/syck.rb
38
+ test/helper.rb
39
+ test/test_array.rb
40
+ test/test_boolean.rb
41
+ test/test_class.rb
42
+ test/test_exception.rb
43
+ test/test_hash.rb
44
+ test/test_null.rb
45
+ test/test_omap.rb
46
+ test/test_set.rb
47
+ test/test_string.rb
48
+ test/test_struct.rb
49
+ test/test_symbol.rb
50
+ test/test_time.rb
51
+ test/test_yaml.rb
52
+ test/test_yaml_properties.rb
@@ -0,0 +1,51 @@
1
+ = syck
2
+
3
+ * http://github.com/tenderlove/syck
4
+
5
+ == DESCRIPTION:
6
+
7
+ A gemified version of Syck from Ruby's stdlib. Syck has been removed from
8
+ Ruby's stdlib, and this gem is meant to bridge the gap for people that haven't
9
+ updated their YAML yet.
10
+
11
+ == FEATURES/PROBLEMS:
12
+
13
+ * Monkeypatches the crap out of everything
14
+
15
+ == SYNOPSIS:
16
+
17
+ require 'syck'
18
+ Syck.dump %w{ foo bar baz }
19
+
20
+ == REQUIREMENTS:
21
+
22
+ * Ruby
23
+
24
+ == INSTALL:
25
+
26
+ * gem install syck
27
+
28
+ == LICENSE:
29
+
30
+ (The MIT License)
31
+
32
+ Copyright (c) 2012 Aaron Patterson, why the lucky stiff
33
+
34
+ Permission is hereby granted, free of charge, to any person obtaining
35
+ a copy of this software and associated documentation files (the
36
+ 'Software'), to deal in the Software without restriction, including
37
+ without limitation the rights to use, copy, modify, merge, publish,
38
+ distribute, sublicense, and/or sell copies of the Software, and to
39
+ permit persons to whom the Software is furnished to do so, subject to
40
+ the following conditions:
41
+
42
+ The above copyright notice and this permission notice shall be
43
+ included in all copies or substantial portions of the Software.
44
+
45
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
46
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
47
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
48
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
49
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
50
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
51
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,32 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+
6
+ Hoe.plugins.delete :rubyforge
7
+ Hoe.plugin :minitest
8
+ Hoe.plugin :gemspec # `gem install hoe-gemspec`
9
+ Hoe.plugin :git # `gem install hoe-git`
10
+
11
+ gem 'rake-compiler', '>= 0.4.1'
12
+ require "rake/extensiontask"
13
+
14
+ Hoe.spec 'syck' do
15
+ developer('Aaron Patterson', 'aaron@tenderlovemaking.com')
16
+ self.readme_file = 'README.rdoc'
17
+ self.history_file = 'CHANGELOG.rdoc'
18
+ self.extra_rdoc_files = FileList['*.rdoc']
19
+
20
+ extra_dev_deps << ['rake-compiler', '>= 0.4.1']
21
+
22
+ self.spec_extras = {
23
+ :extensions => ["ext/syck/extconf.rb"],
24
+ :required_ruby_version => '>= 2.0.0'
25
+ }
26
+
27
+ Rake::ExtensionTask.new "syck", spec do |ext|
28
+ ext.lib_dir = File.join(*['lib', ENV['FAT_DIR']].compact)
29
+ end
30
+ end
31
+
32
+ # vim: syntax=ruby
@@ -0,0 +1,1165 @@
1
+ /* Generated by re2c 0.9.10 on Mon Sep 19 23:21:26 2005 */
2
+ #line 1 "bytecode.re"
3
+ /*
4
+ * bytecode.re
5
+ *
6
+ * $Author$
7
+ *
8
+ * Copyright (C) 2003 why the lucky stiff
9
+ */
10
+ #include "ruby/ruby.h"
11
+ #include "syck.h"
12
+ #include "gram.h"
13
+
14
+ #define QUOTELEN 128
15
+
16
+ /*
17
+ * They do my bidding...
18
+ */
19
+ #define YYCTYPE char
20
+ #define YYCURSOR parser->cursor
21
+ #define YYMARKER parser->marker
22
+ #define YYLIMIT parser->limit
23
+ #define YYTOKEN parser->token
24
+ #define YYTOKTMP parser->toktmp
25
+ #define YYLINEPTR parser->lineptr
26
+ #define YYLINECTPTR parser->linectptr
27
+ #define YYLINE parser->linect
28
+ #define YYFILL(n) syck_parser_read(parser)
29
+
30
+ extern SyckParser *syck_parser_ptr;
31
+
32
+ char *get_inline( SyckParser *parser );
33
+
34
+ /*
35
+ * Repositions the cursor at `n' offset from the token start.
36
+ * Only works in `Header' and `Document' sections.
37
+ */
38
+ #define YYPOS(n) YYCURSOR = YYTOKEN + n
39
+
40
+ /*
41
+ * Track line numbers
42
+ */
43
+ #define CHK_NL(ptr) if ( *( ptr - 1 ) == '\n' && ptr > YYLINECTPTR ) { YYLINEPTR = ptr; YYLINE++; YYLINECTPTR = YYLINEPTR; }
44
+
45
+ /*
46
+ * I like seeing the level operations as macros...
47
+ */
48
+ #define ADD_LEVEL(len, status) syck_parser_add_level( parser, len, status )
49
+ #define POP_LEVEL() syck_parser_pop_level( parser )
50
+ #define CURRENT_LEVEL() syck_parser_current_level( parser )
51
+
52
+ /*
53
+ * Force a token next time around sycklex()
54
+ */
55
+ #define FORCE_NEXT_TOKEN(tok) parser->force_token = tok;
56
+
57
+ /*
58
+ * Adding levels in bytecode requires us to make sure
59
+ * we've got all our tokens worked out.
60
+ */
61
+ #define ADD_BYTE_LEVEL(lvl, len, s ) \
62
+ switch ( lvl->status ) \
63
+ { \
64
+ case syck_lvl_seq: \
65
+ lvl->ncount++; \
66
+ ADD_LEVEL(len, syck_lvl_open); \
67
+ YYPOS(0); \
68
+ return '-'; \
69
+ \
70
+ case syck_lvl_map: \
71
+ lvl->ncount++; \
72
+ ADD_LEVEL(len, s); \
73
+ break; \
74
+ \
75
+ case syck_lvl_open: \
76
+ lvl->status = s; \
77
+ break; \
78
+ \
79
+ default: \
80
+ ADD_LEVEL(len, s); \
81
+ break; \
82
+ }
83
+
84
+ /*
85
+ * Nice little macro to ensure we're YAML_IOPENed to the current level.
86
+ * * Only use this macro in the "Document" section *
87
+ */
88
+ #define ENSURE_YAML_IOPEN(last_lvl, lvl_type, to_len, reset) \
89
+ if ( last_lvl->spaces < to_len ) \
90
+ { \
91
+ if ( last_lvl->status == syck_lvl_iseq || last_lvl->status == syck_lvl_imap ) \
92
+ { \
93
+ goto Document; \
94
+ } \
95
+ else \
96
+ { \
97
+ ADD_LEVEL( to_len, lvl_type ); \
98
+ if ( reset == 1 ) YYPOS(0); \
99
+ return YAML_IOPEN; \
100
+ } \
101
+ }
102
+
103
+ /*
104
+ * Nice little macro to ensure closure of levels.
105
+ * * Only use this macro in the "Document" section *
106
+ */
107
+ #define ENSURE_YAML_IEND(last_lvl, to_len) \
108
+ if ( last_lvl->spaces > to_len ) \
109
+ { \
110
+ syck_parser_pop_level( parser ); \
111
+ YYPOS(0); \
112
+ return YAML_IEND; \
113
+ }
114
+
115
+ /*
116
+ * Concatenates string items and manages allocation
117
+ * to the string
118
+ */
119
+ #define CAT(s, c, i, l) \
120
+ { \
121
+ if ( i + 1 >= c ) \
122
+ { \
123
+ c += QUOTELEN; \
124
+ S_REALLOC_N( s, char, c ); \
125
+ } \
126
+ s[i++] = l; \
127
+ s[i] = '\0'; \
128
+ }
129
+
130
+ /*
131
+ * Parser for standard YAML Bytecode [UTF-8]
132
+ */
133
+ int
134
+ sycklex_bytecode_utf8( YYSTYPE *sycklval, SyckParser *parser )
135
+ {
136
+ SyckLevel *lvl;
137
+ syck_parser_ptr = parser;
138
+ if ( YYCURSOR == NULL )
139
+ {
140
+ syck_parser_read( parser );
141
+ }
142
+
143
+ if ( parser->force_token != 0 )
144
+ {
145
+ int t = parser->force_token;
146
+ parser->force_token = 0;
147
+ return t;
148
+ }
149
+
150
+ #line 172 "bytecode.re"
151
+
152
+
153
+ lvl = CURRENT_LEVEL();
154
+ if ( lvl->status == syck_lvl_doc )
155
+ {
156
+ goto Document;
157
+ }
158
+
159
+ /* Header: */
160
+
161
+ YYTOKEN = YYCURSOR;
162
+
163
+
164
+ #line 165 "<stdout>"
165
+ {
166
+ YYCTYPE yych;
167
+ unsigned int yyaccept = 0;
168
+ goto yy0;
169
+ ++YYCURSOR;
170
+ yy0:
171
+ if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
172
+ yych = *YYCURSOR;
173
+ switch(yych){
174
+ case 0x00: goto yy2;
175
+ case 'D': goto yy3;
176
+ default: goto yy5;
177
+ }
178
+ yy2: YYCURSOR = YYMARKER;
179
+ switch(yyaccept){
180
+ case 0: goto yy4;
181
+ }
182
+ yy3: yyaccept = 0;
183
+ yych = *(YYMARKER = ++YYCURSOR);
184
+ switch(yych){
185
+ case 0x0A: goto yy6;
186
+ case 0x0D: goto yy8;
187
+ default: goto yy4;
188
+ }
189
+ yy4:
190
+ #line 199 "bytecode.re"
191
+ { YYPOS(0);
192
+ goto Document;
193
+ }
194
+ #line 195 "<stdout>"
195
+ yy5: yych = *++YYCURSOR;
196
+ goto yy4;
197
+ yy6: ++YYCURSOR;
198
+ goto yy7;
199
+ yy7:
200
+ #line 186 "bytecode.re"
201
+ { if ( lvl->status == syck_lvl_header )
202
+ {
203
+ CHK_NL(YYCURSOR);
204
+ goto Directive;
205
+ }
206
+ else
207
+ {
208
+ ENSURE_YAML_IEND(lvl, -1);
209
+ YYPOS(0);
210
+ return 0;
211
+ }
212
+ }
213
+ #line 214 "<stdout>"
214
+ yy8: ++YYCURSOR;
215
+ switch((yych = *YYCURSOR)) {
216
+ case 0x0A: goto yy6;
217
+ default: goto yy2;
218
+ }
219
+ }
220
+ #line 203 "bytecode.re"
221
+
222
+
223
+ Document:
224
+ {
225
+ lvl = CURRENT_LEVEL();
226
+ if ( lvl->status == syck_lvl_header )
227
+ {
228
+ lvl->status = syck_lvl_doc;
229
+ }
230
+
231
+ YYTOKEN = YYCURSOR;
232
+
233
+
234
+ #line 235 "<stdout>"
235
+ {
236
+ YYCTYPE yych;
237
+ goto yy9;
238
+ ++YYCURSOR;
239
+ yy9:
240
+ if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
241
+ yych = *YYCURSOR;
242
+ switch(yych){
243
+ case 0x00: goto yy30;
244
+ case 0x0A: goto yy27;
245
+ case 0x0D: goto yy29;
246
+ case 'A': goto yy19;
247
+ case 'D': goto yy12;
248
+ case 'E': goto yy16;
249
+ case 'M': goto yy14;
250
+ case 'P': goto yy13;
251
+ case 'Q': goto yy15;
252
+ case 'R': goto yy21;
253
+ case 'S': goto yy17;
254
+ case 'T': goto yy23;
255
+ case 'c': goto yy25;
256
+ default: goto yy11;
257
+ }
258
+ yy11:yy12: yych = *++YYCURSOR;
259
+ switch(yych){
260
+ case 0x0A: goto yy41;
261
+ case 0x0D: goto yy44;
262
+ default: goto yy11;
263
+ }
264
+ yy13: yych = *++YYCURSOR;
265
+ switch(yych){
266
+ case 0x0A: goto yy41;
267
+ case 0x0D: goto yy43;
268
+ default: goto yy11;
269
+ }
270
+ yy14: yych = *++YYCURSOR;
271
+ switch(yych){
272
+ case 0x0A: goto yy38;
273
+ case 0x0D: goto yy40;
274
+ default: goto yy11;
275
+ }
276
+ yy15: yych = *++YYCURSOR;
277
+ switch(yych){
278
+ case 0x0A: goto yy35;
279
+ case 0x0D: goto yy37;
280
+ default: goto yy11;
281
+ }
282
+ yy16: yych = *++YYCURSOR;
283
+ switch(yych){
284
+ case 0x0A: goto yy32;
285
+ case 0x0D: goto yy34;
286
+ default: goto yy11;
287
+ }
288
+ yy17: ++YYCURSOR;
289
+ goto yy18;
290
+ yy18:
291
+ #line 288 "bytecode.re"
292
+ { ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_str);
293
+ goto Scalar;
294
+ }
295
+ #line 296 "<stdout>"
296
+ yy19: ++YYCURSOR;
297
+ goto yy20;
298
+ yy20:
299
+ #line 292 "bytecode.re"
300
+ { ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_open);
301
+ sycklval->name = get_inline( parser );
302
+ syck_hdlr_remove_anchor( parser, sycklval->name );
303
+ CHK_NL(YYCURSOR);
304
+ return YAML_ANCHOR;
305
+ }
306
+ #line 307 "<stdout>"
307
+ yy21: ++YYCURSOR;
308
+ goto yy22;
309
+ yy22:
310
+ #line 299 "bytecode.re"
311
+ { ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_str);
312
+ sycklval->name = get_inline( parser );
313
+ POP_LEVEL();
314
+ if ( *( YYCURSOR - 1 ) == '\n' ) YYCURSOR--;
315
+ return YAML_ALIAS;
316
+ }
317
+ #line 318 "<stdout>"
318
+ yy23: ++YYCURSOR;
319
+ goto yy24;
320
+ yy24:
321
+ #line 306 "bytecode.re"
322
+ { char *qstr;
323
+ ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_open);
324
+ qstr = get_inline( parser );
325
+ CHK_NL(YYCURSOR);
326
+ if ( qstr[0] == '!' )
327
+ {
328
+ size_t qidx = strlen( qstr );
329
+ if ( qstr[1] == '\0' )
330
+ {
331
+ free( qstr );
332
+ return YAML_ITRANSFER;
333
+ }
334
+
335
+ lvl = CURRENT_LEVEL();
336
+
337
+ /*
338
+ * URL Prefixing
339
+ */
340
+ if ( qstr[1] == '^' )
341
+ {
342
+ sycklval->name = S_ALLOC_N( char, qidx + strlen( lvl->domain ) );
343
+ sycklval->name[0] = '\0';
344
+ strcat( sycklval->name, lvl->domain );
345
+ strncat( sycklval->name, qstr + 2, qidx - 2 );
346
+ free( qstr );
347
+ }
348
+ else
349
+ {
350
+ char *carat = qstr + 1;
351
+ char *qend = qstr + qidx;
352
+ while ( (++carat) < qend )
353
+ {
354
+ if ( *carat == '^' )
355
+ break;
356
+ }
357
+
358
+ if ( carat < qend )
359
+ {
360
+ free( lvl->domain );
361
+ lvl->domain = syck_strndup( qstr + 1, carat - ( qstr + 1 ) );
362
+ sycklval->name = S_ALLOC_N( char, ( qend - carat ) + strlen( lvl->domain ) );
363
+ sycklval->name[0] = '\0';
364
+ strcat( sycklval->name, lvl->domain );
365
+ strncat( sycklval->name, carat + 1, ( qend - carat ) - 1 );
366
+ free( qstr );
367
+ }
368
+ else
369
+ {
370
+ sycklval->name = S_ALLOC_N( char, strlen( qstr ) );
371
+ sycklval->name[0] = '\0';
372
+ S_MEMCPY( sycklval->name, qstr + 1, char, strlen( qstr ) );
373
+ free( qstr );
374
+ }
375
+ }
376
+ return YAML_TRANSFER;
377
+ }
378
+ sycklval->name = qstr;
379
+ return YAML_TAGURI;
380
+ }
381
+ #line 382 "<stdout>"
382
+ yy25: ++YYCURSOR;
383
+ goto yy26;
384
+ yy26:
385
+ #line 366 "bytecode.re"
386
+ { goto Comment; }
387
+ #line 388 "<stdout>"
388
+ yy27: ++YYCURSOR;
389
+ goto yy28;
390
+ yy28:
391
+ #line 368 "bytecode.re"
392
+ { CHK_NL(YYCURSOR);
393
+ if ( lvl->status == syck_lvl_seq )
394
+ {
395
+ return YAML_INDENT;
396
+ }
397
+ else if ( lvl->status == syck_lvl_map )
398
+ {
399
+ if ( lvl->ncount % 2 == 1 ) return ':';
400
+ else return YAML_INDENT;
401
+ }
402
+ goto Document;
403
+ }
404
+ #line 405 "<stdout>"
405
+ yy29: yych = *++YYCURSOR;
406
+ switch(yych){
407
+ case 0x0A: goto yy27;
408
+ default: goto yy11;
409
+ }
410
+ yy30: ++YYCURSOR;
411
+ goto yy31;
412
+ yy31:
413
+ #line 381 "bytecode.re"
414
+ { ENSURE_YAML_IEND(lvl, -1);
415
+ YYPOS(0);
416
+ return 0;
417
+ }
418
+ #line 419 "<stdout>"
419
+ yy32: ++YYCURSOR;
420
+ goto yy33;
421
+ yy33:
422
+ #line 252 "bytecode.re"
423
+ { if ( lvl->status == syck_lvl_seq && lvl->ncount == 0 )
424
+ {
425
+ lvl->ncount++;
426
+ YYPOS(0);
427
+ FORCE_NEXT_TOKEN( ']' );
428
+ return '[';
429
+ }
430
+ else if ( lvl->status == syck_lvl_map && lvl->ncount == 0 )
431
+ {
432
+ lvl->ncount++;
433
+ YYPOS(0);
434
+ FORCE_NEXT_TOKEN( '}' );
435
+ return '{';
436
+ }
437
+
438
+ POP_LEVEL();
439
+ lvl = CURRENT_LEVEL();
440
+ if ( lvl->status == syck_lvl_seq )
441
+ {
442
+ FORCE_NEXT_TOKEN(YAML_INDENT);
443
+ }
444
+ else if ( lvl->status == syck_lvl_map )
445
+ {
446
+ if ( lvl->ncount % 2 == 1 )
447
+ {
448
+ FORCE_NEXT_TOKEN(':');
449
+ }
450
+ else
451
+ {
452
+ FORCE_NEXT_TOKEN(YAML_INDENT);
453
+ }
454
+ }
455
+ CHK_NL(YYCURSOR);
456
+ return YAML_IEND;
457
+ }
458
+ #line 459 "<stdout>"
459
+ yy34: yych = *++YYCURSOR;
460
+ switch(yych){
461
+ case 0x0A: goto yy32;
462
+ default: goto yy11;
463
+ }
464
+ yy35: ++YYCURSOR;
465
+ goto yy36;
466
+ yy36:
467
+ #line 237 "bytecode.re"
468
+ { int complex = 0;
469
+ if ( lvl->ncount % 2 == 0 && ( lvl->status == syck_lvl_map || lvl->status == syck_lvl_seq ) )
470
+ {
471
+ complex = 1;
472
+ }
473
+ ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_seq);
474
+ CHK_NL(YYCURSOR);
475
+ if ( complex )
476
+ {
477
+ FORCE_NEXT_TOKEN( YAML_IOPEN );
478
+ return '?';
479
+ }
480
+ return YAML_IOPEN;
481
+ }
482
+ #line 483 "<stdout>"
483
+ yy37: yych = *++YYCURSOR;
484
+ switch(yych){
485
+ case 0x0A: goto yy35;
486
+ default: goto yy11;
487
+ }
488
+ yy38: ++YYCURSOR;
489
+ goto yy39;
490
+ yy39:
491
+ #line 222 "bytecode.re"
492
+ { int complex = 0;
493
+ if ( lvl->ncount % 2 == 0 && ( lvl->status == syck_lvl_map || lvl->status == syck_lvl_seq ) )
494
+ {
495
+ complex = 1;
496
+ }
497
+ ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_map);
498
+ CHK_NL(YYCURSOR);
499
+ if ( complex )
500
+ {
501
+ FORCE_NEXT_TOKEN( YAML_IOPEN );
502
+ return '?';
503
+ }
504
+ return YAML_IOPEN;
505
+ }
506
+ #line 507 "<stdout>"
507
+ yy40: yych = *++YYCURSOR;
508
+ switch(yych){
509
+ case 0x0A: goto yy38;
510
+ default: goto yy11;
511
+ }
512
+ yy41: ++YYCURSOR;
513
+ goto yy42;
514
+ yy42:
515
+ #line 217 "bytecode.re"
516
+ { ENSURE_YAML_IEND(lvl, -1);
517
+ YYPOS(0);
518
+ return 0;
519
+ }
520
+ #line 521 "<stdout>"
521
+ yy43: yych = *++YYCURSOR;
522
+ switch(yych){
523
+ case 0x0A: goto yy41;
524
+ default: goto yy11;
525
+ }
526
+ yy44: ++YYCURSOR;
527
+ switch((yych = *YYCURSOR)) {
528
+ case 0x0A: goto yy41;
529
+ default: goto yy11;
530
+ }
531
+ }
532
+ #line 386 "bytecode.re"
533
+
534
+
535
+ }
536
+
537
+ Directive:
538
+ {
539
+ YYTOKEN = YYCURSOR;
540
+
541
+
542
+ #line 543 "<stdout>"
543
+ {
544
+ YYCTYPE yych;
545
+ unsigned int yyaccept = 0;
546
+ goto yy45;
547
+ ++YYCURSOR;
548
+ yy45:
549
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
550
+ yych = *YYCURSOR;
551
+ switch(yych){
552
+ case 0x00: goto yy47;
553
+ case 'V': goto yy48;
554
+ default: goto yy50;
555
+ }
556
+ yy47: YYCURSOR = YYMARKER;
557
+ switch(yyaccept){
558
+ case 0: goto yy49;
559
+ }
560
+ yy48: yyaccept = 0;
561
+ yych = *(YYMARKER = ++YYCURSOR);
562
+ switch(yych){
563
+ case '.':
564
+ case '/':
565
+ case '0':
566
+ case '1':
567
+ case '2':
568
+ case '3':
569
+ case '4':
570
+ case '5':
571
+ case '6':
572
+ case '7':
573
+ case '8':
574
+ case '9':
575
+ case ':':
576
+ case ';':
577
+ case '<':
578
+ case '=':
579
+ case '>':
580
+ case '?':
581
+ case '@':
582
+ case 'A':
583
+ case 'B':
584
+ case 'C':
585
+ case 'D':
586
+ case 'E':
587
+ case 'F':
588
+ case 'G':
589
+ case 'H':
590
+ case 'I':
591
+ case 'J':
592
+ case 'K':
593
+ case 'L':
594
+ case 'M':
595
+ case 'N':
596
+ case 'O':
597
+ case 'P':
598
+ case 'Q':
599
+ case 'R':
600
+ case 'S':
601
+ case 'T':
602
+ case 'U':
603
+ case 'V':
604
+ case 'W':
605
+ case 'X':
606
+ case 'Y':
607
+ case 'Z':
608
+ case '[':
609
+ case '\\':
610
+ case ']':
611
+ case '^':
612
+ case '_': case 'a':
613
+ case 'b':
614
+ case 'c':
615
+ case 'd':
616
+ case 'e':
617
+ case 'f':
618
+ case 'g':
619
+ case 'h':
620
+ case 'i':
621
+ case 'j':
622
+ case 'k':
623
+ case 'l':
624
+ case 'm':
625
+ case 'n':
626
+ case 'o':
627
+ case 'p':
628
+ case 'q':
629
+ case 'r':
630
+ case 's':
631
+ case 't':
632
+ case 'u':
633
+ case 'v':
634
+ case 'w':
635
+ case 'x':
636
+ case 'y':
637
+ case 'z': goto yy51;
638
+ default: goto yy49;
639
+ }
640
+ yy49:
641
+ #line 399 "bytecode.re"
642
+ { YYCURSOR = YYTOKEN;
643
+ return YAML_DOCSEP;
644
+ }
645
+ #line 646 "<stdout>"
646
+ yy50: yych = *++YYCURSOR;
647
+ goto yy49;
648
+ yy51: ++YYCURSOR;
649
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
650
+ yych = *YYCURSOR;
651
+ goto yy52;
652
+ yy52: switch(yych){
653
+ case '.':
654
+ case '/':
655
+ case '0':
656
+ case '1':
657
+ case '2':
658
+ case '3':
659
+ case '4':
660
+ case '5':
661
+ case '6':
662
+ case '7':
663
+ case '8':
664
+ case '9': case ';':
665
+ case '<':
666
+ case '=':
667
+ case '>':
668
+ case '?':
669
+ case '@':
670
+ case 'A':
671
+ case 'B':
672
+ case 'C':
673
+ case 'D':
674
+ case 'E':
675
+ case 'F':
676
+ case 'G':
677
+ case 'H':
678
+ case 'I':
679
+ case 'J':
680
+ case 'K':
681
+ case 'L':
682
+ case 'M':
683
+ case 'N':
684
+ case 'O':
685
+ case 'P':
686
+ case 'Q':
687
+ case 'R':
688
+ case 'S':
689
+ case 'T':
690
+ case 'U':
691
+ case 'V':
692
+ case 'W':
693
+ case 'X':
694
+ case 'Y':
695
+ case 'Z':
696
+ case '[':
697
+ case '\\':
698
+ case ']':
699
+ case '^':
700
+ case '_': case 'a':
701
+ case 'b':
702
+ case 'c':
703
+ case 'd':
704
+ case 'e':
705
+ case 'f':
706
+ case 'g':
707
+ case 'h':
708
+ case 'i':
709
+ case 'j':
710
+ case 'k':
711
+ case 'l':
712
+ case 'm':
713
+ case 'n':
714
+ case 'o':
715
+ case 'p':
716
+ case 'q':
717
+ case 'r':
718
+ case 's':
719
+ case 't':
720
+ case 'u':
721
+ case 'v':
722
+ case 'w':
723
+ case 'x':
724
+ case 'y':
725
+ case 'z': goto yy51;
726
+ case ':': goto yy53;
727
+ default: goto yy47;
728
+ }
729
+ yy53: yych = *++YYCURSOR;
730
+ switch(yych){
731
+ case '.':
732
+ case '/':
733
+ case '0':
734
+ case '1':
735
+ case '2':
736
+ case '3':
737
+ case '4':
738
+ case '5':
739
+ case '6':
740
+ case '7':
741
+ case '8':
742
+ case '9':
743
+ case ':':
744
+ case ';':
745
+ case '<':
746
+ case '=':
747
+ case '>':
748
+ case '?':
749
+ case '@':
750
+ case 'A':
751
+ case 'B':
752
+ case 'C':
753
+ case 'D':
754
+ case 'E':
755
+ case 'F':
756
+ case 'G':
757
+ case 'H':
758
+ case 'I':
759
+ case 'J':
760
+ case 'K':
761
+ case 'L':
762
+ case 'M':
763
+ case 'N':
764
+ case 'O':
765
+ case 'P':
766
+ case 'Q':
767
+ case 'R':
768
+ case 'S':
769
+ case 'T':
770
+ case 'U':
771
+ case 'V':
772
+ case 'W':
773
+ case 'X':
774
+ case 'Y':
775
+ case 'Z':
776
+ case '[':
777
+ case '\\':
778
+ case ']':
779
+ case '^':
780
+ case '_': case 'a':
781
+ case 'b':
782
+ case 'c':
783
+ case 'd':
784
+ case 'e':
785
+ case 'f':
786
+ case 'g':
787
+ case 'h':
788
+ case 'i':
789
+ case 'j':
790
+ case 'k':
791
+ case 'l':
792
+ case 'm':
793
+ case 'n':
794
+ case 'o':
795
+ case 'p':
796
+ case 'q':
797
+ case 'r':
798
+ case 's':
799
+ case 't':
800
+ case 'u':
801
+ case 'v':
802
+ case 'w':
803
+ case 'x':
804
+ case 'y':
805
+ case 'z': goto yy54;
806
+ default: goto yy47;
807
+ }
808
+ yy54: ++YYCURSOR;
809
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
810
+ yych = *YYCURSOR;
811
+ goto yy55;
812
+ yy55: switch(yych){
813
+ case 0x0A: goto yy56;
814
+ case 0x0D: goto yy58;
815
+ case '.':
816
+ case '/':
817
+ case '0':
818
+ case '1':
819
+ case '2':
820
+ case '3':
821
+ case '4':
822
+ case '5':
823
+ case '6':
824
+ case '7':
825
+ case '8':
826
+ case '9':
827
+ case ':':
828
+ case ';':
829
+ case '<':
830
+ case '=':
831
+ case '>':
832
+ case '?':
833
+ case '@':
834
+ case 'A':
835
+ case 'B':
836
+ case 'C':
837
+ case 'D':
838
+ case 'E':
839
+ case 'F':
840
+ case 'G':
841
+ case 'H':
842
+ case 'I':
843
+ case 'J':
844
+ case 'K':
845
+ case 'L':
846
+ case 'M':
847
+ case 'N':
848
+ case 'O':
849
+ case 'P':
850
+ case 'Q':
851
+ case 'R':
852
+ case 'S':
853
+ case 'T':
854
+ case 'U':
855
+ case 'V':
856
+ case 'W':
857
+ case 'X':
858
+ case 'Y':
859
+ case 'Z':
860
+ case '[':
861
+ case '\\':
862
+ case ']':
863
+ case '^':
864
+ case '_': case 'a':
865
+ case 'b':
866
+ case 'c':
867
+ case 'd':
868
+ case 'e':
869
+ case 'f':
870
+ case 'g':
871
+ case 'h':
872
+ case 'i':
873
+ case 'j':
874
+ case 'k':
875
+ case 'l':
876
+ case 'm':
877
+ case 'n':
878
+ case 'o':
879
+ case 'p':
880
+ case 'q':
881
+ case 'r':
882
+ case 's':
883
+ case 't':
884
+ case 'u':
885
+ case 'v':
886
+ case 'w':
887
+ case 'x':
888
+ case 'y':
889
+ case 'z': goto yy54;
890
+ default: goto yy47;
891
+ }
892
+ yy56: ++YYCURSOR;
893
+ goto yy57;
894
+ yy57:
895
+ #line 396 "bytecode.re"
896
+ { CHK_NL(YYCURSOR);
897
+ goto Directive; }
898
+ #line 899 "<stdout>"
899
+ yy58: ++YYCURSOR;
900
+ switch((yych = *YYCURSOR)) {
901
+ case 0x0A: goto yy56;
902
+ default: goto yy47;
903
+ }
904
+ }
905
+ #line 402 "bytecode.re"
906
+
907
+
908
+ }
909
+
910
+ Comment:
911
+ {
912
+ YYTOKEN = YYCURSOR;
913
+
914
+
915
+ #line 916 "<stdout>"
916
+ {
917
+ YYCTYPE yych;
918
+ goto yy59;
919
+ ++YYCURSOR;
920
+ yy59:
921
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
922
+ yych = *YYCURSOR;
923
+ switch(yych){
924
+ case 0x00: goto yy61;
925
+ case 0x0A: goto yy62;
926
+ case 0x0D: goto yy64;
927
+ default: goto yy66;
928
+ }
929
+ yy61:yy62: ++YYCURSOR;
930
+ goto yy63;
931
+ yy63:
932
+ #line 412 "bytecode.re"
933
+ { CHK_NL(YYCURSOR);
934
+ goto Document; }
935
+ #line 936 "<stdout>"
936
+ yy64: ++YYCURSOR;
937
+ switch((yych = *YYCURSOR)) {
938
+ case 0x0A: goto yy67;
939
+ default: goto yy65;
940
+ }
941
+ yy65:
942
+ #line 415 "bytecode.re"
943
+ { goto Comment; }
944
+ #line 945 "<stdout>"
945
+ yy66: yych = *++YYCURSOR;
946
+ goto yy65;
947
+ yy67: ++YYCURSOR;
948
+ yych = *YYCURSOR;
949
+ goto yy63;
950
+ }
951
+ #line 417 "bytecode.re"
952
+
953
+
954
+ }
955
+
956
+ Scalar:
957
+ {
958
+ int idx = 0;
959
+ int cap = 100;
960
+ char *str = S_ALLOC_N( char, cap );
961
+ char *tok;
962
+
963
+ str[0] = '\0';
964
+
965
+ Scalar2:
966
+ tok = YYCURSOR;
967
+
968
+
969
+ #line 970 "<stdout>"
970
+ {
971
+ YYCTYPE yych;
972
+ goto yy68;
973
+ ++YYCURSOR;
974
+ yy68:
975
+ if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
976
+ yych = *YYCURSOR;
977
+ switch(yych){
978
+ case 0x00: goto yy74;
979
+ case 0x0A: goto yy70;
980
+ case 0x0D: goto yy72;
981
+ default: goto yy76;
982
+ }
983
+ yy70: ++YYCURSOR;
984
+ switch((yych = *YYCURSOR)) {
985
+ case 'C': goto yy78;
986
+ case 'N': goto yy80;
987
+ case 'Z': goto yy83;
988
+ default: goto yy71;
989
+ }
990
+ yy71:
991
+ #line 461 "bytecode.re"
992
+ { YYCURSOR = tok;
993
+ goto ScalarEnd;
994
+ }
995
+ #line 996 "<stdout>"
996
+ yy72: ++YYCURSOR;
997
+ switch((yych = *YYCURSOR)) {
998
+ case 0x0A: goto yy77;
999
+ default: goto yy73;
1000
+ }
1001
+ yy73:
1002
+ #line 469 "bytecode.re"
1003
+ { CAT(str, cap, idx, tok[0]);
1004
+ goto Scalar2;
1005
+ }
1006
+ #line 1007 "<stdout>"
1007
+ yy74: ++YYCURSOR;
1008
+ goto yy75;
1009
+ yy75:
1010
+ #line 465 "bytecode.re"
1011
+ { YYCURSOR = tok;
1012
+ goto ScalarEnd;
1013
+ }
1014
+ #line 1015 "<stdout>"
1015
+ yy76: yych = *++YYCURSOR;
1016
+ goto yy73;
1017
+ yy77: yych = *++YYCURSOR;
1018
+ switch(yych){
1019
+ case 'C': goto yy78;
1020
+ case 'N': goto yy80;
1021
+ case 'Z': goto yy83;
1022
+ default: goto yy71;
1023
+ }
1024
+ yy78: ++YYCURSOR;
1025
+ goto yy79;
1026
+ yy79:
1027
+ #line 435 "bytecode.re"
1028
+ { CHK_NL(tok+1);
1029
+ goto Scalar2; }
1030
+ #line 1031 "<stdout>"
1031
+ yy80: ++YYCURSOR;
1032
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
1033
+ yych = *YYCURSOR;
1034
+ goto yy81;
1035
+ yy81: switch(yych){
1036
+ case '0':
1037
+ case '1':
1038
+ case '2':
1039
+ case '3':
1040
+ case '4':
1041
+ case '5':
1042
+ case '6':
1043
+ case '7':
1044
+ case '8':
1045
+ case '9': goto yy80;
1046
+ default: goto yy82;
1047
+ }
1048
+ yy82:
1049
+ #line 438 "bytecode.re"
1050
+ { CHK_NL(tok+1);
1051
+ if ( tok + 2 < YYCURSOR )
1052
+ {
1053
+ char *count = tok + 2;
1054
+ int total = strtod( count, NULL );
1055
+ int i;
1056
+ for ( i = 0; i < total; i++ )
1057
+ {
1058
+ CAT(str, cap, idx, '\n');
1059
+ }
1060
+ }
1061
+ else
1062
+ {
1063
+ CAT(str, cap, idx, '\n');
1064
+ }
1065
+ goto Scalar2;
1066
+ }
1067
+ #line 1068 "<stdout>"
1068
+ yy83: ++YYCURSOR;
1069
+ goto yy84;
1070
+ yy84:
1071
+ #line 456 "bytecode.re"
1072
+ { CHK_NL(tok+1);
1073
+ CAT(str, cap, idx, '\0');
1074
+ goto Scalar2;
1075
+ }
1076
+ #line 1077 "<stdout>"
1077
+ }
1078
+ #line 473 "bytecode.re"
1079
+
1080
+
1081
+ ScalarEnd:
1082
+ {
1083
+ SyckNode *n = syck_alloc_str();
1084
+ n->data.str->ptr = str;
1085
+ n->data.str->len = idx;
1086
+ sycklval->nodeData = n;
1087
+ POP_LEVEL();
1088
+ if ( parser->implicit_typing == 1 )
1089
+ {
1090
+ try_tag_implicit( sycklval->nodeData, parser->taguri_expansion );
1091
+ }
1092
+ return YAML_PLAIN;
1093
+ }
1094
+ }
1095
+
1096
+ }
1097
+
1098
+ char *
1099
+ get_inline( SyckParser *parser )
1100
+ {
1101
+ int idx = 0;
1102
+ int cap = 100;
1103
+ char *str = S_ALLOC_N( char, cap );
1104
+ char *tok;
1105
+
1106
+ str[0] = '\0';
1107
+
1108
+ Inline:
1109
+ {
1110
+ tok = YYCURSOR;
1111
+
1112
+
1113
+ #line 1114 "<stdout>"
1114
+ {
1115
+ YYCTYPE yych;
1116
+ goto yy85;
1117
+ ++YYCURSOR;
1118
+ yy85:
1119
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
1120
+ yych = *YYCURSOR;
1121
+ switch(yych){
1122
+ case 0x00: goto yy91;
1123
+ case 0x0A: goto yy87;
1124
+ case 0x0D: goto yy89;
1125
+ default: goto yy93;
1126
+ }
1127
+ yy87: ++YYCURSOR;
1128
+ goto yy88;
1129
+ yy88:
1130
+ #line 508 "bytecode.re"
1131
+ { CHK_NL(YYCURSOR);
1132
+ return str; }
1133
+ #line 1134 "<stdout>"
1134
+ yy89: ++YYCURSOR;
1135
+ switch((yych = *YYCURSOR)) {
1136
+ case 0x0A: goto yy94;
1137
+ default: goto yy90;
1138
+ }
1139
+ yy90:
1140
+ #line 515 "bytecode.re"
1141
+ { CAT(str, cap, idx, tok[0]);
1142
+ goto Inline;
1143
+ }
1144
+ #line 1145 "<stdout>"
1145
+ yy91: ++YYCURSOR;
1146
+ goto yy92;
1147
+ yy92:
1148
+ #line 511 "bytecode.re"
1149
+ { YYCURSOR = tok;
1150
+ return str;
1151
+ }
1152
+ #line 1153 "<stdout>"
1153
+ yy93: yych = *++YYCURSOR;
1154
+ goto yy90;
1155
+ yy94: ++YYCURSOR;
1156
+ yych = *YYCURSOR;
1157
+ goto yy88;
1158
+ }
1159
+ #line 519 "bytecode.re"
1160
+
1161
+
1162
+ }
1163
+
1164
+ }
1165
+