diff options
author | why <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-20 06:50:20 +0000 |
---|---|---|
committer | why <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-09-20 06:50:20 +0000 |
commit | d578f9d32e4c13df9ebf51873ae335c5e5a795ce (patch) | |
tree | defcbbf25c171d2ef655ea1e0e2df426491ab91e /ext/syck/bytecode.c | |
parent | 34b3f481dc2e92aaf477f4ec49a0b3bf0274bbf1 (diff) |
* ext/syck/emitter.c (syck_scan_scalar): prevent indicators from
appearing alone or at the end of plain scalars. [ruby-core:5826]
* ext/syck/emitter.c (syck_emit_scalar): treat typed scalar nodes
as complex keys.
* lib/syck.h: version 0.60.
* lib/yaml/basenode.rb (YAML::BaseNode#at): transform keys during
key searches.
* ext/syck/rubyext.c: loading of binary-typed nodes. prevent
emission of plain strings that look like symbols, but which aren't.
* ext/syck/emitter.c (syck_emit): passing an int* value to the
long* parameter causes unaligned access on LP64 systems.
[ruby-dev:27161]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/syck/bytecode.c')
-rw-r--r-- | ext/syck/bytecode.c | 233 |
1 files changed, 114 insertions, 119 deletions
diff --git a/ext/syck/bytecode.c b/ext/syck/bytecode.c index bae1f4f45e..567aaf52a8 100644 --- a/ext/syck/bytecode.c +++ b/ext/syck/bytecode.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.9.3 on Tue Apr 12 20:34:14 2005 */ +/* Generated by re2c 0.9.10 on Mon Sep 19 23:21:26 2005 */ #line 1 "bytecode.re" /* * bytecode.re @@ -135,7 +135,6 @@ int sycklex_bytecode_utf8( YYSTYPE *sycklval, SyckParser *parser ) { SyckLevel *lvl; - int doc_level = 0; syck_parser_ptr = parser; if ( YYCURSOR == NULL ) { @@ -149,7 +148,7 @@ sycklex_bytecode_utf8( YYSTYPE *sycklval, SyckParser *parser ) return t; } -#line 173 "bytecode.re" +#line 172 "bytecode.re" lvl = CURRENT_LEVEL(); @@ -158,22 +157,22 @@ sycklex_bytecode_utf8( YYSTYPE *sycklval, SyckParser *parser ) goto Document; } -Header: +/* Header: */ YYTOKEN = YYCURSOR; -#line 7 "<stdout>" +#line 165 "<stdout>" { YYCTYPE yych; unsigned int yyaccept; goto yy0; -yy1: ++YYCURSOR; + ++YYCURSOR; yy0: if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; switch(yych){ - case '\000': goto yy2; + case 0x00: goto yy2; case 'D': goto yy3; default: goto yy5; } @@ -184,22 +183,22 @@ yy2: YYCURSOR = YYMARKER; yy3: yyaccept = 0; yych = *(YYMARKER = ++YYCURSOR); switch(yych){ - case '\n': goto yy6; - case '\r': goto yy8; + case 0x0A: goto yy6; + case 0x0D: goto yy8; default: goto yy4; } yy4: -#line 200 "bytecode.re" +#line 199 "bytecode.re" { YYPOS(0); goto Document; } -#line 37 "<stdout>" +#line 195 "<stdout>" yy5: yych = *++YYCURSOR; goto yy4; yy6: ++YYCURSOR; goto yy7; yy7: -#line 187 "bytecode.re" +#line 186 "bytecode.re" { if ( lvl->status == syck_lvl_header ) { CHK_NL(YYCURSOR); @@ -212,14 +211,14 @@ yy7: return 0; } } -#line 56 "<stdout>" +#line 214 "<stdout>" yy8: ++YYCURSOR; switch((yych = *YYCURSOR)) { - case '\n': goto yy6; + case 0x0A: goto yy6; default: goto yy2; } } -#line 204 "bytecode.re" +#line 203 "bytecode.re" Document: @@ -233,19 +232,18 @@ Document: YYTOKEN = YYCURSOR; -#line 65 "<stdout>" +#line 235 "<stdout>" { YYCTYPE yych; - unsigned int yyaccept; goto yy9; -yy10: ++YYCURSOR; + ++YYCURSOR; yy9: if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; switch(yych){ - case '\000': goto yy30; - case '\n': goto yy27; - case '\r': goto yy29; + case 0x00: goto yy30; + case 0x0A: goto yy27; + case 0x0D: goto yy29; case 'A': goto yy19; case 'D': goto yy12; case 'E': goto yy16; @@ -260,68 +258,68 @@ yy9: } yy11:yy12: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy41; - case '\r': goto yy44; + case 0x0A: goto yy41; + case 0x0D: goto yy44; default: goto yy11; } yy13: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy41; - case '\r': goto yy43; + case 0x0A: goto yy41; + case 0x0D: goto yy43; default: goto yy11; } yy14: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy38; - case '\r': goto yy40; + case 0x0A: goto yy38; + case 0x0D: goto yy40; default: goto yy11; } yy15: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy35; - case '\r': goto yy37; + case 0x0A: goto yy35; + case 0x0D: goto yy37; default: goto yy11; } yy16: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy32; - case '\r': goto yy34; + case 0x0A: goto yy32; + case 0x0D: goto yy34; default: goto yy11; } yy17: ++YYCURSOR; goto yy18; yy18: -#line 289 "bytecode.re" +#line 288 "bytecode.re" { ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_str); goto Scalar; } -#line 127 "<stdout>" +#line 296 "<stdout>" yy19: ++YYCURSOR; goto yy20; yy20: -#line 293 "bytecode.re" +#line 292 "bytecode.re" { ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_open); sycklval->name = get_inline( parser ); syck_hdlr_remove_anchor( parser, sycklval->name ); CHK_NL(YYCURSOR); return YAML_ANCHOR; } -#line 138 "<stdout>" +#line 307 "<stdout>" yy21: ++YYCURSOR; goto yy22; yy22: -#line 300 "bytecode.re" +#line 299 "bytecode.re" { ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_str); sycklval->name = get_inline( parser ); POP_LEVEL(); if ( *( YYCURSOR - 1 ) == '\n' ) YYCURSOR--; return YAML_ALIAS; } -#line 149 "<stdout>" +#line 318 "<stdout>" yy23: ++YYCURSOR; goto yy24; yy24: -#line 307 "bytecode.re" +#line 306 "bytecode.re" { char *qstr; ADD_BYTE_LEVEL(lvl, lvl->spaces + 1, syck_lvl_open); qstr = get_inline( parser ); @@ -381,17 +379,17 @@ yy24: sycklval->name = qstr; return YAML_TAGURI; } -#line 213 "<stdout>" +#line 382 "<stdout>" yy25: ++YYCURSOR; goto yy26; yy26: -#line 367 "bytecode.re" +#line 366 "bytecode.re" { goto Comment; } -#line 219 "<stdout>" +#line 388 "<stdout>" yy27: ++YYCURSOR; goto yy28; yy28: -#line 369 "bytecode.re" +#line 368 "bytecode.re" { CHK_NL(YYCURSOR); if ( lvl->status == syck_lvl_seq ) { @@ -404,25 +402,25 @@ yy28: } goto Document; } -#line 236 "<stdout>" +#line 405 "<stdout>" yy29: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy27; + case 0x0A: goto yy27; default: goto yy11; } yy30: ++YYCURSOR; goto yy31; yy31: -#line 382 "bytecode.re" +#line 381 "bytecode.re" { ENSURE_YAML_IEND(lvl, -1); YYPOS(0); return 0; } -#line 250 "<stdout>" +#line 419 "<stdout>" yy32: ++YYCURSOR; goto yy33; yy33: -#line 253 "bytecode.re" +#line 252 "bytecode.re" { if ( lvl->status == syck_lvl_seq && lvl->ncount == 0 ) { lvl->ncount++; @@ -458,16 +456,16 @@ yy33: CHK_NL(YYCURSOR); return YAML_IEND; } -#line 290 "<stdout>" +#line 459 "<stdout>" yy34: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy32; + case 0x0A: goto yy32; default: goto yy11; } yy35: ++YYCURSOR; goto yy36; yy36: -#line 238 "bytecode.re" +#line 237 "bytecode.re" { int complex = 0; if ( lvl->ncount % 2 == 0 && ( lvl->status == syck_lvl_map || lvl->status == syck_lvl_seq ) ) { @@ -482,16 +480,16 @@ yy36: } return YAML_IOPEN; } -#line 314 "<stdout>" +#line 483 "<stdout>" yy37: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy35; + case 0x0A: goto yy35; default: goto yy11; } yy38: ++YYCURSOR; goto yy39; yy39: -#line 223 "bytecode.re" +#line 222 "bytecode.re" { int complex = 0; if ( lvl->ncount % 2 == 0 && ( lvl->status == syck_lvl_map || lvl->status == syck_lvl_seq ) ) { @@ -506,33 +504,33 @@ yy39: } return YAML_IOPEN; } -#line 338 "<stdout>" +#line 507 "<stdout>" yy40: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy38; + case 0x0A: goto yy38; default: goto yy11; } yy41: ++YYCURSOR; goto yy42; yy42: -#line 218 "bytecode.re" +#line 217 "bytecode.re" { ENSURE_YAML_IEND(lvl, -1); YYPOS(0); return 0; } -#line 352 "<stdout>" +#line 521 "<stdout>" yy43: yych = *++YYCURSOR; switch(yych){ - case '\n': goto yy41; + case 0x0A: goto yy41; default: goto yy11; } yy44: ++YYCURSOR; switch((yych = *YYCURSOR)) { - case '\n': goto yy41; + case 0x0A: goto yy41; default: goto yy11; } } -#line 387 "bytecode.re" +#line 386 "bytecode.re" } @@ -542,17 +540,17 @@ Directive: YYTOKEN = YYCURSOR; -#line 366 "<stdout>" +#line 543 "<stdout>" { YYCTYPE yych; unsigned int yyaccept; goto yy45; -yy46: ++YYCURSOR; + ++YYCURSOR; yy45: if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; switch(yych){ - case '\000': goto yy47; + case 0x00: goto yy47; case 'V': goto yy48; default: goto yy50; } @@ -641,15 +639,15 @@ yy48: yyaccept = 0; default: goto yy49; } yy49: -#line 400 "bytecode.re" +#line 399 "bytecode.re" { YYCURSOR = YYTOKEN; return YAML_DOCSEP; } -#line 469 "<stdout>" +#line 646 "<stdout>" yy50: yych = *++YYCURSOR; goto yy49; yy51: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; goto yy52; yy52: switch(yych){ @@ -809,12 +807,12 @@ yy53: yych = *++YYCURSOR; default: goto yy47; } yy54: ++YYCURSOR; - if(YYLIMIT == YYCURSOR) YYFILL(1); + if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; goto yy55; yy55: switch(yych){ - case '\n': goto yy56; - case '\r': goto yy58; + case 0x0A: goto yy56; + case 0x0D: goto yy58; case '.': case '/': case '0': @@ -895,17 +893,17 @@ yy55: switch(yych){ yy56: ++YYCURSOR; goto yy57; yy57: -#line 397 "bytecode.re" +#line 396 "bytecode.re" { CHK_NL(YYCURSOR); goto Directive; } -#line 724 "<stdout>" +#line 899 "<stdout>" yy58: ++YYCURSOR; switch((yych = *YYCURSOR)) { - case '\n': goto yy56; + case 0x0A: goto yy56; default: goto yy47; } } -#line 403 "bytecode.re" +#line 402 "bytecode.re" } @@ -915,44 +913,43 @@ Comment: YYTOKEN = YYCURSOR; -#line 733 "<stdout>" +#line 916 "<stdout>" { YYCTYPE yych; - unsigned int yyaccept; goto yy59; -yy60: ++YYCURSOR; + ++YYCURSOR; yy59: if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; switch(yych){ - case '\000': goto yy61; - case '\n': goto yy62; - case '\r': goto yy64; + case 0x00: goto yy61; + case 0x0A: goto yy62; + case 0x0D: goto yy64; default: goto yy66; } yy61:yy62: ++YYCURSOR; goto yy63; yy63: -#line 413 "bytecode.re" +#line 412 "bytecode.re" { CHK_NL(YYCURSOR); goto Document; } -#line 754 "<stdout>" +#line 936 "<stdout>" yy64: ++YYCURSOR; switch((yych = *YYCURSOR)) { - case '\n': goto yy67; + case 0x0A: goto yy67; default: goto yy65; } yy65: -#line 416 "bytecode.re" +#line 415 "bytecode.re" { goto Comment; } -#line 763 "<stdout>" +#line 945 "<stdout>" yy66: yych = *++YYCURSOR; goto yy65; yy67: ++YYCURSOR; yych = *YYCURSOR; goto yy63; } -#line 418 "bytecode.re" +#line 417 "bytecode.re" } @@ -970,19 +967,18 @@ Scalar2: tok = YYCURSOR; -#line 771 "<stdout>" +#line 970 "<stdout>" { YYCTYPE yych; - unsigned int yyaccept; goto yy68; -yy69: ++YYCURSOR; + ++YYCURSOR; yy68: if((YYLIMIT - YYCURSOR) < 3) YYFILL(3); yych = *YYCURSOR; switch(yych){ - case '\000': goto yy74; - case '\n': goto yy70; - case '\r': goto yy72; + case 0x00: goto yy74; + case 0x0A: goto yy70; + case 0x0D: goto yy72; default: goto yy76; } yy70: ++YYCURSOR; @@ -993,30 +989,30 @@ yy70: ++YYCURSOR; default: goto yy71; } yy71: -#line 462 "bytecode.re" +#line 461 "bytecode.re" { YYCURSOR = tok; goto ScalarEnd; } -#line 798 "<stdout>" +#line 996 "<stdout>" yy72: ++YYCURSOR; switch((yych = *YYCURSOR)) { - case '\n': goto yy77; + case 0x0A: goto yy77; default: goto yy73; } yy73: -#line 470 "bytecode.re" +#line 469 "bytecode.re" { CAT(str, cap, idx, tok[0]); goto Scalar2; } -#line 809 "<stdout>" +#line 1007 "<stdout>" yy74: ++YYCURSOR; goto yy75; yy75: -#line 466 "bytecode.re" +#line 465 "bytecode.re" { YYCURSOR = tok; goto ScalarEnd; } -#line 817 "<stdout>" +#line 1015 "<stdout>" yy76: yych = *++YYCURSOR; goto yy73; yy77: yych = *++YYCURSOR; @@ -1029,10 +1025,10 @@ yy77: yych = *++YYCURSOR; yy78: ++YYCURSOR; goto yy79; yy79: -#line 436 "bytecode.re" +#line 435 "bytecode.re" { CHK_NL(tok+1); goto Scalar2; } -#line 833 "<stdout>" +#line 1031 "<stdout>" yy80: ++YYCURSOR; if(YYLIMIT == YYCURSOR) YYFILL(1); yych = *YYCURSOR; @@ -1051,7 +1047,7 @@ yy81: switch(yych){ default: goto yy82; } yy82: -#line 439 "bytecode.re" +#line 438 "bytecode.re" { CHK_NL(tok+1); if ( tok + 2 < YYCURSOR ) { @@ -1069,18 +1065,18 @@ yy82: } goto Scalar2; } -#line 871 "<stdout>" +#line 1068 "<stdout>" yy83: ++YYCURSOR; goto yy84; yy84: -#line 457 "bytecode.re" +#line 456 "bytecode.re" { CHK_NL(tok+1); CAT(str, cap, idx, '\0'); goto Scalar2; } -#line 880 "<stdout>" +#line 1077 "<stdout>" } -#line 474 "bytecode.re" +#line 473 "bytecode.re" ScalarEnd: @@ -1115,54 +1111,53 @@ Inline: tok = YYCURSOR; -#line 884 "<stdout>" +#line 1114 "<stdout>" { YYCTYPE yych; - unsigned int yyaccept; goto yy85; -yy86: ++YYCURSOR; + ++YYCURSOR; yy85: if((YYLIMIT - YYCURSOR) < 2) YYFILL(2); yych = *YYCURSOR; switch(yych){ - case '\000': goto yy91; - case '\n': goto yy87; - case '\r': goto yy89; + case 0x00: goto yy91; + case 0x0A: goto yy87; + case 0x0D: goto yy89; default: goto yy93; } yy87: ++YYCURSOR; goto yy88; yy88: -#line 509 "bytecode.re" +#line 508 "bytecode.re" { CHK_NL(YYCURSOR); return str; } -#line 905 "<stdout>" +#line 1134 "<stdout>" yy89: ++YYCURSOR; switch((yych = *YYCURSOR)) { - case '\n': goto yy94; + case 0x0A: goto yy94; default: goto yy90; } yy90: -#line 516 "bytecode.re" +#line 515 "bytecode.re" { CAT(str, cap, idx, tok[0]); goto Inline; } -#line 916 "<stdout>" +#line 1145 "<stdout>" yy91: ++YYCURSOR; goto yy92; yy92: -#line 512 "bytecode.re" +#line 511 "bytecode.re" { YYCURSOR = tok; return str; } -#line 924 "<stdout>" +#line 1153 "<stdout>" yy93: yych = *++YYCURSOR; goto yy90; yy94: ++YYCURSOR; yych = *YYCURSOR; goto yy88; } -#line 520 "bytecode.re" +#line 519 "bytecode.re" } |