syck 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
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,2724 @@
1
+ /* Generated by re2c 0.9.10 on Tue Sep 20 17:46:17 2005 */
2
+ #line 1 "token.re"
3
+ /*
4
+ * token.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
+ /*
15
+ * Allocate quoted strings in chunks
16
+ */
17
+ #define QUOTELEN 1024
18
+
19
+ /*
20
+ * They do my bidding...
21
+ */
22
+ #define YYCTYPE char
23
+ #define YYCURSOR parser->cursor
24
+ #define YYMARKER parser->marker
25
+ #define YYLIMIT parser->limit
26
+ #define YYTOKEN parser->token
27
+ #define YYTOKTMP parser->toktmp
28
+ #define YYLINEPTR parser->lineptr
29
+ #define YYLINECTPTR parser->linectptr
30
+ #define YYLINE parser->linect
31
+ #define YYFILL(n) syck_parser_read(parser)
32
+
33
+ /*
34
+ * Repositions the cursor at `n' offset from the token start.
35
+ * Only works in `Header' and `Document' sections.
36
+ */
37
+ #define YYPOS(n) YYCURSOR = YYTOKEN + n
38
+
39
+ /*
40
+ * Track line numbers
41
+ */
42
+ #define NEWLINE(ptr) YYLINEPTR = ptr + newline_len(ptr); if ( YYLINEPTR > YYLINECTPTR ) { YYLINE++; YYLINECTPTR = YYLINEPTR; }
43
+
44
+ /*
45
+ * I like seeing the level operations as macros...
46
+ */
47
+ #define ADD_LEVEL(len, status) syck_parser_add_level( parser, len, status )
48
+ #define POP_LEVEL() syck_parser_pop_level( parser )
49
+ #define CURRENT_LEVEL() syck_parser_current_level( parser )
50
+
51
+ /*
52
+ * Force a token next time around sycklex()
53
+ */
54
+ #define FORCE_NEXT_TOKEN(tok) parser->force_token = tok;
55
+
56
+ /*
57
+ * Nice little macro to ensure we're YAML_IOPENed to the current level.
58
+ * * Only use this macro in the "Document" section *
59
+ */
60
+ #define ENSURE_YAML_IOPEN(last_lvl, to_len, reset) \
61
+ if ( last_lvl->spaces < to_len ) \
62
+ { \
63
+ if ( last_lvl->status == syck_lvl_iseq || last_lvl->status == syck_lvl_imap ) \
64
+ { \
65
+ goto Document; \
66
+ } \
67
+ else \
68
+ { \
69
+ ADD_LEVEL( to_len, syck_lvl_doc ); \
70
+ if ( reset == 1 ) YYPOS(0); \
71
+ return YAML_IOPEN; \
72
+ } \
73
+ }
74
+
75
+ /*
76
+ * Nice little macro to ensure closure of levels.
77
+ * * Only use this macro in the "Document" section *
78
+ */
79
+ #define ENSURE_YAML_IEND(last_lvl, to_len) \
80
+ if ( last_lvl->spaces > to_len ) \
81
+ { \
82
+ syck_parser_pop_level( parser ); \
83
+ YYPOS(0); \
84
+ return YAML_IEND; \
85
+ }
86
+
87
+ /*
88
+ * Concatenates quoted string items and manages allocation
89
+ * to the quoted string
90
+ */
91
+ #define QUOTECAT(s, c, i, l) \
92
+ { \
93
+ if ( i + 1 >= c ) \
94
+ { \
95
+ c += QUOTELEN; \
96
+ S_REALLOC_N( s, char, c ); \
97
+ } \
98
+ s[i++] = l; \
99
+ s[i] = '\0'; \
100
+ }
101
+
102
+ #define QUOTECATS(s, c, i, cs, cl) \
103
+ { \
104
+ while ( i + cl >= c ) \
105
+ { \
106
+ c += QUOTELEN; \
107
+ S_REALLOC_N( s, char, c ); \
108
+ } \
109
+ S_MEMCPY( s + i, cs, char, cl ); \
110
+ i += cl; \
111
+ s[i] = '\0'; \
112
+ }
113
+
114
+ /*
115
+ * Tags a plain scalar with a transfer method
116
+ * * Use only in "Plain" section *
117
+ */
118
+ #define RETURN_IMPLICIT() \
119
+ { \
120
+ SyckNode *n = syck_alloc_str(); \
121
+ YYCURSOR = YYTOKEN; \
122
+ n->data.str->ptr = qstr; \
123
+ n->data.str->len = qidx; \
124
+ n->data.str->style = scalar_plain; \
125
+ sycklval->nodeData = n; \
126
+ if ( parser->implicit_typing == 1 ) \
127
+ { \
128
+ try_tag_implicit( sycklval->nodeData, parser->taguri_expansion ); \
129
+ } \
130
+ return YAML_PLAIN; \
131
+ }
132
+
133
+ /* concat the inline characters to the plain scalar */
134
+ #define PLAIN_NOT_INL() \
135
+ if ( *(YYCURSOR - 1) == ' ' || is_newline( YYCURSOR - 1 ) ) \
136
+ { \
137
+ YYCURSOR--; \
138
+ } \
139
+ QUOTECATS(qstr, qcapa, qidx, YYTOKEN, YYCURSOR - YYTOKEN); \
140
+ goto Plain2;
141
+
142
+ /* trim spaces off the end in case of indent */
143
+ #define PLAIN_IS_INL() \
144
+ char *walker = qstr + qidx - 1; \
145
+ while ( walker > qstr && ( *walker == '\n' || *walker == ' ' || *walker == '\t' ) ) \
146
+ { \
147
+ qidx--; \
148
+ walker[0] = '\0'; \
149
+ walker--; \
150
+ }
151
+
152
+ /*
153
+ * Keep or chomp block?
154
+ * * Use only in "ScalarBlock" section *
155
+ */
156
+ #define RETURN_YAML_BLOCK() \
157
+ { \
158
+ SyckNode *n = syck_alloc_str(); \
159
+ if ( ((SyckParser *)parser)->taguri_expansion == 1 ) \
160
+ { \
161
+ n->type_id = syck_taguri( YAML_DOMAIN, "str", 3 ); \
162
+ } \
163
+ else \
164
+ { \
165
+ n->type_id = syck_strndup( "str", 3 ); \
166
+ } \
167
+ n->data.str->ptr = qstr; \
168
+ n->data.str->len = qidx; \
169
+ if ( blockType == BLOCK_LIT ) { \
170
+ n->data.str->style = scalar_literal; \
171
+ } else { \
172
+ n->data.str->style = scalar_fold; \
173
+ } \
174
+ if ( qidx > 0 ) \
175
+ { \
176
+ if ( nlDoWhat != NL_KEEP ) \
177
+ { \
178
+ char *fc = n->data.str->ptr + n->data.str->len - 1; \
179
+ while ( is_newline( fc ) ) fc--; \
180
+ if ( nlDoWhat != NL_CHOMP && fc < n->data.str->ptr + n->data.str->len - 1 ) \
181
+ fc += 1; \
182
+ n->data.str->len = fc - n->data.str->ptr + 1; \
183
+ } \
184
+ } \
185
+ sycklval->nodeData = n; \
186
+ return YAML_BLOCK; \
187
+ }
188
+
189
+ /*
190
+ * Handles newlines, calculates indent
191
+ */
192
+ #define GOBBLE_UP_YAML_INDENT( ict, start ) \
193
+ char *indent = start; \
194
+ NEWLINE(indent); \
195
+ while ( indent < YYCURSOR ) \
196
+ { \
197
+ if ( is_newline( ++indent ) ) \
198
+ { \
199
+ NEWLINE(indent); \
200
+ } \
201
+ } \
202
+ ict = 0; \
203
+ if ( *YYCURSOR == '\0' ) \
204
+ { \
205
+ ict = -1; \
206
+ start = YYCURSOR - 1; \
207
+ } \
208
+ else if ( *YYLINEPTR == ' ' ) \
209
+ { \
210
+ ict = (int)(YYCURSOR - YYLINEPTR); \
211
+ }
212
+
213
+ /*
214
+ * If an indent exists at the current level, back up.
215
+ */
216
+ #define GET_TRUE_YAML_INDENT(indt_len) \
217
+ { \
218
+ SyckLevel *lvl_deep = CURRENT_LEVEL(); \
219
+ indt_len = lvl_deep->spaces; \
220
+ if ( lvl_deep->status == syck_lvl_seq || ( indt_len == YYCURSOR - YYLINEPTR && lvl_deep->status != syck_lvl_map ) ) \
221
+ { \
222
+ SyckLevel *lvl_over; \
223
+ parser->lvl_idx--; \
224
+ lvl_over = CURRENT_LEVEL(); \
225
+ indt_len = lvl_over->spaces; \
226
+ parser->lvl_idx++; \
227
+ } \
228
+ }
229
+
230
+ /*
231
+ * Argjh! I hate globals! Here for syckerror() only!
232
+ */
233
+ SyckParser *syck_parser_ptr = NULL;
234
+
235
+ /*
236
+ * Accessory funcs later in this file.
237
+ */
238
+ void eat_comments( SyckParser * );
239
+ char escape_seq( char );
240
+ int is_newline( char *ptr );
241
+ int newline_len( char *ptr );
242
+ int sycklex_yaml_utf8( YYSTYPE *, SyckParser * );
243
+ int sycklex_bytecode_utf8( YYSTYPE *, SyckParser * );
244
+ int syckwrap();
245
+
246
+ /*
247
+ * My own re-entrant sycklex() using re2c.
248
+ * You really get used to the limited regexp.
249
+ * It's really nice to not rely on backtracking and such.
250
+ */
251
+ int
252
+ sycklex( YYSTYPE *sycklval, SyckParser *parser )
253
+ {
254
+ switch ( parser->input_type )
255
+ {
256
+ case syck_yaml_utf8:
257
+ return sycklex_yaml_utf8( sycklval, parser );
258
+
259
+ case syck_yaml_utf16:
260
+ syckerror( "UTF-16 is not currently supported in Syck.\nPlease contribute code to help this happen!" );
261
+ break;
262
+
263
+ case syck_yaml_utf32:
264
+ syckerror( "UTF-32 is not currently supported in Syck.\nPlease contribute code to help this happen!" );
265
+ break;
266
+
267
+ case syck_bytecode_utf8:
268
+ return sycklex_bytecode_utf8( sycklval, parser );
269
+ }
270
+ return YAML_DOCSEP;
271
+ }
272
+
273
+ /*
274
+ * Parser for standard YAML [UTF-8]
275
+ */
276
+ int
277
+ sycklex_yaml_utf8( YYSTYPE *sycklval, SyckParser *parser )
278
+ {
279
+ int doc_level = 0;
280
+ syck_parser_ptr = parser;
281
+ if ( YYCURSOR == NULL )
282
+ {
283
+ syck_parser_read( parser );
284
+ }
285
+
286
+ if ( parser->force_token != 0 )
287
+ {
288
+ int t = parser->force_token;
289
+ parser->force_token = 0;
290
+ return t;
291
+ }
292
+
293
+ #line 315 "token.re"
294
+
295
+
296
+ if ( YYLINEPTR != YYCURSOR )
297
+ {
298
+ goto Document;
299
+ }
300
+
301
+ Header:
302
+
303
+ YYTOKEN = YYCURSOR;
304
+
305
+
306
+ #line 307 "<stdout>"
307
+ {
308
+ YYCTYPE yych;
309
+ unsigned int yyaccept;
310
+ goto yy0;
311
+ ++YYCURSOR;
312
+ yy0:
313
+ if((YYLIMIT - YYCURSOR) < 5) YYFILL(5);
314
+ yych = *YYCURSOR;
315
+ switch(yych){
316
+ case 0x00: goto yy7;
317
+ case 0x09: case ' ': goto yy12;
318
+ case 0x0A: goto yy9;
319
+ case 0x0D: goto yy11;
320
+ case '#': goto yy5;
321
+ case '-': goto yy2;
322
+ case '.': goto yy4;
323
+ default: goto yy14;
324
+ }
325
+ yy2: yyaccept = 0;
326
+ yych = *(YYMARKER = ++YYCURSOR);
327
+ switch(yych){
328
+ case '-': goto yy28;
329
+ default: goto yy3;
330
+ }
331
+ yy3:
332
+ #line 374 "token.re"
333
+ { YYPOS(0);
334
+ goto Document;
335
+ }
336
+ #line 337 "<stdout>"
337
+ yy4: yyaccept = 0;
338
+ yych = *(YYMARKER = ++YYCURSOR);
339
+ switch(yych){
340
+ case '.': goto yy21;
341
+ default: goto yy3;
342
+ }
343
+ yy5: ++YYCURSOR;
344
+ goto yy6;
345
+ yy6:
346
+ #line 356 "token.re"
347
+ { eat_comments( parser );
348
+ goto Header;
349
+ }
350
+ #line 351 "<stdout>"
351
+ yy7: ++YYCURSOR;
352
+ goto yy8;
353
+ yy8:
354
+ #line 360 "token.re"
355
+ { SyckLevel *lvl = CURRENT_LEVEL();
356
+ ENSURE_YAML_IEND(lvl, -1);
357
+ YYPOS(0);
358
+ return 0;
359
+ }
360
+ #line 361 "<stdout>"
361
+ yy9: yyaccept = 1;
362
+ yych = *(YYMARKER = ++YYCURSOR);
363
+ goto yy18;
364
+ yy10:
365
+ #line 366 "token.re"
366
+ { GOBBLE_UP_YAML_INDENT( doc_level, YYTOKEN );
367
+ goto Header;
368
+ }
369
+ #line 370 "<stdout>"
370
+ yy11: yych = *++YYCURSOR;
371
+ switch(yych){
372
+ case 0x0A: goto yy17;
373
+ default: goto yy3;
374
+ }
375
+ yy12: ++YYCURSOR;
376
+ yych = *YYCURSOR;
377
+ goto yy16;
378
+ yy13:
379
+ #line 370 "token.re"
380
+ { doc_level = (int)(YYCURSOR - YYLINEPTR);
381
+ goto Header;
382
+ }
383
+ #line 384 "<stdout>"
384
+ yy14: yych = *++YYCURSOR;
385
+ goto yy3;
386
+ yy15: ++YYCURSOR;
387
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
388
+ yych = *YYCURSOR;
389
+ goto yy16;
390
+ yy16: switch(yych){
391
+ case 0x09: case ' ': goto yy15;
392
+ default: goto yy13;
393
+ }
394
+ yy17: yyaccept = 1;
395
+ YYMARKER = ++YYCURSOR;
396
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
397
+ yych = *YYCURSOR;
398
+ goto yy18;
399
+ yy18: switch(yych){
400
+ case 0x0A: case ' ': goto yy17;
401
+ case 0x0D: goto yy19;
402
+ default: goto yy10;
403
+ }
404
+ yy19: ++YYCURSOR;
405
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
406
+ yych = *YYCURSOR;
407
+ switch(yych){
408
+ case 0x0A: goto yy17;
409
+ default: goto yy20;
410
+ }
411
+ yy20: YYCURSOR = YYMARKER;
412
+ switch(yyaccept){
413
+ case 1: goto yy10;
414
+ case 0: goto yy3;
415
+ }
416
+ yy21: yych = *++YYCURSOR;
417
+ switch(yych){
418
+ case '.': goto yy22;
419
+ default: goto yy20;
420
+ }
421
+ yy22: yych = *++YYCURSOR;
422
+ switch(yych){
423
+ case 0x0A: goto yy23;
424
+ case 0x0D: goto yy27;
425
+ case ' ': goto yy25;
426
+ default: goto yy20;
427
+ }
428
+ yy23: ++YYCURSOR;
429
+ goto yy24;
430
+ yy24:
431
+ #line 342 "token.re"
432
+ { SyckLevel *lvl = CURRENT_LEVEL();
433
+ if ( lvl->status == syck_lvl_header )
434
+ {
435
+ goto Header;
436
+ }
437
+ else
438
+ {
439
+ ENSURE_YAML_IEND(lvl, -1);
440
+ YYPOS(0);
441
+ return 0;
442
+ }
443
+ return 0;
444
+ }
445
+ #line 446 "<stdout>"
446
+ yy25: ++YYCURSOR;
447
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
448
+ yych = *YYCURSOR;
449
+ goto yy26;
450
+ yy26: switch(yych){
451
+ case ' ': goto yy25;
452
+ default: goto yy24;
453
+ }
454
+ yy27: yych = *++YYCURSOR;
455
+ switch(yych){
456
+ case 0x0A: goto yy23;
457
+ default: goto yy20;
458
+ }
459
+ yy28: yych = *++YYCURSOR;
460
+ switch(yych){
461
+ case '-': goto yy29;
462
+ default: goto yy20;
463
+ }
464
+ yy29: yych = *++YYCURSOR;
465
+ switch(yych){
466
+ case 0x0A: goto yy30;
467
+ case 0x0D: goto yy34;
468
+ case ' ': goto yy32;
469
+ default: goto yy20;
470
+ }
471
+ yy30: ++YYCURSOR;
472
+ goto yy31;
473
+ yy31:
474
+ #line 328 "token.re"
475
+ { SyckLevel *lvl = CURRENT_LEVEL();
476
+ if ( lvl->status == syck_lvl_header )
477
+ {
478
+ YYPOS(3);
479
+ goto Directive;
480
+ }
481
+ else
482
+ {
483
+ ENSURE_YAML_IEND(lvl, -1);
484
+ YYPOS(0);
485
+ return 0;
486
+ }
487
+ }
488
+ #line 489 "<stdout>"
489
+ yy32: ++YYCURSOR;
490
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
491
+ yych = *YYCURSOR;
492
+ goto yy33;
493
+ yy33: switch(yych){
494
+ case ' ': goto yy32;
495
+ default: goto yy31;
496
+ }
497
+ yy34: ++YYCURSOR;
498
+ switch((yych = *YYCURSOR)) {
499
+ case 0x0A: goto yy30;
500
+ default: goto yy20;
501
+ }
502
+ }
503
+ #line 378 "token.re"
504
+
505
+
506
+ Document:
507
+ {
508
+ SyckLevel *lvl = CURRENT_LEVEL();
509
+ if ( lvl->status == syck_lvl_header )
510
+ {
511
+ lvl->status = syck_lvl_doc;
512
+ }
513
+
514
+ YYTOKEN = YYCURSOR;
515
+
516
+
517
+ #line 518 "<stdout>"
518
+ {
519
+ YYCTYPE yych;
520
+ unsigned int yyaccept;
521
+ goto yy35;
522
+ ++YYCURSOR;
523
+ yy35:
524
+ if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
525
+ yych = *YYCURSOR;
526
+ switch(yych){
527
+ case 0x00: goto yy62;
528
+ case 0x09: case ' ': goto yy60;
529
+ case 0x0A: goto yy37;
530
+ case 0x0D: goto yy39;
531
+ case '!': goto yy51;
532
+ case '"': goto yy55;
533
+ case '#': goto yy58;
534
+ case '&': goto yy49;
535
+ case '\'': goto yy53;
536
+ case '*': goto yy50;
537
+ case ',': case ':': goto yy47;
538
+ case '-': case '?': goto yy48;
539
+ case '>': case '|': goto yy57;
540
+ case '[': goto yy41;
541
+ case ']': case '}': goto yy45;
542
+ case '{': goto yy43;
543
+ default: goto yy64;
544
+ }
545
+ yy37: yyaccept = 0;
546
+ yych = *(YYMARKER = ++YYCURSOR);
547
+ goto yy92;
548
+ yy38:
549
+ #line 392 "token.re"
550
+ { /* Isolate spaces */
551
+ int indt_len;
552
+ GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN );
553
+ lvl = CURRENT_LEVEL();
554
+ doc_level = 0;
555
+
556
+ /* XXX: Comment lookahead */
557
+ if ( *YYCURSOR == '#' )
558
+ {
559
+ goto Document;
560
+ }
561
+
562
+ /* Ignore indentation inside inlines */
563
+ if ( lvl->status == syck_lvl_iseq || lvl->status == syck_lvl_imap )
564
+ {
565
+ goto Document;
566
+ }
567
+
568
+ /* Check for open indent */
569
+ ENSURE_YAML_IEND(lvl, indt_len);
570
+ ENSURE_YAML_IOPEN(lvl, indt_len, 0);
571
+ if ( indt_len == -1 )
572
+ {
573
+ return 0;
574
+ }
575
+ return YAML_INDENT;
576
+ }
577
+ #line 578 "<stdout>"
578
+ yy39: ++YYCURSOR;
579
+ switch((yych = *YYCURSOR)) {
580
+ case 0x0A: goto yy91;
581
+ default: goto yy40;
582
+ }
583
+ yy40:
584
+ #line 497 "token.re"
585
+ { ENSURE_YAML_IOPEN(lvl, doc_level, 1);
586
+ goto Plain;
587
+ }
588
+ #line 589 "<stdout>"
589
+ yy41: ++YYCURSOR;
590
+ goto yy42;
591
+ yy42:
592
+ #line 420 "token.re"
593
+ { ENSURE_YAML_IOPEN(lvl, doc_level, 1);
594
+ lvl = CURRENT_LEVEL();
595
+ ADD_LEVEL(lvl->spaces + 1, syck_lvl_iseq);
596
+ return YYTOKEN[0];
597
+ }
598
+ #line 599 "<stdout>"
599
+ yy43: ++YYCURSOR;
600
+ goto yy44;
601
+ yy44:
602
+ #line 426 "token.re"
603
+ { ENSURE_YAML_IOPEN(lvl, doc_level, 1);
604
+ lvl = CURRENT_LEVEL();
605
+ ADD_LEVEL(lvl->spaces + 1, syck_lvl_imap);
606
+ return YYTOKEN[0];
607
+ }
608
+ #line 609 "<stdout>"
609
+ yy45: ++YYCURSOR;
610
+ goto yy46;
611
+ yy46:
612
+ #line 432 "token.re"
613
+ { POP_LEVEL();
614
+ return YYTOKEN[0];
615
+ }
616
+ #line 617 "<stdout>"
617
+ yy47: yyaccept = 1;
618
+ yych = *(YYMARKER = ++YYCURSOR);
619
+ switch(yych){
620
+ case 0x0A: goto yy86;
621
+ case 0x0D: goto yy90;
622
+ case ' ': goto yy88;
623
+ default: goto yy40;
624
+ }
625
+ yy48: yyaccept = 1;
626
+ yych = *(YYMARKER = ++YYCURSOR);
627
+ switch(yych){
628
+ case 0x0A: goto yy81;
629
+ case 0x0D: goto yy85;
630
+ case ' ': goto yy83;
631
+ default: goto yy40;
632
+ }
633
+ yy49: yych = *++YYCURSOR;
634
+ switch(yych){
635
+ case '-': case '0':
636
+ case '1':
637
+ case '2':
638
+ case '3':
639
+ case '4':
640
+ case '5':
641
+ case '6':
642
+ case '7':
643
+ case '8':
644
+ case '9': case 'A':
645
+ case 'B':
646
+ case 'C':
647
+ case 'D':
648
+ case 'E':
649
+ case 'F':
650
+ case 'G':
651
+ case 'H':
652
+ case 'I':
653
+ case 'J':
654
+ case 'K':
655
+ case 'L':
656
+ case 'M':
657
+ case 'N':
658
+ case 'O':
659
+ case 'P':
660
+ case 'Q':
661
+ case 'R':
662
+ case 'S':
663
+ case 'T':
664
+ case 'U':
665
+ case 'V':
666
+ case 'W':
667
+ case 'X':
668
+ case 'Y':
669
+ case 'Z': case '_': case 'a':
670
+ case 'b':
671
+ case 'c':
672
+ case 'd':
673
+ case 'e':
674
+ case 'f':
675
+ case 'g':
676
+ case 'h':
677
+ case 'i':
678
+ case 'j':
679
+ case 'k':
680
+ case 'l':
681
+ case 'm':
682
+ case 'n':
683
+ case 'o':
684
+ case 'p':
685
+ case 'q':
686
+ case 'r':
687
+ case 's':
688
+ case 't':
689
+ case 'u':
690
+ case 'v':
691
+ case 'w':
692
+ case 'x':
693
+ case 'y':
694
+ case 'z': goto yy78;
695
+ default: goto yy40;
696
+ }
697
+ yy50: yych = *++YYCURSOR;
698
+ switch(yych){
699
+ case '-': case '0':
700
+ case '1':
701
+ case '2':
702
+ case '3':
703
+ case '4':
704
+ case '5':
705
+ case '6':
706
+ case '7':
707
+ case '8':
708
+ case '9': case 'A':
709
+ case 'B':
710
+ case 'C':
711
+ case 'D':
712
+ case 'E':
713
+ case 'F':
714
+ case 'G':
715
+ case 'H':
716
+ case 'I':
717
+ case 'J':
718
+ case 'K':
719
+ case 'L':
720
+ case 'M':
721
+ case 'N':
722
+ case 'O':
723
+ case 'P':
724
+ case 'Q':
725
+ case 'R':
726
+ case 'S':
727
+ case 'T':
728
+ case 'U':
729
+ case 'V':
730
+ case 'W':
731
+ case 'X':
732
+ case 'Y':
733
+ case 'Z': case '_': case 'a':
734
+ case 'b':
735
+ case 'c':
736
+ case 'd':
737
+ case 'e':
738
+ case 'f':
739
+ case 'g':
740
+ case 'h':
741
+ case 'i':
742
+ case 'j':
743
+ case 'k':
744
+ case 'l':
745
+ case 'm':
746
+ case 'n':
747
+ case 'o':
748
+ case 'p':
749
+ case 'q':
750
+ case 'r':
751
+ case 's':
752
+ case 't':
753
+ case 'u':
754
+ case 'v':
755
+ case 'w':
756
+ case 'x':
757
+ case 'y':
758
+ case 'z': goto yy75;
759
+ default: goto yy40;
760
+ }
761
+ yy51: ++YYCURSOR;
762
+ goto yy52;
763
+ yy52:
764
+ #line 471 "token.re"
765
+ { goto TransferMethod; }
766
+ #line 767 "<stdout>"
767
+ yy53: ++YYCURSOR;
768
+ goto yy54;
769
+ yy54:
770
+ #line 473 "token.re"
771
+ { ENSURE_YAML_IOPEN(lvl, doc_level, 1);
772
+ goto SingleQuote; }
773
+ #line 774 "<stdout>"
774
+ yy55: ++YYCURSOR;
775
+ goto yy56;
776
+ yy56:
777
+ #line 476 "token.re"
778
+ { ENSURE_YAML_IOPEN(lvl, doc_level, 1);
779
+ goto DoubleQuote; }
780
+ #line 781 "<stdout>"
781
+ yy57: yyaccept = 1;
782
+ yych = *(YYMARKER = ++YYCURSOR);
783
+ switch(yych){
784
+ case 0x0A: goto yy70;
785
+ case 0x0D: goto yy74;
786
+ case ' ': goto yy72;
787
+ case '+': case '-': case '0':
788
+ case '1':
789
+ case '2':
790
+ case '3':
791
+ case '4':
792
+ case '5':
793
+ case '6':
794
+ case '7':
795
+ case '8':
796
+ case '9': goto yy67;
797
+ default: goto yy40;
798
+ }
799
+ yy58: ++YYCURSOR;
800
+ goto yy59;
801
+ yy59:
802
+ #line 486 "token.re"
803
+ { eat_comments( parser );
804
+ goto Document;
805
+ }
806
+ #line 807 "<stdout>"
807
+ yy60: ++YYCURSOR;
808
+ yych = *YYCURSOR;
809
+ goto yy66;
810
+ yy61:
811
+ #line 490 "token.re"
812
+ { goto Document; }
813
+ #line 814 "<stdout>"
814
+ yy62: ++YYCURSOR;
815
+ goto yy63;
816
+ yy63:
817
+ #line 492 "token.re"
818
+ { ENSURE_YAML_IEND(lvl, -1);
819
+ YYPOS(0);
820
+ return 0;
821
+ }
822
+ #line 823 "<stdout>"
823
+ yy64: yych = *++YYCURSOR;
824
+ goto yy40;
825
+ yy65: ++YYCURSOR;
826
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
827
+ yych = *YYCURSOR;
828
+ goto yy66;
829
+ yy66: switch(yych){
830
+ case 0x09: case ' ': goto yy65;
831
+ default: goto yy61;
832
+ }
833
+ yy67: ++YYCURSOR;
834
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
835
+ yych = *YYCURSOR;
836
+ goto yy68;
837
+ yy68: switch(yych){
838
+ case 0x0A: goto yy70;
839
+ case 0x0D: goto yy74;
840
+ case ' ': goto yy72;
841
+ case '+': case '-': case '0':
842
+ case '1':
843
+ case '2':
844
+ case '3':
845
+ case '4':
846
+ case '5':
847
+ case '6':
848
+ case '7':
849
+ case '8':
850
+ case '9': goto yy67;
851
+ default: goto yy69;
852
+ }
853
+ yy69: YYCURSOR = YYMARKER;
854
+ switch(yyaccept){
855
+ case 0: goto yy38;
856
+ case 1: goto yy40;
857
+ }
858
+ yy70: ++YYCURSOR;
859
+ goto yy71;
860
+ yy71:
861
+ #line 479 "token.re"
862
+ { if ( is_newline( YYCURSOR - 1 ) )
863
+ {
864
+ YYCURSOR--;
865
+ }
866
+ goto ScalarBlock;
867
+ }
868
+ #line 869 "<stdout>"
869
+ yy72: ++YYCURSOR;
870
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
871
+ yych = *YYCURSOR;
872
+ goto yy73;
873
+ yy73: switch(yych){
874
+ case ' ': goto yy72;
875
+ default: goto yy71;
876
+ }
877
+ yy74: yych = *++YYCURSOR;
878
+ switch(yych){
879
+ case 0x0A: goto yy70;
880
+ default: goto yy69;
881
+ }
882
+ yy75: ++YYCURSOR;
883
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
884
+ yych = *YYCURSOR;
885
+ goto yy76;
886
+ yy76: switch(yych){
887
+ case '-': case '0':
888
+ case '1':
889
+ case '2':
890
+ case '3':
891
+ case '4':
892
+ case '5':
893
+ case '6':
894
+ case '7':
895
+ case '8':
896
+ case '9': case 'A':
897
+ case 'B':
898
+ case 'C':
899
+ case 'D':
900
+ case 'E':
901
+ case 'F':
902
+ case 'G':
903
+ case 'H':
904
+ case 'I':
905
+ case 'J':
906
+ case 'K':
907
+ case 'L':
908
+ case 'M':
909
+ case 'N':
910
+ case 'O':
911
+ case 'P':
912
+ case 'Q':
913
+ case 'R':
914
+ case 'S':
915
+ case 'T':
916
+ case 'U':
917
+ case 'V':
918
+ case 'W':
919
+ case 'X':
920
+ case 'Y':
921
+ case 'Z': case '_': case 'a':
922
+ case 'b':
923
+ case 'c':
924
+ case 'd':
925
+ case 'e':
926
+ case 'f':
927
+ case 'g':
928
+ case 'h':
929
+ case 'i':
930
+ case 'j':
931
+ case 'k':
932
+ case 'l':
933
+ case 'm':
934
+ case 'n':
935
+ case 'o':
936
+ case 'p':
937
+ case 'q':
938
+ case 'r':
939
+ case 's':
940
+ case 't':
941
+ case 'u':
942
+ case 'v':
943
+ case 'w':
944
+ case 'x':
945
+ case 'y':
946
+ case 'z': goto yy75;
947
+ default: goto yy77;
948
+ }
949
+ yy77:
950
+ #line 466 "token.re"
951
+ { ENSURE_YAML_IOPEN(lvl, doc_level, 1);
952
+ sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
953
+ return YAML_ALIAS;
954
+ }
955
+ #line 956 "<stdout>"
956
+ yy78: ++YYCURSOR;
957
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
958
+ yych = *YYCURSOR;
959
+ goto yy79;
960
+ yy79: switch(yych){
961
+ case '-': case '0':
962
+ case '1':
963
+ case '2':
964
+ case '3':
965
+ case '4':
966
+ case '5':
967
+ case '6':
968
+ case '7':
969
+ case '8':
970
+ case '9': case 'A':
971
+ case 'B':
972
+ case 'C':
973
+ case 'D':
974
+ case 'E':
975
+ case 'F':
976
+ case 'G':
977
+ case 'H':
978
+ case 'I':
979
+ case 'J':
980
+ case 'K':
981
+ case 'L':
982
+ case 'M':
983
+ case 'N':
984
+ case 'O':
985
+ case 'P':
986
+ case 'Q':
987
+ case 'R':
988
+ case 'S':
989
+ case 'T':
990
+ case 'U':
991
+ case 'V':
992
+ case 'W':
993
+ case 'X':
994
+ case 'Y':
995
+ case 'Z': case '_': case 'a':
996
+ case 'b':
997
+ case 'c':
998
+ case 'd':
999
+ case 'e':
1000
+ case 'f':
1001
+ case 'g':
1002
+ case 'h':
1003
+ case 'i':
1004
+ case 'j':
1005
+ case 'k':
1006
+ case 'l':
1007
+ case 'm':
1008
+ case 'n':
1009
+ case 'o':
1010
+ case 'p':
1011
+ case 'q':
1012
+ case 'r':
1013
+ case 's':
1014
+ case 't':
1015
+ case 'u':
1016
+ case 'v':
1017
+ case 'w':
1018
+ case 'x':
1019
+ case 'y':
1020
+ case 'z': goto yy78;
1021
+ default: goto yy80;
1022
+ }
1023
+ yy80:
1024
+ #line 455 "token.re"
1025
+ { sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
1026
+
1027
+ /*
1028
+ * Remove previous anchors of the same name. Since the parser will likely
1029
+ * construct deeper nodes first, we want those nodes to be placed in the
1030
+ * queue for matching at a higher level of indentation.
1031
+ */
1032
+ syck_hdlr_remove_anchor(parser, sycklval->name);
1033
+ return YAML_ANCHOR;
1034
+ }
1035
+ #line 1036 "<stdout>"
1036
+ yy81: ++YYCURSOR;
1037
+ goto yy82;
1038
+ yy82:
1039
+ #line 441 "token.re"
1040
+ { ENSURE_YAML_IOPEN(lvl, (int)(YYTOKEN - YYLINEPTR), 1);
1041
+ FORCE_NEXT_TOKEN(YAML_IOPEN);
1042
+ if ( *YYCURSOR == '#' || is_newline( YYCURSOR ) || is_newline( YYCURSOR - 1 ) )
1043
+ {
1044
+ YYCURSOR--;
1045
+ ADD_LEVEL((int)((YYTOKEN + 1) - YYLINEPTR), syck_lvl_seq);
1046
+ }
1047
+ else /* spaces followed by content uses the space as indentation */
1048
+ {
1049
+ ADD_LEVEL((int)(YYCURSOR - YYLINEPTR), syck_lvl_seq);
1050
+ }
1051
+ return YYTOKEN[0];
1052
+ }
1053
+ #line 1054 "<stdout>"
1054
+ yy83: ++YYCURSOR;
1055
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
1056
+ yych = *YYCURSOR;
1057
+ goto yy84;
1058
+ yy84: switch(yych){
1059
+ case ' ': goto yy83;
1060
+ default: goto yy82;
1061
+ }
1062
+ yy85: yych = *++YYCURSOR;
1063
+ switch(yych){
1064
+ case 0x0A: goto yy81;
1065
+ default: goto yy69;
1066
+ }
1067
+ yy86: ++YYCURSOR;
1068
+ goto yy87;
1069
+ yy87:
1070
+ #line 436 "token.re"
1071
+ { if ( *YYTOKEN == ':' && lvl->status != syck_lvl_imap ) lvl->status = syck_lvl_map;
1072
+ YYPOS(1);
1073
+ return YYTOKEN[0];
1074
+ }
1075
+ #line 1076 "<stdout>"
1076
+ yy88: ++YYCURSOR;
1077
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
1078
+ yych = *YYCURSOR;
1079
+ goto yy89;
1080
+ yy89: switch(yych){
1081
+ case ' ': goto yy88;
1082
+ default: goto yy87;
1083
+ }
1084
+ yy90: yych = *++YYCURSOR;
1085
+ switch(yych){
1086
+ case 0x0A: goto yy86;
1087
+ default: goto yy69;
1088
+ }
1089
+ yy91: yyaccept = 0;
1090
+ YYMARKER = ++YYCURSOR;
1091
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
1092
+ yych = *YYCURSOR;
1093
+ goto yy92;
1094
+ yy92: switch(yych){
1095
+ case 0x0A: case ' ': goto yy91;
1096
+ case 0x0D: goto yy93;
1097
+ default: goto yy38;
1098
+ }
1099
+ yy93: ++YYCURSOR;
1100
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
1101
+ yych = *YYCURSOR;
1102
+ switch(yych){
1103
+ case 0x0A: goto yy91;
1104
+ default: goto yy69;
1105
+ }
1106
+ }
1107
+ #line 501 "token.re"
1108
+
1109
+ }
1110
+
1111
+ Directive:
1112
+ {
1113
+ YYTOKTMP = YYCURSOR;
1114
+
1115
+
1116
+ #line 1117 "<stdout>"
1117
+ {
1118
+ YYCTYPE yych;
1119
+ unsigned int yyaccept = 0;
1120
+ goto yy94;
1121
+ ++YYCURSOR;
1122
+ yy94:
1123
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
1124
+ yych = *YYCURSOR;
1125
+ switch(yych){
1126
+ case 0x00: goto yy96;
1127
+ case 0x09: case ' ': goto yy99;
1128
+ case '%': goto yy97;
1129
+ default: goto yy101;
1130
+ }
1131
+ yy96: YYCURSOR = YYMARKER;
1132
+ switch(yyaccept){
1133
+ case 0: goto yy98;
1134
+ }
1135
+ yy97: yyaccept = 0;
1136
+ yych = *(YYMARKER = ++YYCURSOR);
1137
+ switch(yych){
1138
+ case '.':
1139
+ case '/':
1140
+ case '0':
1141
+ case '1':
1142
+ case '2':
1143
+ case '3':
1144
+ case '4':
1145
+ case '5':
1146
+ case '6':
1147
+ case '7':
1148
+ case '8':
1149
+ case '9':
1150
+ case ':':
1151
+ case ';':
1152
+ case '<':
1153
+ case '=':
1154
+ case '>':
1155
+ case '?':
1156
+ case '@':
1157
+ case 'A':
1158
+ case 'B':
1159
+ case 'C':
1160
+ case 'D':
1161
+ case 'E':
1162
+ case 'F':
1163
+ case 'G':
1164
+ case 'H':
1165
+ case 'I':
1166
+ case 'J':
1167
+ case 'K':
1168
+ case 'L':
1169
+ case 'M':
1170
+ case 'N':
1171
+ case 'O':
1172
+ case 'P':
1173
+ case 'Q':
1174
+ case 'R':
1175
+ case 'S':
1176
+ case 'T':
1177
+ case 'U':
1178
+ case 'V':
1179
+ case 'W':
1180
+ case 'X':
1181
+ case 'Y':
1182
+ case 'Z':
1183
+ case '[':
1184
+ case '\\':
1185
+ case ']':
1186
+ case '^':
1187
+ case '_': case 'a':
1188
+ case 'b':
1189
+ case 'c':
1190
+ case 'd':
1191
+ case 'e':
1192
+ case 'f':
1193
+ case 'g':
1194
+ case 'h':
1195
+ case 'i':
1196
+ case 'j':
1197
+ case 'k':
1198
+ case 'l':
1199
+ case 'm':
1200
+ case 'n':
1201
+ case 'o':
1202
+ case 'p':
1203
+ case 'q':
1204
+ case 'r':
1205
+ case 's':
1206
+ case 't':
1207
+ case 'u':
1208
+ case 'v':
1209
+ case 'w':
1210
+ case 'x':
1211
+ case 'y':
1212
+ case 'z': goto yy104;
1213
+ default: goto yy98;
1214
+ }
1215
+ yy98:
1216
+ #line 514 "token.re"
1217
+ { YYCURSOR = YYTOKTMP;
1218
+ return YAML_DOCSEP;
1219
+ }
1220
+ #line 1221 "<stdout>"
1221
+ yy99: ++YYCURSOR;
1222
+ yych = *YYCURSOR;
1223
+ goto yy103;
1224
+ yy100:
1225
+ #line 512 "token.re"
1226
+ { goto Directive; }
1227
+ #line 1228 "<stdout>"
1228
+ yy101: yych = *++YYCURSOR;
1229
+ goto yy98;
1230
+ yy102: ++YYCURSOR;
1231
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
1232
+ yych = *YYCURSOR;
1233
+ goto yy103;
1234
+ yy103: switch(yych){
1235
+ case 0x09: case ' ': goto yy102;
1236
+ default: goto yy100;
1237
+ }
1238
+ yy104: ++YYCURSOR;
1239
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
1240
+ yych = *YYCURSOR;
1241
+ goto yy105;
1242
+ yy105: switch(yych){
1243
+ case '.':
1244
+ case '/':
1245
+ case '0':
1246
+ case '1':
1247
+ case '2':
1248
+ case '3':
1249
+ case '4':
1250
+ case '5':
1251
+ case '6':
1252
+ case '7':
1253
+ case '8':
1254
+ case '9': case ';':
1255
+ case '<':
1256
+ case '=':
1257
+ case '>':
1258
+ case '?':
1259
+ case '@':
1260
+ case 'A':
1261
+ case 'B':
1262
+ case 'C':
1263
+ case 'D':
1264
+ case 'E':
1265
+ case 'F':
1266
+ case 'G':
1267
+ case 'H':
1268
+ case 'I':
1269
+ case 'J':
1270
+ case 'K':
1271
+ case 'L':
1272
+ case 'M':
1273
+ case 'N':
1274
+ case 'O':
1275
+ case 'P':
1276
+ case 'Q':
1277
+ case 'R':
1278
+ case 'S':
1279
+ case 'T':
1280
+ case 'U':
1281
+ case 'V':
1282
+ case 'W':
1283
+ case 'X':
1284
+ case 'Y':
1285
+ case 'Z':
1286
+ case '[':
1287
+ case '\\':
1288
+ case ']':
1289
+ case '^':
1290
+ case '_': case 'a':
1291
+ case 'b':
1292
+ case 'c':
1293
+ case 'd':
1294
+ case 'e':
1295
+ case 'f':
1296
+ case 'g':
1297
+ case 'h':
1298
+ case 'i':
1299
+ case 'j':
1300
+ case 'k':
1301
+ case 'l':
1302
+ case 'm':
1303
+ case 'n':
1304
+ case 'o':
1305
+ case 'p':
1306
+ case 'q':
1307
+ case 'r':
1308
+ case 's':
1309
+ case 't':
1310
+ case 'u':
1311
+ case 'v':
1312
+ case 'w':
1313
+ case 'x':
1314
+ case 'y':
1315
+ case 'z': goto yy104;
1316
+ case ':': goto yy106;
1317
+ default: goto yy96;
1318
+ }
1319
+ yy106: yych = *++YYCURSOR;
1320
+ switch(yych){
1321
+ case '.':
1322
+ case '/':
1323
+ case '0':
1324
+ case '1':
1325
+ case '2':
1326
+ case '3':
1327
+ case '4':
1328
+ case '5':
1329
+ case '6':
1330
+ case '7':
1331
+ case '8':
1332
+ case '9':
1333
+ case ':':
1334
+ case ';':
1335
+ case '<':
1336
+ case '=':
1337
+ case '>':
1338
+ case '?':
1339
+ case '@':
1340
+ case 'A':
1341
+ case 'B':
1342
+ case 'C':
1343
+ case 'D':
1344
+ case 'E':
1345
+ case 'F':
1346
+ case 'G':
1347
+ case 'H':
1348
+ case 'I':
1349
+ case 'J':
1350
+ case 'K':
1351
+ case 'L':
1352
+ case 'M':
1353
+ case 'N':
1354
+ case 'O':
1355
+ case 'P':
1356
+ case 'Q':
1357
+ case 'R':
1358
+ case 'S':
1359
+ case 'T':
1360
+ case 'U':
1361
+ case 'V':
1362
+ case 'W':
1363
+ case 'X':
1364
+ case 'Y':
1365
+ case 'Z':
1366
+ case '[':
1367
+ case '\\':
1368
+ case ']':
1369
+ case '^':
1370
+ case '_': case 'a':
1371
+ case 'b':
1372
+ case 'c':
1373
+ case 'd':
1374
+ case 'e':
1375
+ case 'f':
1376
+ case 'g':
1377
+ case 'h':
1378
+ case 'i':
1379
+ case 'j':
1380
+ case 'k':
1381
+ case 'l':
1382
+ case 'm':
1383
+ case 'n':
1384
+ case 'o':
1385
+ case 'p':
1386
+ case 'q':
1387
+ case 'r':
1388
+ case 's':
1389
+ case 't':
1390
+ case 'u':
1391
+ case 'v':
1392
+ case 'w':
1393
+ case 'x':
1394
+ case 'y':
1395
+ case 'z': goto yy107;
1396
+ default: goto yy96;
1397
+ }
1398
+ yy107: ++YYCURSOR;
1399
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
1400
+ yych = *YYCURSOR;
1401
+ goto yy108;
1402
+ yy108: switch(yych){
1403
+ case '.':
1404
+ case '/':
1405
+ case '0':
1406
+ case '1':
1407
+ case '2':
1408
+ case '3':
1409
+ case '4':
1410
+ case '5':
1411
+ case '6':
1412
+ case '7':
1413
+ case '8':
1414
+ case '9':
1415
+ case ':':
1416
+ case ';':
1417
+ case '<':
1418
+ case '=':
1419
+ case '>':
1420
+ case '?':
1421
+ case '@':
1422
+ case 'A':
1423
+ case 'B':
1424
+ case 'C':
1425
+ case 'D':
1426
+ case 'E':
1427
+ case 'F':
1428
+ case 'G':
1429
+ case 'H':
1430
+ case 'I':
1431
+ case 'J':
1432
+ case 'K':
1433
+ case 'L':
1434
+ case 'M':
1435
+ case 'N':
1436
+ case 'O':
1437
+ case 'P':
1438
+ case 'Q':
1439
+ case 'R':
1440
+ case 'S':
1441
+ case 'T':
1442
+ case 'U':
1443
+ case 'V':
1444
+ case 'W':
1445
+ case 'X':
1446
+ case 'Y':
1447
+ case 'Z':
1448
+ case '[':
1449
+ case '\\':
1450
+ case ']':
1451
+ case '^':
1452
+ case '_': case 'a':
1453
+ case 'b':
1454
+ case 'c':
1455
+ case 'd':
1456
+ case 'e':
1457
+ case 'f':
1458
+ case 'g':
1459
+ case 'h':
1460
+ case 'i':
1461
+ case 'j':
1462
+ case 'k':
1463
+ case 'l':
1464
+ case 'm':
1465
+ case 'n':
1466
+ case 'o':
1467
+ case 'p':
1468
+ case 'q':
1469
+ case 'r':
1470
+ case 's':
1471
+ case 't':
1472
+ case 'u':
1473
+ case 'v':
1474
+ case 'w':
1475
+ case 'x':
1476
+ case 'y':
1477
+ case 'z': goto yy107;
1478
+ default: goto yy109;
1479
+ }
1480
+ yy109:
1481
+ #line 510 "token.re"
1482
+ { goto Directive; }
1483
+ #line 1484 "<stdout>"
1484
+ }
1485
+ #line 517 "token.re"
1486
+
1487
+
1488
+ }
1489
+
1490
+ Plain:
1491
+ {
1492
+ ptrdiff_t qidx = 0;
1493
+ ptrdiff_t qcapa = 100;
1494
+ char *qstr = S_ALLOC_N( char, qcapa );
1495
+ SyckLevel *plvl;
1496
+ int parentIndent;
1497
+
1498
+ YYCURSOR = YYTOKEN;
1499
+ plvl = CURRENT_LEVEL();
1500
+ GET_TRUE_YAML_INDENT(parentIndent);
1501
+
1502
+ Plain2:
1503
+ YYTOKEN = YYCURSOR;
1504
+
1505
+ Plain3:
1506
+
1507
+
1508
+ #line 1509 "<stdout>"
1509
+ {
1510
+ YYCTYPE yych;
1511
+ unsigned int yyaccept;
1512
+ goto yy110;
1513
+ ++YYCURSOR;
1514
+ yy110:
1515
+ if((YYLIMIT - YYCURSOR) < 3) YYFILL(3);
1516
+ yych = *YYCURSOR;
1517
+ switch(yych){
1518
+ case 0x00: goto yy124;
1519
+ case 0x09: goto yy126;
1520
+ case 0x0A: goto yy112;
1521
+ case 0x0D: goto yy114;
1522
+ case ' ': goto yy122;
1523
+ case ',': goto yy117;
1524
+ case ':': goto yy116;
1525
+ case ']': goto yy120;
1526
+ case '}': goto yy118;
1527
+ default: goto yy127;
1528
+ }
1529
+ yy112: yyaccept = 0;
1530
+ yych = *(YYMARKER = ++YYCURSOR);
1531
+ goto yy142;
1532
+ yy113:
1533
+ #line 540 "token.re"
1534
+ { int indt_len, nl_count = 0;
1535
+ SyckLevel *lvl;
1536
+ char *tok = YYTOKEN;
1537
+ GOBBLE_UP_YAML_INDENT( indt_len, tok );
1538
+ lvl = CURRENT_LEVEL();
1539
+
1540
+ if ( indt_len <= parentIndent )
1541
+ {
1542
+ RETURN_IMPLICIT();
1543
+ }
1544
+
1545
+ while ( YYTOKEN < YYCURSOR )
1546
+ {
1547
+ int nl_len = newline_len( YYTOKEN++ );
1548
+ if ( nl_len )
1549
+ {
1550
+ nl_count++;
1551
+ YYTOKEN += nl_len - 1;
1552
+ }
1553
+ }
1554
+ if ( nl_count <= 1 )
1555
+ {
1556
+ QUOTECAT(qstr, qcapa, qidx, ' ');
1557
+ }
1558
+ else
1559
+ {
1560
+ int i;
1561
+ for ( i = 0; i < nl_count - 1; i++ )
1562
+ {
1563
+ QUOTECAT(qstr, qcapa, qidx, '\n');
1564
+ }
1565
+ }
1566
+
1567
+ goto Plain2;
1568
+ }
1569
+ #line 1570 "<stdout>"
1570
+ yy114: ++YYCURSOR;
1571
+ switch((yych = *YYCURSOR)) {
1572
+ case 0x0A: goto yy141;
1573
+ default: goto yy115;
1574
+ }
1575
+ yy115:
1576
+ #line 627 "token.re"
1577
+ { QUOTECATS(qstr, qcapa, qidx, YYTOKEN, YYCURSOR - YYTOKEN);
1578
+ goto Plain2;
1579
+ }
1580
+ #line 1581 "<stdout>"
1581
+ yy116: yyaccept = 1;
1582
+ yych = *(YYMARKER = ++YYCURSOR);
1583
+ switch(yych){
1584
+ case 0x0A: goto yy136;
1585
+ case 0x0D: goto yy140;
1586
+ case ' ': goto yy138;
1587
+ default: goto yy115;
1588
+ }
1589
+ yy117: yyaccept = 1;
1590
+ yych = *(YYMARKER = ++YYCURSOR);
1591
+ switch(yych){
1592
+ case 0x0A: goto yy130;
1593
+ case 0x0D: goto yy134;
1594
+ case ' ': goto yy132;
1595
+ default: goto yy115;
1596
+ }
1597
+ yy118: ++YYCURSOR;
1598
+ goto yy119;
1599
+ yy119:
1600
+ #line 589 "token.re"
1601
+ { if ( plvl->status != syck_lvl_imap )
1602
+ {
1603
+ PLAIN_NOT_INL();
1604
+ }
1605
+ else
1606
+ {
1607
+ PLAIN_IS_INL();
1608
+ }
1609
+ RETURN_IMPLICIT();
1610
+ }
1611
+ #line 1612 "<stdout>"
1612
+ yy120: ++YYCURSOR;
1613
+ goto yy121;
1614
+ yy121:
1615
+ #line 600 "token.re"
1616
+ { if ( plvl->status != syck_lvl_iseq )
1617
+ {
1618
+ PLAIN_NOT_INL();
1619
+ }
1620
+ else
1621
+ {
1622
+ PLAIN_IS_INL();
1623
+ }
1624
+ RETURN_IMPLICIT();
1625
+ }
1626
+ #line 1627 "<stdout>"
1627
+ yy122: ++YYCURSOR;
1628
+ switch((yych = *YYCURSOR)) {
1629
+ case '#': goto yy128;
1630
+ default: goto yy123;
1631
+ }
1632
+ yy123:
1633
+ #line 617 "token.re"
1634
+ { if ( qidx == 0 )
1635
+ {
1636
+ goto Plain2;
1637
+ }
1638
+ else
1639
+ {
1640
+ goto Plain3;
1641
+ }
1642
+ }
1643
+ #line 1644 "<stdout>"
1644
+ yy124: ++YYCURSOR;
1645
+ goto yy125;
1646
+ yy125:
1647
+ #line 615 "token.re"
1648
+ { RETURN_IMPLICIT(); }
1649
+ #line 1650 "<stdout>"
1650
+ yy126: yych = *++YYCURSOR;
1651
+ goto yy123;
1652
+ yy127: yych = *++YYCURSOR;
1653
+ goto yy115;
1654
+ yy128: ++YYCURSOR;
1655
+ goto yy129;
1656
+ yy129:
1657
+ #line 611 "token.re"
1658
+ { eat_comments( parser );
1659
+ RETURN_IMPLICIT();
1660
+ }
1661
+ #line 1662 "<stdout>"
1662
+ yy130: ++YYCURSOR;
1663
+ goto yy131;
1664
+ yy131:
1665
+ #line 578 "token.re"
1666
+ { if ( plvl->status != syck_lvl_iseq && plvl->status != syck_lvl_imap )
1667
+ {
1668
+ PLAIN_NOT_INL();
1669
+ }
1670
+ else
1671
+ {
1672
+ PLAIN_IS_INL();
1673
+ }
1674
+ RETURN_IMPLICIT();
1675
+ }
1676
+ #line 1677 "<stdout>"
1677
+ yy132: ++YYCURSOR;
1678
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
1679
+ yych = *YYCURSOR;
1680
+ goto yy133;
1681
+ yy133: switch(yych){
1682
+ case ' ': goto yy132;
1683
+ default: goto yy131;
1684
+ }
1685
+ yy134: yych = *++YYCURSOR;
1686
+ switch(yych){
1687
+ case 0x0A: goto yy130;
1688
+ default: goto yy135;
1689
+ }
1690
+ yy135: YYCURSOR = YYMARKER;
1691
+ switch(yyaccept){
1692
+ case 0: goto yy113;
1693
+ case 1: goto yy115;
1694
+ }
1695
+ yy136: ++YYCURSOR;
1696
+ goto yy137;
1697
+ yy137:
1698
+ #line 576 "token.re"
1699
+ { RETURN_IMPLICIT(); }
1700
+ #line 1701 "<stdout>"
1701
+ yy138: ++YYCURSOR;
1702
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
1703
+ yych = *YYCURSOR;
1704
+ goto yy139;
1705
+ yy139: switch(yych){
1706
+ case ' ': goto yy138;
1707
+ default: goto yy137;
1708
+ }
1709
+ yy140: yych = *++YYCURSOR;
1710
+ switch(yych){
1711
+ case 0x0A: goto yy136;
1712
+ default: goto yy135;
1713
+ }
1714
+ yy141: yyaccept = 0;
1715
+ YYMARKER = ++YYCURSOR;
1716
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
1717
+ yych = *YYCURSOR;
1718
+ goto yy142;
1719
+ yy142: switch(yych){
1720
+ case 0x0A: case ' ': goto yy141;
1721
+ case 0x0D: goto yy143;
1722
+ default: goto yy113;
1723
+ }
1724
+ yy143: ++YYCURSOR;
1725
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
1726
+ yych = *YYCURSOR;
1727
+ switch(yych){
1728
+ case 0x0A: goto yy141;
1729
+ default: goto yy135;
1730
+ }
1731
+ }
1732
+ #line 631 "token.re"
1733
+
1734
+ }
1735
+
1736
+ SingleQuote:
1737
+ {
1738
+ int qidx = 0;
1739
+ int qcapa = 100;
1740
+ char *qstr = S_ALLOC_N( char, qcapa );
1741
+
1742
+ SingleQuote2:
1743
+ YYTOKEN = YYCURSOR;
1744
+
1745
+
1746
+ #line 1747 "<stdout>"
1747
+ {
1748
+ YYCTYPE yych;
1749
+ unsigned int yyaccept;
1750
+ goto yy144;
1751
+ ++YYCURSOR;
1752
+ yy144:
1753
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
1754
+ yych = *YYCURSOR;
1755
+ switch(yych){
1756
+ case 0x00: goto yy152;
1757
+ case 0x0A: goto yy146;
1758
+ case 0x0D: goto yy148;
1759
+ case '\'': goto yy150;
1760
+ default: goto yy153;
1761
+ }
1762
+ yy146: yyaccept = 0;
1763
+ yych = *(YYMARKER = ++YYCURSOR);
1764
+ goto yy157;
1765
+ yy147:
1766
+ #line 645 "token.re"
1767
+ { int indt_len;
1768
+ int nl_count = 0;
1769
+ SyckLevel *lvl;
1770
+ GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN );
1771
+ lvl = CURRENT_LEVEL();
1772
+
1773
+ if ( lvl->status != syck_lvl_str )
1774
+ {
1775
+ ADD_LEVEL( indt_len, syck_lvl_str );
1776
+ }
1777
+ else if ( indt_len < lvl->spaces )
1778
+ {
1779
+ /* Error! */
1780
+ }
1781
+
1782
+ while ( YYTOKEN < YYCURSOR )
1783
+ {
1784
+ int nl_len = newline_len( YYTOKEN++ );
1785
+ if ( nl_len )
1786
+ {
1787
+ nl_count++;
1788
+ YYTOKEN += nl_len - 1;
1789
+ }
1790
+ }
1791
+ if ( nl_count <= 1 )
1792
+ {
1793
+ QUOTECAT(qstr, qcapa, qidx, ' ');
1794
+ }
1795
+ else
1796
+ {
1797
+ int i;
1798
+ for ( i = 0; i < nl_count - 1; i++ )
1799
+ {
1800
+ QUOTECAT(qstr, qcapa, qidx, '\n');
1801
+ }
1802
+ }
1803
+
1804
+ goto SingleQuote2;
1805
+ }
1806
+ #line 1807 "<stdout>"
1807
+ yy148: ++YYCURSOR;
1808
+ switch((yych = *YYCURSOR)) {
1809
+ case 0x0A: goto yy156;
1810
+ default: goto yy149;
1811
+ }
1812
+ yy149:
1813
+ #line 712 "token.re"
1814
+ { QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
1815
+ goto SingleQuote2;
1816
+ }
1817
+ #line 1818 "<stdout>"
1818
+ yy150: ++YYCURSOR;
1819
+ switch((yych = *YYCURSOR)) {
1820
+ case '\'': goto yy154;
1821
+ default: goto yy151;
1822
+ }
1823
+ yy151:
1824
+ #line 689 "token.re"
1825
+ { SyckLevel *lvl;
1826
+ SyckNode *n = syck_alloc_str();
1827
+ lvl = CURRENT_LEVEL();
1828
+
1829
+ if ( lvl->status == syck_lvl_str )
1830
+ {
1831
+ POP_LEVEL();
1832
+ }
1833
+ if ( ((SyckParser *)parser)->taguri_expansion == 1 )
1834
+ {
1835
+ n->type_id = syck_taguri( YAML_DOMAIN, "str", 3 );
1836
+ }
1837
+ else
1838
+ {
1839
+ n->type_id = syck_strndup( "str", 3 );
1840
+ }
1841
+ n->data.str->ptr = qstr;
1842
+ n->data.str->len = qidx;
1843
+ n->data.str->style = scalar_1quote;
1844
+ sycklval->nodeData = n;
1845
+ return YAML_PLAIN;
1846
+ }
1847
+ #line 1848 "<stdout>"
1848
+ yy152: yych = *++YYCURSOR;
1849
+ goto yy151;
1850
+ yy153: yych = *++YYCURSOR;
1851
+ goto yy149;
1852
+ yy154: ++YYCURSOR;
1853
+ goto yy155;
1854
+ yy155:
1855
+ #line 685 "token.re"
1856
+ { QUOTECAT(qstr, qcapa, qidx, '\'');
1857
+ goto SingleQuote2;
1858
+ }
1859
+ #line 1860 "<stdout>"
1860
+ yy156: yyaccept = 0;
1861
+ YYMARKER = ++YYCURSOR;
1862
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
1863
+ yych = *YYCURSOR;
1864
+ goto yy157;
1865
+ yy157: switch(yych){
1866
+ case 0x0A: case ' ': goto yy156;
1867
+ case 0x0D: goto yy158;
1868
+ default: goto yy147;
1869
+ }
1870
+ yy158: ++YYCURSOR;
1871
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
1872
+ yych = *YYCURSOR;
1873
+ switch(yych){
1874
+ case 0x0A: goto yy156;
1875
+ default: goto yy159;
1876
+ }
1877
+ yy159: YYCURSOR = YYMARKER;
1878
+ switch(yyaccept){
1879
+ case 0: goto yy147;
1880
+ }
1881
+ }
1882
+ #line 716 "token.re"
1883
+
1884
+
1885
+ }
1886
+
1887
+
1888
+ DoubleQuote:
1889
+ {
1890
+ int keep_nl = 1;
1891
+ int qidx = 0;
1892
+ int qcapa = 100;
1893
+ char *qstr = S_ALLOC_N( char, qcapa );
1894
+
1895
+ DoubleQuote2:
1896
+ YYTOKEN = YYCURSOR;
1897
+
1898
+
1899
+
1900
+ #line 1901 "<stdout>"
1901
+ {
1902
+ YYCTYPE yych;
1903
+ unsigned int yyaccept;
1904
+ goto yy160;
1905
+ ++YYCURSOR;
1906
+ yy160:
1907
+ if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
1908
+ yych = *YYCURSOR;
1909
+ switch(yych){
1910
+ case 0x00: goto yy167;
1911
+ case 0x0A: goto yy162;
1912
+ case 0x0D: goto yy164;
1913
+ case '"': goto yy169;
1914
+ case '\\': goto yy166;
1915
+ default: goto yy170;
1916
+ }
1917
+ yy162: yyaccept = 0;
1918
+ yych = *(YYMARKER = ++YYCURSOR);
1919
+ goto yy184;
1920
+ yy163:
1921
+ #line 734 "token.re"
1922
+ { int indt_len;
1923
+ int nl_count = 0;
1924
+ SyckLevel *lvl;
1925
+ GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN );
1926
+ lvl = CURRENT_LEVEL();
1927
+
1928
+ if ( lvl->status != syck_lvl_str )
1929
+ {
1930
+ ADD_LEVEL( indt_len, syck_lvl_str );
1931
+ }
1932
+ else if ( indt_len < lvl->spaces )
1933
+ {
1934
+ /* FIXME */
1935
+ }
1936
+
1937
+ if ( keep_nl == 1 )
1938
+ {
1939
+ while ( YYTOKEN < YYCURSOR )
1940
+ {
1941
+ int nl_len = newline_len( YYTOKEN++ );
1942
+ if ( nl_len )
1943
+ {
1944
+ nl_count++;
1945
+ YYTOKEN += nl_len - 1;
1946
+ }
1947
+ }
1948
+ if ( nl_count <= 1 )
1949
+ {
1950
+ QUOTECAT(qstr, qcapa, qidx, ' ');
1951
+ }
1952
+ else
1953
+ {
1954
+ int i;
1955
+ for ( i = 0; i < nl_count - 1; i++ )
1956
+ {
1957
+ QUOTECAT(qstr, qcapa, qidx, '\n');
1958
+ }
1959
+ }
1960
+ }
1961
+
1962
+ keep_nl = 1;
1963
+ goto DoubleQuote2;
1964
+ }
1965
+ #line 1966 "<stdout>"
1966
+ yy164: ++YYCURSOR;
1967
+ switch((yych = *YYCURSOR)) {
1968
+ case 0x0A: goto yy183;
1969
+ default: goto yy165;
1970
+ }
1971
+ yy165:
1972
+ #line 820 "token.re"
1973
+ { QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
1974
+ goto DoubleQuote2;
1975
+ }
1976
+ #line 1977 "<stdout>"
1977
+ yy166: yyaccept = 1;
1978
+ yych = *(YYMARKER = ++YYCURSOR);
1979
+ switch(yych){
1980
+ case 0x0A: goto yy174;
1981
+ case 0x0D: goto yy176;
1982
+ case ' ': goto yy171;
1983
+ case '"': case '0': case '\\': case 'a':
1984
+ case 'b': case 'e':
1985
+ case 'f': case 'n': case 'r': case 't': case 'v': goto yy178;
1986
+ case 'x': goto yy177;
1987
+ default: goto yy165;
1988
+ }
1989
+ yy167: ++YYCURSOR;
1990
+ goto yy168;
1991
+ yy168:
1992
+ #line 797 "token.re"
1993
+ { SyckLevel *lvl;
1994
+ SyckNode *n = syck_alloc_str();
1995
+ lvl = CURRENT_LEVEL();
1996
+
1997
+ if ( lvl->status == syck_lvl_str )
1998
+ {
1999
+ POP_LEVEL();
2000
+ }
2001
+ if ( ((SyckParser *)parser)->taguri_expansion == 1 )
2002
+ {
2003
+ n->type_id = syck_taguri( YAML_DOMAIN, "str", 3 );
2004
+ }
2005
+ else
2006
+ {
2007
+ n->type_id = syck_strndup( "str", 3 );
2008
+ }
2009
+ n->data.str->ptr = qstr;
2010
+ n->data.str->len = qidx;
2011
+ n->data.str->style = scalar_2quote;
2012
+ sycklval->nodeData = n;
2013
+ return YAML_PLAIN;
2014
+ }
2015
+ #line 2016 "<stdout>"
2016
+ yy169: yych = *++YYCURSOR;
2017
+ goto yy168;
2018
+ yy170: yych = *++YYCURSOR;
2019
+ goto yy165;
2020
+ yy171: ++YYCURSOR;
2021
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
2022
+ yych = *YYCURSOR;
2023
+ goto yy172;
2024
+ yy172: switch(yych){
2025
+ case 0x0A: goto yy174;
2026
+ case 0x0D: goto yy176;
2027
+ case ' ': goto yy171;
2028
+ default: goto yy173;
2029
+ }
2030
+ yy173: YYCURSOR = YYMARKER;
2031
+ switch(yyaccept){
2032
+ case 0: goto yy163;
2033
+ case 1: goto yy165;
2034
+ }
2035
+ yy174: ++YYCURSOR;
2036
+ goto yy175;
2037
+ yy175:
2038
+ #line 792 "token.re"
2039
+ { keep_nl = 0;
2040
+ YYCURSOR--;
2041
+ goto DoubleQuote2;
2042
+ }
2043
+ #line 2044 "<stdout>"
2044
+ yy176: yych = *++YYCURSOR;
2045
+ switch(yych){
2046
+ case 0x0A: goto yy174;
2047
+ default: goto yy173;
2048
+ }
2049
+ yy177: yych = *++YYCURSOR;
2050
+ switch(yych){
2051
+ case '0':
2052
+ case '1':
2053
+ case '2':
2054
+ case '3':
2055
+ case '4':
2056
+ case '5':
2057
+ case '6':
2058
+ case '7':
2059
+ case '8':
2060
+ case '9': case 'A':
2061
+ case 'B':
2062
+ case 'C':
2063
+ case 'D':
2064
+ case 'E':
2065
+ case 'F': case 'a':
2066
+ case 'b':
2067
+ case 'c':
2068
+ case 'd':
2069
+ case 'e':
2070
+ case 'f': goto yy180;
2071
+ default: goto yy173;
2072
+ }
2073
+ yy178: ++YYCURSOR;
2074
+ goto yy179;
2075
+ yy179:
2076
+ #line 778 "token.re"
2077
+ { char ch = *( YYCURSOR - 1 );
2078
+ QUOTECAT(qstr, qcapa, qidx, escape_seq( ch ));
2079
+ goto DoubleQuote2;
2080
+ }
2081
+ #line 2082 "<stdout>"
2082
+ yy180: yych = *++YYCURSOR;
2083
+ switch(yych){
2084
+ case '0':
2085
+ case '1':
2086
+ case '2':
2087
+ case '3':
2088
+ case '4':
2089
+ case '5':
2090
+ case '6':
2091
+ case '7':
2092
+ case '8':
2093
+ case '9': case 'A':
2094
+ case 'B':
2095
+ case 'C':
2096
+ case 'D':
2097
+ case 'E':
2098
+ case 'F': case 'a':
2099
+ case 'b':
2100
+ case 'c':
2101
+ case 'd':
2102
+ case 'e':
2103
+ case 'f': goto yy181;
2104
+ default: goto yy173;
2105
+ }
2106
+ yy181: ++YYCURSOR;
2107
+ goto yy182;
2108
+ yy182:
2109
+ #line 783 "token.re"
2110
+ { long ch;
2111
+ char *chr_text = syck_strndup( YYTOKEN, 4 );
2112
+ chr_text[0] = '0';
2113
+ ch = strtol( chr_text, NULL, 16 );
2114
+ free( chr_text );
2115
+ QUOTECAT(qstr, qcapa, qidx, ch);
2116
+ goto DoubleQuote2;
2117
+ }
2118
+ #line 2119 "<stdout>"
2119
+ yy183: yyaccept = 0;
2120
+ YYMARKER = ++YYCURSOR;
2121
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
2122
+ yych = *YYCURSOR;
2123
+ goto yy184;
2124
+ yy184: switch(yych){
2125
+ case 0x0A: case ' ': goto yy183;
2126
+ case 0x0D: goto yy185;
2127
+ default: goto yy163;
2128
+ }
2129
+ yy185: ++YYCURSOR;
2130
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
2131
+ yych = *YYCURSOR;
2132
+ switch(yych){
2133
+ case 0x0A: goto yy183;
2134
+ default: goto yy173;
2135
+ }
2136
+ }
2137
+ #line 824 "token.re"
2138
+
2139
+ }
2140
+
2141
+ TransferMethod:
2142
+ {
2143
+ int qidx = 0;
2144
+ int qcapa = 100;
2145
+ char *qstr = S_ALLOC_N( char, qcapa );
2146
+
2147
+ TransferMethod2:
2148
+ YYTOKTMP = YYCURSOR;
2149
+
2150
+
2151
+ #line 2152 "<stdout>"
2152
+ {
2153
+ YYCTYPE yych;
2154
+ unsigned int yyaccept;
2155
+ goto yy186;
2156
+ ++YYCURSOR;
2157
+ yy186:
2158
+ if((YYLIMIT - YYCURSOR) < 4) YYFILL(4);
2159
+ yych = *YYCURSOR;
2160
+ switch(yych){
2161
+ case 0x00: goto yy188;
2162
+ case 0x0A: goto yy190;
2163
+ case 0x0D: goto yy192;
2164
+ case ' ': goto yy191;
2165
+ case '\\': goto yy194;
2166
+ default: goto yy195;
2167
+ }
2168
+ yy188: ++YYCURSOR;
2169
+ goto yy189;
2170
+ yy189:
2171
+ #line 838 "token.re"
2172
+ { SyckLevel *lvl;
2173
+ YYCURSOR = YYTOKTMP;
2174
+ if ( YYCURSOR == YYTOKEN + 1 )
2175
+ {
2176
+ free( qstr );
2177
+ return YAML_ITRANSFER;
2178
+ }
2179
+
2180
+ lvl = CURRENT_LEVEL();
2181
+
2182
+ /*
2183
+ * URL Prefixing
2184
+ */
2185
+ if ( *qstr == '^' )
2186
+ {
2187
+ sycklval->name = S_ALLOC_N( char, qidx + strlen( lvl->domain ) );
2188
+ sycklval->name[0] = '\0';
2189
+ strcat( sycklval->name, lvl->domain );
2190
+ strncat( sycklval->name, qstr + 1, qidx - 1 );
2191
+ free( qstr );
2192
+ }
2193
+ else
2194
+ {
2195
+ char *carat = qstr;
2196
+ char *qend = qstr + qidx;
2197
+ while ( (++carat) < qend )
2198
+ {
2199
+ if ( *carat == '^' )
2200
+ break;
2201
+ }
2202
+
2203
+ if ( carat < qend )
2204
+ {
2205
+ free( lvl->domain );
2206
+ lvl->domain = syck_strndup( qstr, carat - qstr );
2207
+ sycklval->name = S_ALLOC_N( char, ( qend - carat ) + strlen( lvl->domain ) );
2208
+ sycklval->name[0] = '\0';
2209
+ strcat( sycklval->name, lvl->domain );
2210
+ strncat( sycklval->name, carat + 1, ( qend - carat ) - 1 );
2211
+ free( qstr );
2212
+ }
2213
+ else
2214
+ {
2215
+ sycklval->name = qstr;
2216
+ }
2217
+ }
2218
+
2219
+ return YAML_TRANSFER;
2220
+ }
2221
+ #line 2222 "<stdout>"
2222
+ yy190: yych = *++YYCURSOR;
2223
+ goto yy189;
2224
+ yy191: yych = *++YYCURSOR;
2225
+ goto yy204;
2226
+ yy192: ++YYCURSOR;
2227
+ switch((yych = *YYCURSOR)) {
2228
+ case 0x0A: goto yy188;
2229
+ default: goto yy193;
2230
+ }
2231
+ yy193:
2232
+ #line 905 "token.re"
2233
+ { QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
2234
+ goto TransferMethod2;
2235
+ }
2236
+ #line 2237 "<stdout>"
2237
+ yy194: yyaccept = 0;
2238
+ yych = *(YYMARKER = ++YYCURSOR);
2239
+ switch(yych){
2240
+ case '"': case '0': case '\\': case 'a':
2241
+ case 'b': case 'e':
2242
+ case 'f': case 'n': case 'r': case 't': case 'v': goto yy198;
2243
+ case 'x': goto yy196;
2244
+ default: goto yy193;
2245
+ }
2246
+ yy195: yych = *++YYCURSOR;
2247
+ goto yy193;
2248
+ yy196: yych = *++YYCURSOR;
2249
+ switch(yych){
2250
+ case '0':
2251
+ case '1':
2252
+ case '2':
2253
+ case '3':
2254
+ case '4':
2255
+ case '5':
2256
+ case '6':
2257
+ case '7':
2258
+ case '8':
2259
+ case '9': case 'A':
2260
+ case 'B':
2261
+ case 'C':
2262
+ case 'D':
2263
+ case 'E':
2264
+ case 'F': case 'a':
2265
+ case 'b':
2266
+ case 'c':
2267
+ case 'd':
2268
+ case 'e':
2269
+ case 'f': goto yy200;
2270
+ default: goto yy197;
2271
+ }
2272
+ yy197: YYCURSOR = YYMARKER;
2273
+ switch(yyaccept){
2274
+ case 0: goto yy193;
2275
+ }
2276
+ yy198: ++YYCURSOR;
2277
+ goto yy199;
2278
+ yy199:
2279
+ #line 891 "token.re"
2280
+ { char ch = *( YYCURSOR - 1 );
2281
+ QUOTECAT(qstr, qcapa, qidx, escape_seq( ch ));
2282
+ goto TransferMethod2;
2283
+ }
2284
+ #line 2285 "<stdout>"
2285
+ yy200: yych = *++YYCURSOR;
2286
+ switch(yych){
2287
+ case '0':
2288
+ case '1':
2289
+ case '2':
2290
+ case '3':
2291
+ case '4':
2292
+ case '5':
2293
+ case '6':
2294
+ case '7':
2295
+ case '8':
2296
+ case '9': case 'A':
2297
+ case 'B':
2298
+ case 'C':
2299
+ case 'D':
2300
+ case 'E':
2301
+ case 'F': case 'a':
2302
+ case 'b':
2303
+ case 'c':
2304
+ case 'd':
2305
+ case 'e':
2306
+ case 'f': goto yy201;
2307
+ default: goto yy197;
2308
+ }
2309
+ yy201: ++YYCURSOR;
2310
+ goto yy202;
2311
+ yy202:
2312
+ #line 896 "token.re"
2313
+ { long ch;
2314
+ char *chr_text = syck_strndup( YYTOKTMP, 4 );
2315
+ chr_text[0] = '0';
2316
+ ch = strtol( chr_text, NULL, 16 );
2317
+ free( chr_text );
2318
+ QUOTECAT(qstr, qcapa, qidx, ch);
2319
+ goto TransferMethod2;
2320
+ }
2321
+ #line 2322 "<stdout>"
2322
+ yy203: ++YYCURSOR;
2323
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
2324
+ yych = *YYCURSOR;
2325
+ goto yy204;
2326
+ yy204: switch(yych){
2327
+ case ' ': goto yy203;
2328
+ default: goto yy189;
2329
+ }
2330
+ }
2331
+ #line 910 "token.re"
2332
+
2333
+ }
2334
+
2335
+ ScalarBlock:
2336
+ {
2337
+ int qidx = 0;
2338
+ int qcapa = 100;
2339
+ char *qstr = S_ALLOC_N( char, qcapa );
2340
+ int blockType = 0;
2341
+ int nlDoWhat = 0;
2342
+ int lastIndent = 0;
2343
+ int forceIndent = -1;
2344
+ char *yyt = YYTOKEN;
2345
+ SyckLevel *lvl = CURRENT_LEVEL();
2346
+ int parentIndent = -1;
2347
+
2348
+ switch ( *yyt )
2349
+ {
2350
+ case '|': blockType = BLOCK_LIT; break;
2351
+ case '>': blockType = BLOCK_FOLD; break;
2352
+ }
2353
+
2354
+ while ( ++yyt <= YYCURSOR )
2355
+ {
2356
+ if ( *yyt == '-' )
2357
+ {
2358
+ nlDoWhat = NL_CHOMP;
2359
+ }
2360
+ else if ( *yyt == '+' )
2361
+ {
2362
+ nlDoWhat = NL_KEEP;
2363
+ }
2364
+ else if ( isdigit( (unsigned char)*yyt ) )
2365
+ {
2366
+ forceIndent = rb_long2int(strtol( yyt, NULL, 10 ));
2367
+ }
2368
+ }
2369
+
2370
+ qstr[0] = '\0';
2371
+ YYTOKEN = YYCURSOR;
2372
+
2373
+ ScalarBlock2:
2374
+ YYTOKEN = YYCURSOR;
2375
+
2376
+
2377
+ #line 2378 "<stdout>"
2378
+ {
2379
+ YYCTYPE yych;
2380
+ unsigned int yyaccept;
2381
+ goto yy205;
2382
+ ++YYCURSOR;
2383
+ yy205:
2384
+ if((YYLIMIT - YYCURSOR) < 5) YYFILL(5);
2385
+ yych = *YYCURSOR;
2386
+ switch(yych){
2387
+ case 0x00: goto yy213;
2388
+ case 0x0A: goto yy207;
2389
+ case 0x0D: goto yy209;
2390
+ case '#': goto yy211;
2391
+ case '-': goto yy215;
2392
+ default: goto yy216;
2393
+ }
2394
+ yy207: yyaccept = 0;
2395
+ yych = *(YYMARKER = ++YYCURSOR);
2396
+ goto yy226;
2397
+ yy208:
2398
+ #line 956 "token.re"
2399
+ { char *pacer;
2400
+ char *tok = YYTOKEN;
2401
+ int indt_len = 0, nl_count = 0, fold_nl = 0, nl_begin = 0;
2402
+ GOBBLE_UP_YAML_INDENT( indt_len, tok );
2403
+ lvl = CURRENT_LEVEL();
2404
+
2405
+ if ( lvl->status != syck_lvl_block )
2406
+ {
2407
+ GET_TRUE_YAML_INDENT(parentIndent);
2408
+ if ( forceIndent > 0 ) forceIndent += parentIndent;
2409
+ if ( indt_len > parentIndent )
2410
+ {
2411
+ int new_spaces = forceIndent > 0 ? forceIndent : indt_len;
2412
+ ADD_LEVEL( new_spaces, syck_lvl_block );
2413
+ lastIndent = indt_len - new_spaces;
2414
+ nl_begin = 1;
2415
+ lvl = CURRENT_LEVEL();
2416
+ }
2417
+ else
2418
+ {
2419
+ YYCURSOR = YYTOKEN;
2420
+ RETURN_YAML_BLOCK();
2421
+ }
2422
+ }
2423
+
2424
+ /*
2425
+ * Fold only in the event of two lines being on the leftmost
2426
+ * indentation.
2427
+ */
2428
+ if ( blockType == BLOCK_FOLD && lastIndent == 0 && ( indt_len - lvl->spaces ) == 0 )
2429
+ {
2430
+ fold_nl = 1;
2431
+ }
2432
+
2433
+ pacer = YYTOKEN;
2434
+ while ( pacer < YYCURSOR )
2435
+ {
2436
+ int nl_len = newline_len( pacer++ );
2437
+ if ( nl_len )
2438
+ {
2439
+ nl_count++;
2440
+ pacer += nl_len - 1;
2441
+ }
2442
+ }
2443
+
2444
+ if ( fold_nl == 1 || nl_begin == 1 )
2445
+ {
2446
+ nl_count--;
2447
+ }
2448
+
2449
+ if ( nl_count < 1 && nl_begin == 0 )
2450
+ {
2451
+ QUOTECAT(qstr, qcapa, qidx, ' ');
2452
+ }
2453
+ else
2454
+ {
2455
+ int i;
2456
+ for ( i = 0; i < nl_count; i++ )
2457
+ {
2458
+ QUOTECAT(qstr, qcapa, qidx, '\n');
2459
+ }
2460
+ }
2461
+
2462
+ lastIndent = indt_len - lvl->spaces;
2463
+ YYCURSOR -= lastIndent;
2464
+
2465
+ if ( indt_len < lvl->spaces )
2466
+ {
2467
+ POP_LEVEL();
2468
+ YYCURSOR = YYTOKEN;
2469
+ RETURN_YAML_BLOCK();
2470
+ }
2471
+ goto ScalarBlock2;
2472
+ }
2473
+ #line 2474 "<stdout>"
2474
+ yy209: ++YYCURSOR;
2475
+ switch((yych = *YYCURSOR)) {
2476
+ case 0x0A: goto yy225;
2477
+ default: goto yy210;
2478
+ }
2479
+ yy210:
2480
+ #line 1070 "token.re"
2481
+ { QUOTECAT(qstr, qcapa, qidx, *YYTOKEN);
2482
+ goto ScalarBlock2;
2483
+ }
2484
+ #line 2485 "<stdout>"
2485
+ yy211: ++YYCURSOR;
2486
+ goto yy212;
2487
+ yy212:
2488
+ #line 1032 "token.re"
2489
+ { lvl = CURRENT_LEVEL();
2490
+ if ( lvl->status != syck_lvl_block )
2491
+ {
2492
+ eat_comments( parser );
2493
+ YYTOKEN = YYCURSOR;
2494
+ }
2495
+ else
2496
+ {
2497
+ QUOTECAT(qstr, qcapa, qidx, *YYTOKEN);
2498
+ }
2499
+ goto ScalarBlock2;
2500
+ }
2501
+ #line 2502 "<stdout>"
2502
+ yy213: ++YYCURSOR;
2503
+ goto yy214;
2504
+ yy214:
2505
+ #line 1046 "token.re"
2506
+ { YYCURSOR--;
2507
+ POP_LEVEL();
2508
+ RETURN_YAML_BLOCK();
2509
+ }
2510
+ #line 2511 "<stdout>"
2511
+ yy215: yyaccept = 1;
2512
+ yych = *(YYMARKER = ++YYCURSOR);
2513
+ switch(yych){
2514
+ case '-': goto yy217;
2515
+ default: goto yy210;
2516
+ }
2517
+ yy216: yych = *++YYCURSOR;
2518
+ goto yy210;
2519
+ yy217: yych = *++YYCURSOR;
2520
+ switch(yych){
2521
+ case '-': goto yy219;
2522
+ default: goto yy218;
2523
+ }
2524
+ yy218: YYCURSOR = YYMARKER;
2525
+ switch(yyaccept){
2526
+ case 0: goto yy208;
2527
+ case 1: goto yy210;
2528
+ }
2529
+ yy219: yych = *++YYCURSOR;
2530
+ switch(yych){
2531
+ case 0x0A: goto yy220;
2532
+ case 0x0D: goto yy224;
2533
+ case ' ': goto yy222;
2534
+ default: goto yy218;
2535
+ }
2536
+ yy220: ++YYCURSOR;
2537
+ goto yy221;
2538
+ yy221:
2539
+ #line 1051 "token.re"
2540
+ { if ( YYTOKEN == YYLINEPTR )
2541
+ {
2542
+ if ( blockType == BLOCK_FOLD && qidx > 0 )
2543
+ {
2544
+ qidx -= 1;
2545
+ }
2546
+ QUOTECAT(qstr, qcapa, qidx, '\n');
2547
+ POP_LEVEL();
2548
+ YYCURSOR = YYTOKEN;
2549
+ RETURN_YAML_BLOCK();
2550
+ }
2551
+ else
2552
+ {
2553
+ QUOTECAT(qstr, qcapa, qidx, *YYTOKEN);
2554
+ YYCURSOR = YYTOKEN + 1;
2555
+ goto ScalarBlock2;
2556
+ }
2557
+ }
2558
+ #line 2559 "<stdout>"
2559
+ yy222: ++YYCURSOR;
2560
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
2561
+ yych = *YYCURSOR;
2562
+ goto yy223;
2563
+ yy223: switch(yych){
2564
+ case ' ': goto yy222;
2565
+ default: goto yy221;
2566
+ }
2567
+ yy224: yych = *++YYCURSOR;
2568
+ switch(yych){
2569
+ case 0x0A: goto yy220;
2570
+ default: goto yy218;
2571
+ }
2572
+ yy225: yyaccept = 0;
2573
+ YYMARKER = ++YYCURSOR;
2574
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
2575
+ yych = *YYCURSOR;
2576
+ goto yy226;
2577
+ yy226: switch(yych){
2578
+ case 0x0A: case ' ': goto yy225;
2579
+ case 0x0D: goto yy227;
2580
+ default: goto yy208;
2581
+ }
2582
+ yy227: ++YYCURSOR;
2583
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
2584
+ yych = *YYCURSOR;
2585
+ switch(yych){
2586
+ case 0x0A: goto yy225;
2587
+ default: goto yy218;
2588
+ }
2589
+ }
2590
+ #line 1075 "token.re"
2591
+
2592
+ }
2593
+
2594
+ return 0;
2595
+
2596
+ }
2597
+
2598
+ void
2599
+ eat_comments( SyckParser *parser )
2600
+ {
2601
+ Comment:
2602
+ {
2603
+ YYTOKEN = YYCURSOR;
2604
+
2605
+
2606
+ #line 2607 "<stdout>"
2607
+ {
2608
+ YYCTYPE yych;
2609
+ unsigned int yyaccept;
2610
+ goto yy228;
2611
+ ++YYCURSOR;
2612
+ yy228:
2613
+ if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
2614
+ yych = *YYCURSOR;
2615
+ switch(yych){
2616
+ case 0x00: goto yy230;
2617
+ case 0x0A: goto yy232;
2618
+ case 0x0D: goto yy233;
2619
+ default: goto yy235;
2620
+ }
2621
+ yy230: ++YYCURSOR;
2622
+ goto yy231;
2623
+ yy231:
2624
+ #line 1091 "token.re"
2625
+ { YYCURSOR = YYTOKEN;
2626
+ return;
2627
+ }
2628
+ #line 2629 "<stdout>"
2629
+ yy232: yyaccept = 0;
2630
+ yych = *(YYMARKER = ++YYCURSOR);
2631
+ goto yy237;
2632
+ yy233: ++YYCURSOR;
2633
+ switch((yych = *YYCURSOR)) {
2634
+ case 0x0A: goto yy236;
2635
+ default: goto yy234;
2636
+ }
2637
+ yy234:
2638
+ #line 1095 "token.re"
2639
+ { goto Comment;
2640
+ }
2641
+ #line 2642 "<stdout>"
2642
+ yy235: yych = *++YYCURSOR;
2643
+ goto yy234;
2644
+ yy236: yyaccept = 0;
2645
+ YYMARKER = ++YYCURSOR;
2646
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
2647
+ yych = *YYCURSOR;
2648
+ goto yy237;
2649
+ yy237: switch(yych){
2650
+ case 0x0A: goto yy236;
2651
+ case 0x0D: goto yy238;
2652
+ default: goto yy231;
2653
+ }
2654
+ yy238: ++YYCURSOR;
2655
+ if(YYLIMIT == YYCURSOR) YYFILL(1);
2656
+ yych = *YYCURSOR;
2657
+ switch(yych){
2658
+ case 0x0A: goto yy236;
2659
+ default: goto yy239;
2660
+ }
2661
+ yy239: YYCURSOR = YYMARKER;
2662
+ switch(yyaccept){
2663
+ case 0: goto yy231;
2664
+ }
2665
+ }
2666
+ #line 1098 "token.re"
2667
+
2668
+
2669
+ }
2670
+
2671
+ }
2672
+
2673
+ char
2674
+ escape_seq( char ch )
2675
+ {
2676
+ switch ( ch )
2677
+ {
2678
+ case '0': return '\0';
2679
+ case 'a': return 7;
2680
+ case 'b': return '\010';
2681
+ case 'e': return '\033';
2682
+ case 'f': return '\014';
2683
+ case 'n': return '\n';
2684
+ case 'r': return '\015';
2685
+ case 't': return '\t';
2686
+ case 'v': return '\013';
2687
+ default: return ch;
2688
+ }
2689
+ }
2690
+
2691
+ int
2692
+ is_newline( char *ptr )
2693
+ {
2694
+ return newline_len( ptr );
2695
+ }
2696
+
2697
+ int
2698
+ newline_len( char *ptr )
2699
+ {
2700
+ if ( *ptr == '\n' )
2701
+ return 1;
2702
+
2703
+ if ( *ptr == '\r' && *( ptr + 1 ) == '\n' )
2704
+ return 2;
2705
+
2706
+ return 0;
2707
+ }
2708
+
2709
+ int
2710
+ syckwrap()
2711
+ {
2712
+ return 1;
2713
+ }
2714
+
2715
+ void
2716
+ syckerror( const char *msg )
2717
+ {
2718
+ if ( syck_parser_ptr->error_handler == NULL )
2719
+ syck_parser_ptr->error_handler = syck_default_error_handler;
2720
+
2721
+ syck_parser_ptr->root = syck_parser_ptr->root_on_error;
2722
+ (syck_parser_ptr->error_handler)(syck_parser_ptr, msg);
2723
+ }
2724
+