From f1827a2fafaa50ba89f35c8c05beffd28b1dd6e6 Mon Sep 17 00:00:00 2001 From: why Date: Tue, 13 Sep 2005 03:58:33 +0000 Subject: * lib/yaml.rb: reworking YAML::Stream to use the new emitter. * lib/yaml/stream.rb: ditto. * lib/yaml/rubytypes.rb: added Object#yaml_new. * lib/yaml/tag.rb: the tag_subclasses? method now shows up in the class. allow taguri to be set using an accessor. continue support of Object#to_yaml_type. * ext/syck/rubyext.c: new emitter code. yaml_new and yaml_initialize get called, should they be present. consolidated all the diaspora of internal node types into the family below YAML::Syck::Node -- Map, Seq, Scalar -- all of whom are SyckNode structs pointing to Ruby data. moved Object#yaml_new into the node_import and made it the default behavior. the target_class is always called wih yaml_new, prepended a parameter, which is the klass. loaded nodes through GenericResolver show their style. new Resolver#tagurize converts type ids to taguris. * ext/syck/implicit.re: were 'y' and 'n' seriously omitted?? * ext/syck/emitter.c: renovated emitter, walks the tree in advance. consolidated redundant block_styles struct into the scalar_style struct. (this means loaded nodes can now be sent back to emitter and preserve at least its very basic formatting.) * ext/syck/gram.c: headless documents of any kind allowed. * ext/syck/node.c: new syck_replace_str methods and syck_empty_* methods for rewriting node contents, while keeping the ID and other setup info. added syck_seq_assign. * ext/syck/syck.h: reflect block_styles and new node functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/syck/implicit.c | 83 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 29 deletions(-) (limited to 'ext/syck/implicit.c') 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 "" 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 "" 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 "" yy28: ++YYCURSOR; goto yy29; yy29: -#line 118 "implicit.re" +#line 119 "implicit.re" { return "default"; } #line 236 "" 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 "" 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 "" 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 "" 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 "" 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 "" 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 "" yy72: ++YYCURSOR; goto yy73; yy73: -#line 102 "implicit.re" +#line 103 "implicit.re" { return "float#base60"; } #line 524 "" 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 "" 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 "" 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 "" 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 "" yy149: ++YYCURSOR; goto yy150; yy150: -#line 92 "implicit.re" +#line 93 "implicit.re" { return "int#oct"; } #line 1281 "" 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 "" 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 "" 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 "" 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 "" 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 "" 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 "" 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 "" yy266: yych = *++YYCURSOR; @@ -2958,8 +2984,7 @@ yy270: ++YYCURSOR; default: goto yy204; } } -#line 178 "implicit.re" +#line 204 "implicit.re" } - -- cgit v1.2.3