summaryrefslogtreecommitdiff
path: root/ext/syck/token.c
diff options
context:
space:
mode:
authorwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-05-15 03:11:28 +0000
committerwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-05-15 03:11:28 +0000
commitc474911e5b78749c5a85db39256240db5fb9e3be (patch)
treef333f1c306d07933ceb2f4098b8aefde5d34d29e /ext/syck/token.c
parent094290e68fd4dfed851e8f7254d60a1301fe97e2 (diff)
* lib/yaml.rb: removed fallback to pure Ruby parser.
* lib/yaml/baseemitter.rb (node_text): rewriting folded scalars. * ext/syck/syck.h: reports style of scalars now, be they plain, block single-, or double-quoted. * ext/syck/syck.c: ditto. * ext/syck/gram.c: ditto. * ext/syck/node.c: ditto. * ext/syck/token.c: ditto. * ext/syck/rubyext.c (yaml_org_handler): symbols loaded only if scalar style is plain. * test/yaml/test_yaml.rb (test_perl_regexp): updated test to match new regexp serialization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/syck/token.c')
-rw-r--r--ext/syck/token.c132
1 files changed, 68 insertions, 64 deletions
diff --git a/ext/syck/token.c b/ext/syck/token.c
index 5874c27c8f9..ac9986f5645 100644
--- a/ext/syck/token.c
+++ b/ext/syck/token.c
@@ -1,4 +1,4 @@
-/* Generated by re2c 0.5 on Tue Nov 25 12:10:28 2003 */
+/* Generated by re2c 0.5 on Thu May 13 01:45:26 2004 */
#line 1 "token.re"
/*
* token.re
@@ -122,6 +122,7 @@
YYCURSOR = YYTOKEN; \
n->data.str->ptr = qstr; \
n->data.str->len = qidx; \
+ n->data.str->style = scalar_plain; \
sycklval->nodeData = n; \
if ( parser->implicit_typing == 1 ) \
{ \
@@ -140,6 +141,7 @@
n->type_id = syck_strndup( "str", 3 ); \
n->data.str->ptr = qstr; \
n->data.str->len = qidx; \
+ n->data.str->style = scalar_block; \
if ( qidx > 0 ) \
{ \
if ( nlDoWhat != NL_KEEP ) \
@@ -257,7 +259,7 @@ sycklex_yaml_utf8( YYSTYPE *sycklval, SyckParser *parser )
return t;
}
-#line 276
+#line 278
if ( YYLINEPTR != YYCURSOR )
@@ -294,7 +296,7 @@ yy2: yyaccept = 0;
default: goto yy3;
}
yy3:
-#line 335
+#line 337
{ YYPOS(0);
goto Document;
}
@@ -306,13 +308,13 @@ yy4: yyaccept = 0;
}
yy5: yych = *++YYCURSOR;
yy6:
-#line 317
+#line 319
{ eat_comments( parser );
goto Header;
}
yy7: yych = *++YYCURSOR;
yy8:
-#line 321
+#line 323
{ SyckLevel *lvl = CURRENT_LEVEL();
ENSURE_YAML_IEND(lvl, -1);
YYPOS(0);
@@ -322,7 +324,7 @@ yy9: yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
goto yy18;
yy10:
-#line 327
+#line 329
{ GOBBLE_UP_YAML_INDENT( doc_level, YYTOKEN );
goto Header;
}
@@ -334,7 +336,7 @@ yy11: yych = *++YYCURSOR;
yy12: yych = *++YYCURSOR;
goto yy16;
yy13:
-#line 331
+#line 333
{ doc_level = YYCURSOR - YYLINEPTR;
goto Header;
}
@@ -382,7 +384,7 @@ yy22: yych = *++YYCURSOR;
}
yy23: yych = *++YYCURSOR;
yy24:
-#line 303
+#line 305
{ SyckLevel *lvl = CURRENT_LEVEL();
if ( lvl->status == syck_lvl_header )
{
@@ -422,7 +424,7 @@ yy29: yych = *++YYCURSOR;
}
yy30: yych = *++YYCURSOR;
yy31:
-#line 289
+#line 291
{ SyckLevel *lvl = CURRENT_LEVEL();
if ( lvl->status == syck_lvl_header )
{
@@ -449,7 +451,7 @@ yy34: yych = *++YYCURSOR;
default: goto yy20;
}
}
-#line 339
+#line 341
Document:
@@ -492,7 +494,7 @@ yy37: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy90;
yy38:
-#line 353
+#line 355
{ /* Isolate spaces */
int indt_len;
GOBBLE_UP_YAML_INDENT( indt_len, YYTOKEN );
@@ -520,13 +522,13 @@ yy39: yych = *++YYCURSOR;
default: goto yy40;
}
yy40:
-#line 445
+#line 447
{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
goto Plain;
}
yy41: yych = *++YYCURSOR;
yy42:
-#line 375
+#line 377
{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
lvl = CURRENT_LEVEL();
ADD_LEVEL(lvl->spaces + 1, syck_lvl_inline);
@@ -534,7 +536,7 @@ yy42:
}
yy43: yych = *++YYCURSOR;
yy44:
-#line 381
+#line 383
{ POP_LEVEL();
return YYTOKEN[0];
}
@@ -684,16 +686,16 @@ yy48: yych = *++YYCURSOR;
}
yy49: yych = *++YYCURSOR;
yy50:
-#line 419
+#line 421
{ goto TransferMethod; }
yy51: yych = *++YYCURSOR;
yy52:
-#line 421
+#line 423
{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
goto SingleQuote; }
yy53: yych = *++YYCURSOR;
yy54:
-#line 424
+#line 426
{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
goto DoubleQuote; }
yy55: yyaccept = 1;
@@ -716,18 +718,18 @@ yy55: yyaccept = 1;
}
yy56: yych = *++YYCURSOR;
yy57:
-#line 434
+#line 436
{ eat_comments( parser );
goto Document;
}
yy58: yych = *++YYCURSOR;
goto yy64;
yy59:
-#line 438
+#line 440
{ goto Document; }
yy60: yych = *++YYCURSOR;
yy61:
-#line 440
+#line 442
{ ENSURE_YAML_IEND(lvl, -1);
YYPOS(0);
return 0;
@@ -767,7 +769,7 @@ yy67: YYCURSOR = YYMARKER;
}
yy68: yych = *++YYCURSOR;
yy69:
-#line 427
+#line 429
{ if ( is_newline( YYCURSOR - 1 ) )
{
YYCURSOR--;
@@ -853,7 +855,7 @@ yy74: switch(yych){
default: goto yy75;
}
yy75:
-#line 414
+#line 416
{ ENSURE_YAML_IOPEN(lvl, doc_level, 1);
sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
return YAML_ALIAS;
@@ -925,7 +927,7 @@ yy77: switch(yych){
default: goto yy78;
}
yy78:
-#line 403
+#line 405
{ sycklval->name = syck_strndup( YYTOKEN + 1, YYCURSOR - YYTOKEN - 1 );
/*
@@ -938,7 +940,7 @@ yy78:
}
yy79: yych = *++YYCURSOR;
yy80:
-#line 389
+#line 391
{ ENSURE_YAML_IOPEN(lvl, YYTOKEN - YYLINEPTR, 1);
FORCE_NEXT_TOKEN(YAML_IOPEN);
if ( is_newline( YYCURSOR ) || is_newline( YYCURSOR - 1 ) )
@@ -966,7 +968,7 @@ yy83: yych = *++YYCURSOR;
}
yy84: yych = *++YYCURSOR;
yy85:
-#line 385
+#line 387
{ YYPOS(1);
return YYTOKEN[0];
}
@@ -999,7 +1001,7 @@ yy91: ++YYCURSOR;
default: goto yy67;
}
}
-#line 449
+#line 451
}
@@ -1106,14 +1108,14 @@ yy95: yyaccept = 0;
default: goto yy96;
}
yy96:
-#line 462
+#line 464
{ YYCURSOR = YYTOKTMP;
return YAML_DOCSEP;
}
yy97: yych = *++YYCURSOR;
goto yy101;
yy98:
-#line 460
+#line 462
{ goto Directive; }
yy99: yych = *++YYCURSOR;
goto yy96;
@@ -1365,10 +1367,10 @@ yy106: switch(yych){
default: goto yy107;
}
yy107:
-#line 458
+#line 460
{ goto Directive; }
}
-#line 465
+#line 467
}
@@ -1412,7 +1414,7 @@ yy110: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy136;
yy111:
-#line 488
+#line 490
{ int indt_len, nl_count = 0;
SyckLevel *lvl;
char *tok = YYTOKEN;
@@ -1450,7 +1452,7 @@ yy112: yych = *++YYCURSOR;
default: goto yy113;
}
yy113:
-#line 542
+#line 544
{ QUOTECATS(qstr, qcapa, qidx, YYTOKEN, YYCURSOR - YYTOKEN);
goto Plain2;
}
@@ -1464,7 +1466,7 @@ yy114: yyaccept = 1;
}
yy115: yych = *++YYCURSOR;
yy116:
-#line 522
+#line 524
{ if ( plvl->status != syck_lvl_inline )
{
if ( *(YYCURSOR - 1) == ' ' || is_newline( YYCURSOR - 1 ) )
@@ -1490,17 +1492,17 @@ yy118: yych = *++YYCURSOR;
default: goto yy119;
}
yy119:
-#line 540
+#line 542
{ goto Plain3; }
yy120: yych = *++YYCURSOR;
yy121:
-#line 538
+#line 540
{ RETURN_IMPLICIT(); }
yy122: yych = *++YYCURSOR;
goto yy113;
yy123: yych = *++YYCURSOR;
yy124:
-#line 534
+#line 536
{ eat_comments( parser );
RETURN_IMPLICIT();
}
@@ -1525,7 +1527,7 @@ yy129: YYCURSOR = YYMARKER;
}
yy130: yych = *++YYCURSOR;
yy131:
-#line 520
+#line 522
{ RETURN_IMPLICIT(); }
yy132: ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
@@ -1556,7 +1558,7 @@ yy137: ++YYCURSOR;
default: goto yy129;
}
}
-#line 546
+#line 548
}
@@ -1588,7 +1590,7 @@ yy140: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy151;
yy141:
-#line 560
+#line 562
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1630,7 +1632,7 @@ yy142: yych = *++YYCURSOR;
default: goto yy143;
}
yy143:
-#line 615
+#line 618
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto SingleQuote2;
}
@@ -1640,7 +1642,7 @@ yy144: yych = *++YYCURSOR;
default: goto yy145;
}
yy145:
-#line 600
+#line 602
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -1652,6 +1654,7 @@ yy145:
n->type_id = syck_strndup( "str", 3 );
n->data.str->ptr = qstr;
n->data.str->len = qidx;
+ n->data.str->style = scalar_1quote;
sycklval->nodeData = n;
return YAML_PLAIN;
}
@@ -1661,7 +1664,7 @@ yy147: yych = *++YYCURSOR;
goto yy143;
yy148: yych = *++YYCURSOR;
yy149:
-#line 596
+#line 598
{ QUOTECAT(qstr, qcapa, qidx, '\'');
goto SingleQuote2;
}
@@ -1686,7 +1689,7 @@ yy153: YYCURSOR = YYMARKER;
case 0: goto yy141;
}
}
-#line 619
+#line 622
}
@@ -1723,7 +1726,7 @@ yy156: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy178;
yy157:
-#line 637
+#line 640
{ int indt_len;
int nl_count = 0;
SyckLevel *lvl;
@@ -1769,7 +1772,7 @@ yy158: yych = *++YYCURSOR;
default: goto yy159;
}
yy159:
-#line 711
+#line 715
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto DoubleQuote2;
}
@@ -1787,7 +1790,7 @@ yy160: yyaccept = 1;
}
yy161: yych = *++YYCURSOR;
yy162:
-#line 696
+#line 699
{ SyckLevel *lvl;
SyckNode *n = syck_alloc_str();
lvl = CURRENT_LEVEL();
@@ -1799,6 +1802,7 @@ yy162:
n->type_id = syck_strndup( "str", 3 );
n->data.str->ptr = qstr;
n->data.str->len = qidx;
+ n->data.str->style = scalar_2quote;
sycklval->nodeData = n;
return YAML_PLAIN;
}
@@ -1822,7 +1826,7 @@ yy167: YYCURSOR = YYMARKER;
}
yy168: yych = *++YYCURSOR;
yy169:
-#line 691
+#line 694
{ keep_nl = 0;
YYCURSOR--;
goto DoubleQuote2;
@@ -1858,7 +1862,7 @@ yy171: yych = *++YYCURSOR;
}
yy172: yych = *++YYCURSOR;
yy173:
-#line 677
+#line 680
{ char ch = *( YYCURSOR - 1 );
QUOTECAT(qstr, qcapa, qidx, escape_seq( ch ));
goto DoubleQuote2;
@@ -1889,7 +1893,7 @@ yy174: yych = *++YYCURSOR;
}
yy175: yych = *++YYCURSOR;
yy176:
-#line 682
+#line 685
{ long ch;
char *chr_text = syck_strndup( YYTOKEN, 4 );
chr_text[0] = '0';
@@ -1915,7 +1919,7 @@ yy179: ++YYCURSOR;
default: goto yy167;
}
}
-#line 715
+#line 719
}
@@ -1950,7 +1954,7 @@ yy182: YYCURSOR = YYMARKER;
}
yy183: yych = *++YYCURSOR;
yy184:
-#line 729
+#line 733
{ SyckLevel *lvl;
YYCURSOR = YYTOKTMP;
if ( YYCURSOR == YYTOKEN + 1 )
@@ -2008,7 +2012,7 @@ yy186: yych = *++YYCURSOR;
default: goto yy187;
}
yy187:
-#line 796
+#line 800
{ QUOTECAT(qstr, qcapa, qidx, *(YYCURSOR - 1));
goto TransferMethod2;
}
@@ -2049,7 +2053,7 @@ yy190: yych = *++YYCURSOR;
}
yy191: yych = *++YYCURSOR;
yy192:
-#line 782
+#line 786
{ char ch = *( YYCURSOR - 1 );
QUOTECAT(qstr, qcapa, qidx, escape_seq( ch ));
goto TransferMethod2;
@@ -2080,7 +2084,7 @@ yy193: yych = *++YYCURSOR;
}
yy194: yych = *++YYCURSOR;
yy195:
-#line 787
+#line 791
{ long ch;
char *chr_text = syck_strndup( YYTOKTMP, 4 );
chr_text[0] = '0';
@@ -2099,7 +2103,7 @@ yy198: switch(yych){
default: goto yy184;
}
}
-#line 801
+#line 805
}
@@ -2165,7 +2169,7 @@ yy201: yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
goto yy220;
yy202:
-#line 848
+#line 852
{ char *pacer;
char *tok = YYTOKEN;
int indt_len = 0, nl_count = 0, fold_nl = 0, nl_begin = 0;
@@ -2237,13 +2241,13 @@ yy203: yych = *++YYCURSOR;
default: goto yy204;
}
yy204:
-#line 953
+#line 957
{ QUOTECAT(qstr, qcapa, qidx, *YYTOKEN);
goto ScalarBlock2;
}
yy205: yych = *++YYCURSOR;
yy206:
-#line 915
+#line 919
{ lvl = CURRENT_LEVEL();
if ( lvl->status != syck_lvl_block )
{
@@ -2258,7 +2262,7 @@ yy206:
}
yy207: yych = *++YYCURSOR;
yy208:
-#line 929
+#line 933
{ YYCURSOR--;
POP_LEVEL();
RETURN_YAML_BLOCK();
@@ -2290,7 +2294,7 @@ yy213: yych = *++YYCURSOR;
}
yy214: yych = *++YYCURSOR;
yy215:
-#line 934
+#line 938
{ if ( YYTOKEN == YYLINEPTR )
{
if ( blockType == BLOCK_FOLD )
@@ -2338,7 +2342,7 @@ yy221: ++YYCURSOR;
default: goto yy212;
}
}
-#line 958
+#line 962
}
@@ -2369,7 +2373,7 @@ yy222:
}
yy224: yych = *++YYCURSOR;
yy225:
-#line 974
+#line 978
{ YYCURSOR = YYTOKEN;
return;
}
@@ -2382,7 +2386,7 @@ yy227: yych = *++YYCURSOR;
default: goto yy228;
}
yy228:
-#line 978
+#line 982
{ goto Comment;
}
yy229: yych = *++YYCURSOR;
@@ -2408,7 +2412,7 @@ yy233: YYCURSOR = YYMARKER;
case 0: goto yy225;
}
}
-#line 981
+#line 985
}