From 605014cb5544518d26e1039fa7d2de912151fb46 Mon Sep 17 00:00:00 2001 From: why Date: Thu, 6 May 2004 06:39:45 +0000 Subject: * lib/yaml/rubytypes.rb (to_yaml): added instance variable handling for Ranges, Strings, Structs, Regexps. * lib/yaml/rubytypes.rb (to_yaml_fold): new method for setting a String's flow style. * lib/yaml.rb (YAML::object_maker): now uses Object.allocate. * ext/syck/gram.c: fixed transfer methods on structs, broke it last commit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/syck/bytecode.c | 2 +- ext/syck/emitter.c | 3 +- ext/syck/gram.c | 397 +++++++++++++++++++++++++-------------------------- ext/syck/handler.c | 2 +- ext/syck/implicit.c | 2 +- ext/syck/node.c | 2 +- ext/syck/rubyext.c | 67 ++++++--- ext/syck/syck.c | 3 +- ext/syck/token.c | 2 +- ext/syck/yaml2byte.c | 2 +- 10 files changed, 246 insertions(+), 236 deletions(-) (limited to 'ext') diff --git a/ext/syck/bytecode.c b/ext/syck/bytecode.c index eff21d2046..322d17dc0e 100644 --- a/ext/syck/bytecode.c +++ b/ext/syck/bytecode.c @@ -8,8 +8,8 @@ * * Copyright (C) 2003 why the lucky stiff */ -#include "syck.h" #include "ruby.h" +#include "syck.h" #include "gram.h" #define QUOTELEN 128 diff --git a/ext/syck/emitter.c b/ext/syck/emitter.c index d373ed4c45..25437b230c 100644 --- a/ext/syck/emitter.c +++ b/ext/syck/emitter.c @@ -9,11 +9,12 @@ * All Base64 code from Ruby's pack.c. * Ruby is Copyright (C) 1993-2003 Yukihiro Matsumoto */ +#include "ruby.h" + #include #include #include "syck.h" -#include "ruby.h" #define DEFAULT_ANCHOR_FORMAT "id%03d" diff --git a/ext/syck/gram.c b/ext/syck/gram.c index 4e8020bd16..0e01695008 100644 --- a/ext/syck/gram.c +++ b/ext/syck/gram.c @@ -249,8 +249,8 @@ union yyalloc #endif /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 43 -#define YYLAST 486 +#define YYFINAL 38 +#define YYLAST 422 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 23 @@ -259,7 +259,7 @@ union yyalloc /* YYNRULES -- Number of rules. */ #define YYNRULES 75 /* YYNRULES -- Number of states. */ -#define YYNSTATES 132 +#define YYNSTATES 128 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -306,9 +306,9 @@ static const unsigned char yytranslate[] = static const unsigned char yyprhs[] = { 0, 0, 3, 5, 8, 9, 11, 13, 15, 19, - 21, 24, 28, 30, 33, 34, 36, 39, 41, 43, - 45, 48, 51, 54, 57, 60, 62, 64, 66, 70, - 73, 76, 78, 80, 82, 84, 86, 90, 93, 95, + 21, 24, 27, 30, 34, 36, 39, 40, 42, 45, + 47, 49, 51, 54, 57, 60, 63, 66, 68, 70, + 72, 76, 78, 80, 82, 84, 86, 90, 93, 95, 99, 102, 106, 109, 113, 116, 118, 122, 125, 129, 132, 134, 138, 140, 142, 146, 150, 154, 157, 161, 164, 168, 171, 175, 177, 183, 185, 189, 193, 196, @@ -320,12 +320,12 @@ static const yysigned_char yyrhs[] = { 24, 0, -1, 26, -1, 11, 28, -1, -1, 33, -1, 27, -1, 34, -1, 29, 26, 32, -1, 34, - -1, 3, 27, -1, 29, 27, 32, -1, 25, -1, - 29, 30, -1, -1, 12, -1, 29, 13, -1, 14, - -1, 13, -1, 14, -1, 31, 32, -1, 5, 33, - -1, 6, 33, -1, 7, 33, -1, 3, 33, -1, - 4, -1, 8, -1, 9, -1, 29, 33, 32, -1, - 5, 34, -1, 6, 34, -1, 10, -1, 35, -1, + -1, 5, 27, -1, 6, 27, -1, 3, 27, -1, + 29, 27, 32, -1, 25, -1, 29, 30, -1, -1, + 12, -1, 29, 13, -1, 14, -1, 13, -1, 14, + -1, 31, 32, -1, 5, 33, -1, 6, 33, -1, + 7, 33, -1, 3, 33, -1, 4, -1, 8, -1, + 9, -1, 29, 33, 32, -1, 10, -1, 35, -1, 39, -1, 42, -1, 48, -1, 29, 37, 30, -1, 15, 28, -1, 38, -1, 5, 31, 37, -1, 5, 37, -1, 6, 31, 37, -1, 6, 37, -1, 3, @@ -346,9 +346,9 @@ static const yysigned_char yyrhs[] = static const unsigned short yyrline[] = { 0, 54, 54, 58, 62, 68, 69, 72, 73, 79, - 80, 89, 95, 96, 101, 111, 112, 115, 118, 121, - 122, 130, 135, 140, 148, 152, 160, 173, 174, 184, - 189, 194, 195, 196, 197, 198, 204, 210, 216, 217, + 80, 85, 90, 99, 105, 106, 111, 121, 122, 125, + 128, 131, 132, 140, 145, 150, 158, 162, 170, 183, + 184, 194, 195, 196, 197, 198, 204, 210, 216, 217, 222, 227, 232, 237, 241, 247, 251, 256, 265, 269, 275, 279, 286, 287, 293, 298, 305, 310, 315, 320, 325, 329, 335, 350, 351, 369, 370, 382, 390, 399, @@ -390,9 +390,9 @@ static const unsigned short yytoknum[] = static const unsigned char yyr1[] = { 0, 23, 24, 24, 24, 25, 25, 26, 26, 27, - 27, 27, 28, 28, 28, 29, 29, 30, 31, 32, - 32, 33, 33, 33, 33, 33, 33, 33, 33, 34, - 34, 34, 34, 34, 34, 34, 35, 36, 37, 37, + 27, 27, 27, 27, 28, 28, 28, 29, 29, 30, + 31, 32, 32, 33, 33, 33, 33, 33, 33, 33, + 33, 34, 34, 34, 34, 34, 35, 36, 37, 37, 37, 37, 37, 37, 37, 38, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 43, 43, 43, 43, 44, 45, 45, 46, 46, 46, 46, 47, @@ -403,9 +403,9 @@ static const unsigned char yyr1[] = static const unsigned char yyr2[] = { 0, 2, 1, 2, 0, 1, 1, 1, 3, 1, - 2, 3, 1, 2, 0, 1, 2, 1, 1, 1, - 2, 2, 2, 2, 2, 1, 1, 1, 3, 2, - 2, 1, 1, 1, 1, 1, 3, 2, 1, 3, + 2, 2, 2, 3, 1, 2, 0, 1, 2, 1, + 1, 1, 2, 2, 2, 2, 2, 1, 1, 1, + 3, 1, 1, 1, 1, 1, 3, 2, 1, 3, 2, 3, 2, 3, 2, 1, 3, 2, 3, 2, 1, 3, 1, 1, 3, 3, 3, 2, 3, 2, 3, 2, 3, 1, 5, 1, 3, 3, 2, 3, @@ -417,57 +417,55 @@ static const unsigned char yyr2[] = means the default is an error. */ static const unsigned char yydefact[] = { - 4, 0, 0, 31, 14, 15, 0, 0, 0, 2, - 0, 7, 32, 33, 34, 35, 0, 29, 30, 0, - 25, 0, 0, 0, 26, 27, 12, 6, 3, 0, - 5, 9, 49, 52, 0, 0, 50, 53, 71, 74, - 75, 0, 72, 1, 0, 0, 0, 16, 14, 0, - 0, 0, 0, 45, 0, 38, 0, 63, 65, 0, - 0, 0, 0, 10, 24, 0, 0, 21, 22, 0, - 0, 23, 0, 17, 0, 13, 0, 14, 48, 0, - 70, 0, 18, 0, 44, 61, 0, 40, 57, 0, - 42, 59, 37, 0, 19, 0, 8, 14, 36, 47, - 54, 55, 68, 0, 11, 28, 69, 51, 73, 0, - 0, 0, 43, 60, 39, 56, 41, 58, 0, 20, - 62, 46, 66, 67, 0, 0, 0, 14, 0, 0, - 0, 64 + 4, 31, 16, 17, 0, 0, 0, 2, 0, 7, + 32, 33, 34, 35, 0, 27, 0, 0, 0, 28, + 29, 14, 6, 3, 0, 5, 9, 49, 52, 0, + 0, 50, 53, 71, 74, 75, 0, 72, 1, 0, + 0, 0, 18, 16, 0, 0, 0, 0, 45, 0, + 38, 0, 63, 65, 0, 12, 26, 10, 23, 11, + 24, 0, 0, 0, 0, 25, 0, 0, 0, 19, + 0, 15, 0, 16, 48, 0, 70, 0, 20, 0, + 44, 61, 0, 40, 57, 0, 42, 59, 37, 0, + 21, 0, 8, 16, 36, 47, 54, 55, 68, 0, + 13, 30, 69, 51, 73, 0, 0, 0, 43, 60, + 39, 56, 41, 58, 0, 22, 62, 46, 66, 67, + 0, 0, 0, 16, 0, 0, 0, 64 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yysigned_char yydefgoto[] = { - -1, 8, 26, 50, 27, 28, 62, 75, 95, 105, - 30, 31, 12, 53, 54, 55, 13, 35, 36, 14, - 56, 57, 58, 59, 37, 15, 41, 42 + -1, 6, 21, 45, 22, 23, 64, 71, 91, 101, + 25, 26, 10, 48, 49, 50, 11, 30, 31, 12, + 51, 52, 53, 54, 32, 13, 36, 37 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -79 +#define YYPACT_NINF -77 static const short yypact[] = { - 412, 420, 420, -79, 385, -79, 368, 316, 12, -79, - 256, -79, -79, -79, -79, -79, 152, -79, -79, 385, - -79, 402, 402, 474, -79, -79, -79, -79, -79, 236, - -79, -79, -79, 14, 276, 22, -79, -79, -79, 14, - -79, -4, -79, -79, 437, 334, 334, -79, 385, 385, - 62, 256, 23, -79, 4, 11, 4, -79, -79, 85, - 437, 437, 463, -79, -79, 474, 152, -79, -79, 474, - 474, -79, 351, -79, 62, -79, 127, 385, -79, 385, - -79, 385, -79, 201, -79, -79, 201, -79, -79, 201, - -79, -79, -79, 11, -79, 62, -79, 385, -79, 39, - -79, -79, 296, 62, -79, -79, -79, -79, -79, 450, - 450, 450, -79, 11, -79, 11, -79, 11, 44, -79, - -79, -79, -79, -79, 32, 32, 32, 385, 65, 65, - 65, -79 + 163, -77, 356, -77, 339, 304, 7, -77, 224, -77, + -77, -77, -77, -77, 356, -77, 356, 356, 410, -77, + -77, -77, -77, -77, 204, -77, -77, -77, -15, 244, + 24, -77, -77, -77, -15, -77, 30, -77, -77, 373, + 373, 373, -77, 356, 356, 41, 224, -3, -77, 18, + 21, 18, -77, -77, 46, -77, -77, -77, -77, -77, + -77, 410, 410, 410, 399, -77, 322, 322, 322, -77, + 41, -77, 14, 356, -77, 356, -77, 356, -77, 264, + -77, -77, 264, -77, -77, 264, -77, -77, -77, 21, + -77, 41, -77, 356, -77, 33, -77, -77, 284, 41, + -77, -77, -77, -77, -77, 386, 386, 386, -77, 21, + -77, 21, -77, 21, 22, -77, -77, -77, -77, -77, + 20, 20, 20, 356, 91, 91, 91, -77 }; /* YYPGOTO[NTERM-NUM]. */ -static const yysigned_char yypgoto[] = +static const short yypgoto[] = { - -79, -79, 8, 64, -6, -45, 0, -23, 73, -30, - 40, 93, -79, -44, 108, -79, -79, -79, -12, -79, - -19, -79, -29, -78, 2, -79, -79, 7 + -77, -77, 5, 56, 138, -40, 0, 25, 59, -34, + 23, 12, -77, -76, 71, -77, -77, -77, -14, -77, + 75, -77, -33, -64, 1, -77, -77, -7 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -477,128 +475,115 @@ static const yysigned_char yypgoto[] = #define YYTABLE_NINF -1 static const unsigned char yytable[] = { - 10, 16, 16, 92, 29, 113, 34, 34, 115, 40, - 51, 117, 43, 63, 33, 39, 80, 81, 73, 34, - 96, 66, 66, 74, 82, 85, 88, 91, 74, 34, - 77, 98, 106, 100, 34, 128, 101, 129, 130, 97, - 78, 88, 91, 79, 104, 66, 66, 48, 29, 34, - 52, 51, 120, 85, 48, 121, 52, 93, 122, 64, - 127, 67, 68, 71, 9, 119, 63, 107, 128, 76, - 129, 130, 34, 123, 76, 82, 94, 29, 82, 34, - 48, 34, 131, 40, 64, 67, 68, 33, 108, 39, - 0, 76, 0, 11, 17, 18, 0, 29, 82, 73, - 67, 68, 103, 11, 0, 64, 76, 0, 0, 67, - 68, 0, 64, 0, 17, 18, 0, 83, 86, 89, - 0, 0, 0, 52, 0, 0, 52, 29, 99, 52, - 0, 0, 102, 86, 89, 0, 0, 0, 17, 18, - 82, 94, 52, 97, 11, 83, 0, 0, 0, 64, - 67, 68, 84, 87, 90, 44, 20, 60, 61, 23, - 24, 25, 0, 0, 5, 47, 118, 48, 87, 90, - 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, - 84, 0, 124, 125, 126, 0, 102, 0, 102, 0, - 102, 112, 0, 0, 114, 0, 0, 116, 0, 0, - 0, 124, 125, 126, 109, 20, 110, 111, 23, 24, - 25, 0, 0, 5, 0, 0, 48, 84, 87, 90, - 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, - 0, 0, 112, 114, 116, 0, 84, 87, 90, 72, - 20, 45, 46, 23, 24, 25, 3, 0, 5, 47, - 73, 48, 0, 6, 0, 7, 0, 0, 49, 44, - 20, 45, 46, 23, 24, 25, 3, 0, 5, 47, - 0, 48, 0, 6, 0, 7, 0, 0, 49, 72, - 20, 45, 46, 23, 24, 25, 3, 0, 5, 47, - 0, 48, 0, 6, 0, 7, 0, 0, 49, 65, - 20, 69, 70, 23, 24, 25, 0, 0, 5, 0, - 0, 48, 0, 0, 0, 0, 0, 0, 49, 19, - 20, 21, 22, 23, 24, 25, 3, 0, 5, 0, - 0, 0, 0, 6, 0, 7, 38, 44, 20, 45, - 46, 23, 24, 25, 3, 0, 5, 82, 0, 48, - 0, 6, 0, 7, 72, 20, 45, 46, 23, 24, - 25, 3, 0, 5, 82, 0, 48, 0, 6, 0, - 7, 19, 20, 21, 22, 23, 24, 25, 3, 0, - 5, 0, 0, 0, 0, 6, 32, 7, 19, 20, - 21, 22, 23, 24, 25, 3, 0, 5, 0, 0, - 0, 0, 6, 0, 7, 65, 20, 21, 22, 23, - 24, 25, 3, 0, 5, 0, 0, 1, 2, 6, - 0, 7, 3, 4, 5, 1, 2, 0, 0, 6, - 3, 7, 5, 0, 0, 0, 0, 6, 0, 7, - 44, 20, 60, 61, 23, 24, 25, 0, 0, 5, - 82, 0, 48, 109, 20, 110, 111, 23, 24, 25, - 0, 0, 5, 82, 0, 48, 65, 20, 69, 70, - 23, 24, 25, 0, 0, 5, 47, 65, 20, 69, - 70, 23, 24, 25, 0, 0, 5 + 8, 73, 24, 88, 29, 29, 35, 38, 46, 28, + 34, 92, 9, 93, 29, 109, 29, 29, 111, 117, + 9, 113, 118, 124, 29, 125, 126, 78, 90, 29, + 93, 47, 69, 102, 78, 43, 100, 56, 123, 58, + 60, 65, 74, 24, 29, 75, 46, 72, 43, 89, + 76, 77, 72, 116, 78, 90, 7, 115, 9, 78, + 69, 103, 56, 58, 60, 119, 29, 29, 29, 72, + 104, 0, 0, 24, 94, 29, 96, 29, 35, 97, + 28, 0, 34, 127, 56, 58, 60, 99, 0, 56, + 58, 60, 0, 24, 124, 0, 125, 126, 79, 82, + 85, 0, 47, 0, 78, 47, 43, 0, 47, 95, + 80, 83, 86, 98, 81, 84, 87, 0, 0, 0, + 0, 47, 0, 24, 0, 79, 82, 85, 56, 58, + 60, 0, 0, 0, 0, 0, 0, 80, 83, 86, + 0, 81, 84, 87, 0, 0, 0, 0, 114, 0, + 108, 0, 55, 110, 57, 59, 112, 0, 0, 0, + 0, 0, 70, 0, 120, 121, 122, 70, 98, 0, + 98, 0, 98, 1, 2, 3, 80, 83, 86, 0, + 4, 0, 5, 120, 121, 122, 0, 0, 0, 0, + 0, 108, 110, 112, 0, 80, 83, 86, 0, 0, + 0, 0, 0, 0, 55, 57, 59, 66, 15, 67, + 68, 18, 19, 20, 1, 0, 3, 42, 69, 43, + 0, 4, 0, 5, 0, 0, 44, 39, 15, 40, + 41, 18, 19, 20, 1, 0, 3, 42, 0, 43, + 0, 4, 0, 5, 0, 0, 44, 66, 15, 67, + 68, 18, 19, 20, 1, 0, 3, 42, 0, 43, + 0, 4, 0, 5, 0, 0, 44, 105, 15, 106, + 107, 18, 19, 20, 0, 0, 3, 0, 0, 43, + 0, 0, 0, 0, 0, 0, 44, 61, 15, 62, + 63, 18, 19, 20, 0, 0, 3, 0, 0, 43, + 0, 0, 0, 0, 0, 0, 44, 14, 15, 16, + 17, 18, 19, 20, 1, 0, 3, 0, 0, 0, + 0, 4, 0, 5, 33, 66, 15, 67, 68, 18, + 19, 20, 1, 0, 3, 78, 0, 43, 0, 4, + 0, 5, 14, 15, 16, 17, 18, 19, 20, 1, + 0, 3, 0, 0, 0, 0, 4, 27, 5, 14, + 15, 16, 17, 18, 19, 20, 1, 0, 3, 0, + 0, 0, 0, 4, 0, 5, 39, 15, 40, 41, + 18, 19, 20, 0, 0, 3, 78, 0, 43, 105, + 15, 106, 107, 18, 19, 20, 0, 0, 3, 78, + 0, 43, 61, 15, 62, 63, 18, 19, 20, 0, + 0, 3, 42, 61, 15, 62, 63, 18, 19, 20, + 0, 0, 3 }; -static const short yycheck[] = +static const yysigned_char yycheck[] = { - 0, 1, 2, 48, 4, 83, 6, 7, 86, 7, - 10, 89, 0, 19, 6, 7, 20, 21, 14, 19, - 50, 21, 22, 29, 13, 44, 45, 46, 34, 29, - 16, 54, 77, 56, 34, 3, 59, 5, 6, 16, - 18, 60, 61, 21, 74, 45, 46, 15, 48, 49, - 10, 51, 97, 72, 15, 99, 16, 49, 102, 19, - 16, 21, 22, 23, 0, 95, 72, 79, 3, 29, - 5, 6, 72, 102, 34, 13, 14, 77, 13, 79, - 15, 81, 127, 81, 44, 45, 46, 79, 81, 81, - -1, 51, -1, 0, 1, 2, -1, 97, 13, 14, - 60, 61, 62, 10, -1, 65, 66, -1, -1, 69, - 70, -1, 72, -1, 21, 22, -1, 44, 45, 46, - -1, -1, -1, 83, -1, -1, 86, 127, 55, 89, - -1, -1, 59, 60, 61, -1, -1, -1, 45, 46, - 13, 14, 102, 16, 51, 72, -1, -1, -1, 109, - 110, 111, 44, 45, 46, 3, 4, 5, 6, 7, - 8, 9, -1, -1, 12, 13, 93, 15, 60, 61, - -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, - 72, -1, 109, 110, 111, -1, 113, -1, 115, -1, - 117, 83, -1, -1, 86, -1, -1, 89, -1, -1, - -1, 128, 129, 130, 3, 4, 5, 6, 7, 8, - 9, -1, -1, 12, -1, -1, 15, 109, 110, 111, - -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, - -1, -1, 124, 125, 126, -1, 128, 129, 130, 3, - 4, 5, 6, 7, 8, 9, 10, -1, 12, 13, - 14, 15, -1, 17, -1, 19, -1, -1, 22, 3, - 4, 5, 6, 7, 8, 9, 10, -1, 12, 13, - -1, 15, -1, 17, -1, 19, -1, -1, 22, 3, - 4, 5, 6, 7, 8, 9, 10, -1, 12, 13, - -1, 15, -1, 17, -1, 19, -1, -1, 22, 3, - 4, 5, 6, 7, 8, 9, -1, -1, 12, -1, - -1, 15, -1, -1, -1, -1, -1, -1, 22, 3, - 4, 5, 6, 7, 8, 9, 10, -1, 12, -1, - -1, -1, -1, 17, -1, 19, 20, 3, 4, 5, + 0, 16, 2, 43, 4, 5, 5, 0, 8, 4, + 5, 45, 0, 16, 14, 79, 16, 17, 82, 95, + 8, 85, 98, 3, 24, 5, 6, 13, 14, 29, + 16, 8, 14, 73, 13, 15, 70, 14, 16, 16, + 17, 18, 18, 43, 44, 21, 46, 24, 15, 44, + 20, 21, 29, 93, 13, 14, 0, 91, 46, 13, + 14, 75, 39, 40, 41, 98, 66, 67, 68, 46, + 77, -1, -1, 73, 49, 75, 51, 77, 77, 54, + 75, -1, 77, 123, 61, 62, 63, 64, -1, 66, + 67, 68, -1, 93, 3, -1, 5, 6, 39, 40, + 41, -1, 79, -1, 13, 82, 15, -1, 85, 50, + 39, 40, 41, 54, 39, 40, 41, -1, -1, -1, + -1, 98, -1, 123, -1, 66, 67, 68, 105, 106, + 107, -1, -1, -1, -1, -1, -1, 66, 67, 68, + -1, 66, 67, 68, -1, -1, -1, -1, 89, -1, + 79, -1, 14, 82, 16, 17, 85, -1, -1, -1, + -1, -1, 24, -1, 105, 106, 107, 29, 109, -1, + 111, -1, 113, 10, 11, 12, 105, 106, 107, -1, + 17, -1, 19, 124, 125, 126, -1, -1, -1, -1, + -1, 120, 121, 122, -1, 124, 125, 126, -1, -1, + -1, -1, -1, -1, 66, 67, 68, 3, 4, 5, + 6, 7, 8, 9, 10, -1, 12, 13, 14, 15, + -1, 17, -1, 19, -1, -1, 22, 3, 4, 5, + 6, 7, 8, 9, 10, -1, 12, 13, -1, 15, + -1, 17, -1, 19, -1, -1, 22, 3, 4, 5, 6, 7, 8, 9, 10, -1, 12, 13, -1, 15, - -1, 17, -1, 19, 3, 4, 5, 6, 7, 8, - 9, 10, -1, 12, 13, -1, 15, -1, 17, -1, - 19, 3, 4, 5, 6, 7, 8, 9, 10, -1, - 12, -1, -1, -1, -1, 17, 18, 19, 3, 4, - 5, 6, 7, 8, 9, 10, -1, 12, -1, -1, - -1, -1, 17, -1, 19, 3, 4, 5, 6, 7, - 8, 9, 10, -1, 12, -1, -1, 5, 6, 17, - -1, 19, 10, 11, 12, 5, 6, -1, -1, 17, - 10, 19, 12, -1, -1, -1, -1, 17, -1, 19, - 3, 4, 5, 6, 7, 8, 9, -1, -1, 12, - 13, -1, 15, 3, 4, 5, 6, 7, 8, 9, - -1, -1, 12, 13, -1, 15, 3, 4, 5, 6, - 7, 8, 9, -1, -1, 12, 13, 3, 4, 5, - 6, 7, 8, 9, -1, -1, 12 + -1, 17, -1, 19, -1, -1, 22, 3, 4, 5, + 6, 7, 8, 9, -1, -1, 12, -1, -1, 15, + -1, -1, -1, -1, -1, -1, 22, 3, 4, 5, + 6, 7, 8, 9, -1, -1, 12, -1, -1, 15, + -1, -1, -1, -1, -1, -1, 22, 3, 4, 5, + 6, 7, 8, 9, 10, -1, 12, -1, -1, -1, + -1, 17, -1, 19, 20, 3, 4, 5, 6, 7, + 8, 9, 10, -1, 12, 13, -1, 15, -1, 17, + -1, 19, 3, 4, 5, 6, 7, 8, 9, 10, + -1, 12, -1, -1, -1, -1, 17, 18, 19, 3, + 4, 5, 6, 7, 8, 9, 10, -1, 12, -1, + -1, -1, -1, 17, -1, 19, 3, 4, 5, 6, + 7, 8, 9, -1, -1, 12, 13, -1, 15, 3, + 4, 5, 6, 7, 8, 9, -1, -1, 12, 13, + -1, 15, 3, 4, 5, 6, 7, 8, 9, -1, + -1, 12, 13, 3, 4, 5, 6, 7, 8, 9, + -1, -1, 12 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const unsigned char yystos[] = { - 0, 5, 6, 10, 11, 12, 17, 19, 24, 26, - 29, 34, 35, 39, 42, 48, 29, 34, 34, 3, - 4, 5, 6, 7, 8, 9, 25, 27, 28, 29, - 33, 34, 18, 25, 29, 40, 41, 47, 20, 25, - 47, 49, 50, 0, 3, 5, 6, 13, 15, 22, - 26, 29, 33, 36, 37, 38, 43, 44, 45, 46, - 5, 6, 29, 27, 33, 3, 29, 33, 33, 5, - 6, 33, 3, 14, 27, 30, 33, 16, 18, 21, - 20, 21, 13, 31, 37, 43, 31, 37, 43, 31, - 37, 43, 28, 25, 14, 31, 32, 16, 30, 31, - 30, 30, 31, 33, 32, 32, 28, 41, 50, 3, - 5, 6, 37, 46, 37, 46, 37, 46, 31, 32, - 28, 36, 36, 45, 31, 31, 31, 16, 3, 5, - 6, 28 + 0, 10, 11, 12, 17, 19, 24, 26, 29, 34, + 35, 39, 42, 48, 3, 4, 5, 6, 7, 8, + 9, 25, 27, 28, 29, 33, 34, 18, 25, 29, + 40, 41, 47, 20, 25, 47, 49, 50, 0, 3, + 5, 6, 13, 15, 22, 26, 29, 33, 36, 37, + 38, 43, 44, 45, 46, 27, 33, 27, 33, 27, + 33, 3, 5, 6, 29, 33, 3, 5, 6, 14, + 27, 30, 33, 16, 18, 21, 20, 21, 13, 31, + 37, 43, 31, 37, 43, 31, 37, 43, 28, 25, + 14, 31, 32, 16, 30, 31, 30, 30, 31, 33, + 32, 32, 28, 41, 50, 3, 5, 6, 37, 46, + 37, 46, 37, 46, 31, 32, 28, 36, 36, 45, + 31, 31, 31, 16, 3, 5, 6, 28 }; #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) @@ -1182,6 +1167,22 @@ yyreduce: case 10: #line 81 "gram.y" + { + syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion ); + yyval.nodeData = yyvsp[0].nodeData; + } + break; + + case 11: +#line 86 "gram.y" + { + syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 ); + yyval.nodeData = yyvsp[0].nodeData; + } + break; + + case 12: +#line 91 "gram.y" { /* * _Anchors_: The language binding must keep a separate symbol table @@ -1192,47 +1193,47 @@ yyreduce: } break; - case 11: -#line 90 "gram.y" + case 13: +#line 100 "gram.y" { yyval.nodeData = yyvsp[-1].nodeData; } break; - case 13: -#line 97 "gram.y" + case 15: +#line 107 "gram.y" { NULL_NODE( parser, n ); yyval.nodeData = n; } break; - case 14: -#line 102 "gram.y" + case 16: +#line 112 "gram.y" { NULL_NODE( parser, n ); yyval.nodeData = n; } break; - case 21: -#line 131 "gram.y" + case 23: +#line 141 "gram.y" { syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion ); yyval.nodeData = yyvsp[0].nodeData; } break; - case 22: -#line 136 "gram.y" + case 24: +#line 146 "gram.y" { syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 ); yyval.nodeData = yyvsp[0].nodeData; } break; - case 23: -#line 141 "gram.y" + case 25: +#line 151 "gram.y" { if ( ((SyckParser *)parser)->implicit_typing == 1 ) { @@ -1242,15 +1243,15 @@ yyreduce: } break; - case 24: -#line 149 "gram.y" + case 26: +#line 159 "gram.y" { yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData ); } break; - case 25: -#line 153 "gram.y" + case 27: +#line 163 "gram.y" { /* * _Aliases_: The anchor symbol table is scanned for the anchor name. @@ -1260,8 +1261,8 @@ yyreduce: } break; - case 26: -#line 161 "gram.y" + case 28: +#line 171 "gram.y" { SyckNode *n = yyvsp[0].nodeData; if ( ((SyckParser *)parser)->taguri_expansion == 1 ) @@ -1276,26 +1277,10 @@ yyreduce: } break; - case 28: -#line 175 "gram.y" - { - yyval.nodeData = yyvsp[-1].nodeData; - } - break; - - case 29: -#line 185 "gram.y" - { - syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion ); - yyval.nodeData = yyvsp[0].nodeData; - } - break; - case 30: -#line 190 "gram.y" +#line 185 "gram.y" { - syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 ); - yyval.nodeData = yyvsp[0].nodeData; + yyval.nodeData = yyvsp[-1].nodeData; } break; @@ -1570,7 +1555,7 @@ yyreduce: } /* Line 1016 of /usr/local/share/bison/yacc.c. */ -#line 1574 "y.tab.c" +#line 1559 "y.tab.c" yyvsp -= yylen; yyssp -= yylen; diff --git a/ext/syck/handler.c b/ext/syck/handler.c index eddc6465af..563feb10ae 100644 --- a/ext/syck/handler.c +++ b/ext/syck/handler.c @@ -7,8 +7,8 @@ * Copyright (C) 2003 why the lucky stiff */ -#include "syck.h" #include "ruby.h" +#include "syck.h" SYMID syck_hdlr_add_node( SyckParser *p, SyckNode *n ) diff --git a/ext/syck/implicit.c b/ext/syck/implicit.c index b6f123740f..dee5cce636 100644 --- a/ext/syck/implicit.c +++ b/ext/syck/implicit.c @@ -9,8 +9,8 @@ * Copyright (C) 2003 why the lucky stiff */ -#include "syck.h" #include "ruby.h" +#include "syck.h" #define YYCTYPE char #define YYCURSOR cursor diff --git a/ext/syck/node.c b/ext/syck/node.c index 99bb07bc74..86c4086bc7 100644 --- a/ext/syck/node.c +++ b/ext/syck/node.c @@ -7,8 +7,8 @@ * Copyright (C) 2003 why the lucky stiff */ -#include "syck.h" #include "ruby.h" +#include "syck.h" /* * Node allocation functions diff --git a/ext/syck/rubyext.c b/ext/syck/rubyext.c index 29ddccbbd9..d7219ef26a 100644 --- a/ext/syck/rubyext.c +++ b/ext/syck/rubyext.c @@ -15,25 +15,33 @@ typedef struct RVALUE { union { + struct { + unsigned long flags; /* always 0 for freed obj */ + struct RVALUE *next; + } free; + struct RBasic basic; + struct RObject object; + struct RClass klass; + struct RFloat flonum; + struct RString string; + struct RArray array; + struct RRegexp regexp; + struct RHash hash; + struct RData data; + struct RStruct rstruct; + struct RBignum bignum; + struct RFile file; #if 0 - struct { - unsigned long flags; /* always 0 for freed obj */ - struct RVALUE *next; - } free; + struct RNode node; + struct RMatch match; + struct RVarmap varmap; + struct SCOPE scope; #endif - struct RBasic basic; - struct RObject object; - struct RClass klass; - /*struct RFloat flonum;*/ - /*struct RString string;*/ - struct RArray array; - /*struct RRegexp regexp;*/ - struct RHash hash; - /*struct RData data;*/ - struct RStruct rstruct; - /*struct RBignum bignum;*/ - /*struct RFile file;*/ } as; +#ifdef GC_DEBUG + char *file; + int line; +#endif } RVALUE; typedef struct { @@ -49,7 +57,7 @@ typedef struct { /* * symbols and constants */ -static ID s_new, s_utc, s_at, s_to_f, s_to_i, s_read, s_binmode, s_call, s_transfer, s_update, s_dup, s_match, s_keys, s_to_str, s_unpack, s_tr_bang, s_anchors, s_default_set; +static ID s_new, s_utc, s_at, s_to_f, s_to_i, s_read, s_binmode, s_call, s_cmp, s_transfer, s_update, s_dup, s_match, s_keys, s_to_str, s_unpack, s_tr_bang, s_anchors, s_default_set; static ID s_anchors, s_domain, s_families, s_kind, s_name, s_options, s_private_types, s_type_id, s_value; static VALUE sym_model, sym_generic, sym_input, sym_bytecode; static VALUE sym_scalar, sym_seq, sym_map; @@ -552,10 +560,9 @@ yaml_org_handler( n, ref ) } else if ( strncmp( n->data.str->ptr, ":", 1 ) == 0 ) { - char *tmp; - tmp = syck_strndup( n->data.str->ptr + 1, n->data.str->len - 1 ); - obj = ID2SYM( rb_intern( tmp ) ); - free( tmp ); + obj = rb_funcall( oDefaultLoader, s_transfer, 2, + rb_str_new2( "ruby/sym" ), + rb_str_new( n->data.str->ptr + 1, n->data.str->len - 1 ) ); } else if ( strcmp( type_id, "str" ) == 0 ) { @@ -660,7 +667,7 @@ rb_syck_load_handler(p, n) /* * ID already set, let's alter the symbol table to accept the new object */ - if (n->id > 0) + if (n->id > 0 && !NIL_P(obj)) { MEMCPY((void *)n->id, (void *)obj, RVALUE, 1); MEMZERO((void *)obj, RVALUE, 1); @@ -1146,6 +1153,19 @@ syck_badalias_initialize( self, val ) return self; } +/* + * YAML::Syck::BadAlias.<=> + */ +VALUE +syck_badalias_cmp( alias1, alias2 ) + VALUE alias1, alias2; +{ + VALUE str1 = rb_ivar_get( alias1, s_name ); + VALUE str2 = rb_ivar_get( alias2, s_name ); + VALUE val = rb_funcall( str1, s_cmp, 1, str2 ); + return val; +} + /* * YAML::Syck::DomainType.initialize */ @@ -1421,6 +1441,7 @@ Init_syck() s_binmode = rb_intern("binmode"); s_transfer = rb_intern("transfer"); s_call = rb_intern("call"); + s_cmp = rb_intern("<=>"); s_update = rb_intern("update"); s_dup = rb_intern("dup"); s_default_set = rb_intern("default="); @@ -1512,6 +1533,8 @@ Init_syck() cBadAlias = rb_define_class_under( rb_syck, "BadAlias", rb_cObject ); rb_define_attr( cBadAlias, "name", 1, 1 ); rb_define_method( cBadAlias, "initialize", syck_badalias_initialize, 1); + rb_define_method( cBadAlias, "<=>", syck_badalias_cmp, 1); + rb_include_module( cBadAlias, rb_const_get( rb_cObject, rb_intern("Comparable") ) ); /* * Define YAML::Syck::MergeKey class diff --git a/ext/syck/syck.c b/ext/syck/syck.c index 72a883df74..a4a3bd0c01 100644 --- a/ext/syck/syck.c +++ b/ext/syck/syck.c @@ -6,11 +6,12 @@ * * Copyright (C) 2003 why the lucky stiff */ +#include "ruby.h" + #include #include #include "syck.h" -#include "ruby.h" void syck_parser_pop_level( SyckParser * ); diff --git a/ext/syck/token.c b/ext/syck/token.c index 56f5daf338..5874c27c8f 100644 --- a/ext/syck/token.c +++ b/ext/syck/token.c @@ -8,8 +8,8 @@ * * Copyright (C) 2003 why the lucky stiff */ -#include "syck.h" #include "ruby.h" +#include "syck.h" #include "gram.h" /* diff --git a/ext/syck/yaml2byte.c b/ext/syck/yaml2byte.c index d55d1083b4..b2dc450ffa 100644 --- a/ext/syck/yaml2byte.c +++ b/ext/syck/yaml2byte.c @@ -9,11 +9,11 @@ * WARNING WARNING WARNING --- THIS IS *NOT JUST* PLAYING * ANYMORE! -- WHY HAS EMBRACED THIS AS THE REAL THING! */ +#include "ruby.h" #include #include #define YAMLBYTE_UTF8 #include "yamlbyte.h" -#include "ruby.h" #include #define TRACE0(a) \ -- cgit v1.2.3