diff options
Diffstat (limited to 'ext/syck/implicit.c')
-rw-r--r-- | ext/syck/implicit.c | 83 |
1 files changed, 54 insertions, 29 deletions
diff --git a/ext/syck/implicit.c b/ext/syck/implicit.c index 66f0520233..cce7a9f4e3 100644 --- a/ext/syck/implicit.c +++ b/ext/syck/implicit.c @@ -1,4 +1,4 @@ -/* Generated by re2c 0.9.3 on Fri Aug 13 11:47:51 2004 */ +/* Generated by re2c 0.9.3 on Wed Mar 30 08:27:25 2005 */ #line 1 "implicit.re" /* * implicit.re @@ -36,6 +36,7 @@ try_tag_implicit( SyckNode *n, int taguri ) tid = "map"; break; } + if ( n->type_id != NULL ) S_FREE( n->type_id ); if ( taguri == 1 ) { n->type_id = syck_taguri( YAML_DOMAIN, tid, strlen( tid ) ); @@ -94,7 +95,7 @@ yy2: ++YYCURSOR; if((yych = *YYCURSOR) <= '\000') goto yy6; goto yy3; yy3: -#line 122 "implicit.re" +#line 123 "implicit.re" { return "str"; } #line 51 "<stdout>" yy4: yyaccept = 0; @@ -115,7 +116,7 @@ yy5: yyaccept = 0; yy6: ++YYCURSOR; goto yy7; yy7: -#line 84 "implicit.re" +#line 85 "implicit.re" { return "null"; } #line 72 "<stdout>" yy8: yyaccept = 0; @@ -273,13 +274,13 @@ yy25: YYCURSOR = YYMARKER; yy26: ++YYCURSOR; goto yy27; yy27: -#line 120 "implicit.re" +#line 121 "implicit.re" { return "merge"; } #line 230 "<stdout>" yy28: ++YYCURSOR; goto yy29; yy29: -#line 118 "implicit.re" +#line 119 "implicit.re" { return "default"; } #line 236 "<stdout>" yy30: yych = *++YYCURSOR; @@ -320,7 +321,7 @@ yy36: yych = *++YYCURSOR; yy37: ++YYCURSOR; goto yy38; yy38: -#line 104 "implicit.re" +#line 105 "implicit.re" { return "float#inf"; } #line 277 "<stdout>" yy39: yych = *++YYCURSOR; @@ -344,7 +345,7 @@ yy42: yych = *++YYCURSOR; yy43: ++YYCURSOR; goto yy44; yy44: -#line 108 "implicit.re" +#line 109 "implicit.re" { return "float#nan"; } #line 301 "<stdout>" yy45: yych = *++YYCURSOR; @@ -426,7 +427,7 @@ yy51: switch(yych){ yy52: ++YYCURSOR; goto yy53; yy53: -#line 96 "implicit.re" +#line 97 "implicit.re" { return "int"; } #line 386 "<stdout>" yy54: ++YYCURSOR; @@ -450,7 +451,7 @@ yy55: switch(yych){ yy56: ++YYCURSOR; goto yy57; yy57: -#line 98 "implicit.re" +#line 99 "implicit.re" { return "float#fix"; } #line 411 "<stdout>" yy58: ++YYCURSOR; @@ -500,7 +501,7 @@ yy63: switch(yych){ yy64: ++YYCURSOR; goto yy65; yy65: -#line 100 "implicit.re" +#line 101 "implicit.re" { return "float#exp"; } #line 463 "<stdout>" yy66: ++YYCURSOR; @@ -552,13 +553,13 @@ yy69: switch(yych){ yy70: ++YYCURSOR; goto yy71; yy71: -#line 94 "implicit.re" +#line 95 "implicit.re" { return "int#base60"; } #line 518 "<stdout>" yy72: ++YYCURSOR; goto yy73; yy73: -#line 102 "implicit.re" +#line 103 "implicit.re" { return "float#base60"; } #line 524 "<stdout>" yy74: yych = *++YYCURSOR; @@ -661,7 +662,7 @@ yy81: yych = *++YYCURSOR; yy82: ++YYCURSOR; goto yy83; yy83: -#line 110 "implicit.re" +#line 111 "implicit.re" { return "timestamp#ymd"; } #line 627 "<stdout>" yy84: yych = *++YYCURSOR; @@ -878,7 +879,7 @@ yy104: yych = *++YYCURSOR; yy105: ++YYCURSOR; goto yy106; yy106: -#line 114 "implicit.re" +#line 115 "implicit.re" { return "timestamp#spaced"; } #line 847 "<stdout>" yy107: yych = *++YYCURSOR; @@ -1063,7 +1064,7 @@ yy122: yych = *++YYCURSOR; yy123: ++YYCURSOR; goto yy124; yy124: -#line 112 "implicit.re" +#line 113 "implicit.re" { return "timestamp#iso8601"; } #line 1033 "<stdout>" yy125: yych = *++YYCURSOR; @@ -1301,13 +1302,13 @@ yy146: switch(yych){ yy147: ++YYCURSOR; goto yy148; yy148: -#line 90 "implicit.re" +#line 91 "implicit.re" { return "int#hex"; } #line 1275 "<stdout>" yy149: ++YYCURSOR; goto yy150; yy150: -#line 92 "implicit.re" +#line 93 "implicit.re" { return "int#oct"; } #line 1281 "<stdout>" yy151: ++YYCURSOR; @@ -1406,7 +1407,7 @@ yy163: yych = *++YYCURSOR; yy164: ++YYCURSOR; goto yy165; yy165: -#line 106 "implicit.re" +#line 107 "implicit.re" { return "float#neginf"; } #line 1381 "<stdout>" yy166: yych = *++YYCURSOR; @@ -1446,7 +1447,7 @@ yy172: yych = *++YYCURSOR; yy173: ++YYCURSOR; goto yy174; yy174: -#line 88 "implicit.re" +#line 89 "implicit.re" { return "bool#no"; } #line 1421 "<stdout>" yy175: yych = *++YYCURSOR; @@ -1490,7 +1491,7 @@ yy182: yych = *++YYCURSOR; yy183: ++YYCURSOR; goto yy184; yy184: -#line 86 "implicit.re" +#line 87 "implicit.re" { return "bool#yes"; } #line 1465 "<stdout>" yy185: yych = *++YYCURSOR; @@ -1577,11 +1578,36 @@ yy201: ++YYCURSOR; default: goto yy25; } } -#line 124 "implicit.re" +#line 125 "implicit.re" } +/* Remove ending fragment and compare types */ +int +syck_tagcmp( char *tag1, char *tag2 ) +{ + if ( tag1 == tag2 ) return 1; + if ( tag1 == NULL || tag2 == NULL ) return 0; + else { + int i; + char *othorpe; + char *tmp1 = syck_strndup( tag1, strlen( tag1 ) ); + char *tmp2 = syck_strndup( tag2, strlen( tag2 ) ); + othorpe = strstr( tmp1, "#" ); + if ( othorpe != NULL ) { + othorpe[0] = '\0'; + } + othorpe = strstr( tmp2, "#" ); + if ( othorpe != NULL ) { + othorpe[0] = '\0'; + } + i = strcmp( tmp1, tmp2 ); + S_FREE( tmp1 ); S_FREE( tmp2 ); + return i; + } +} + char * syck_type_id_to_uri( char *type_id ) { @@ -1737,7 +1763,7 @@ yy205: yyaccept = 0; default: goto yy206; } yy206: -#line 176 "implicit.re" +#line 202 "implicit.re" { return syck_taguri( YAML_DOMAIN, type_id, strlen( type_id ) ); } #line 1700 "<stdout>" yy207: yyaccept = 0; @@ -1811,7 +1837,7 @@ yy207: yyaccept = 0; yy208: ++YYCURSOR; goto yy209; yy209: -#line 150 "implicit.re" +#line 176 "implicit.re" { return syck_xprivate( type_id + 1, strlen( type_id ) - 1 ); } #line 1774 "<stdout>" yy210: yyaccept = 0; @@ -2107,7 +2133,7 @@ yy217: ++YYCURSOR; yy218: ++YYCURSOR; goto yy219; yy219: -#line 152 "implicit.re" +#line 178 "implicit.re" { char *domain = S_ALLOC_N( char, ( YYCURSOR - type_id ) + 15 ); char *uri; @@ -2325,7 +2351,7 @@ yy228: yych = *++YYCURSOR; yy229: ++YYCURSOR; goto yy230; yy230: -#line 165 "implicit.re" +#line 191 "implicit.re" { char *domain = S_ALLOC_N( char, YYCURSOR - type_id ); char *uri; @@ -2454,7 +2480,7 @@ yy243: yych = *++YYCURSOR; yy244: ++YYCURSOR; goto yy245; yy245: -#line 148 "implicit.re" +#line 174 "implicit.re" { return type_id; } #line 2422 "<stdout>" yy246: yych = *++YYCURSOR; @@ -2901,7 +2927,7 @@ yy263: yych = *++YYCURSOR; yy264: ++YYCURSOR; goto yy265; yy265: -#line 146 "implicit.re" +#line 172 "implicit.re" { return type_id; } #line 2874 "<stdout>" yy266: yych = *++YYCURSOR; @@ -2958,8 +2984,7 @@ yy270: ++YYCURSOR; default: goto yy204; } } -#line 178 "implicit.re" +#line 204 "implicit.re" } - |