From bd810795c589a81e8939b53ad921f823e7133ee9 Mon Sep 17 00:00:00 2001 From: why Date: Tue, 13 May 2003 06:34:18 +0000 Subject: * lib/yaml/rubytypes.rb: object and struct loading * lib/yaml.rb: YAML::detect_implicit will discover typing for a Ruby string * ext/syck/: Fixed portable comments, misuse of NULL and methods without return VALUEs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/syck/gram.c | 187 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 103 insertions(+), 84 deletions(-) (limited to 'ext/syck/gram.c') diff --git a/ext/syck/gram.c b/ext/syck/gram.c index e1d0301c6c..91ebc6151a 100644 --- a/ext/syck/gram.c +++ b/ext/syck/gram.c @@ -229,16 +229,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 32 -#define YYLAST 132 +#define YYLAST 186 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 23 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 21 /* YYNRULES -- Number of rules. */ -#define YYNRULES 46 +#define YYNRULES 47 /* YYNRULES -- Number of states. */ -#define YYNSTATES 73 +#define YYNSTATES 78 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -287,8 +287,8 @@ static const unsigned char yyprhs[] = 0, 0, 3, 5, 8, 9, 11, 13, 16, 18, 22, 24, 25, 27, 30, 32, 34, 37, 40, 42, 44, 47, 49, 51, 53, 55, 57, 61, 64, 66, - 70, 73, 77, 80, 82, 86, 90, 94, 96, 102, - 104, 108, 111, 115, 119, 122, 124 + 70, 73, 77, 80, 82, 86, 90, 96, 100, 102, + 108, 110, 114, 117, 121, 125, 128, 130 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ @@ -303,10 +303,11 @@ static const yysigned_char yyrhs[] = -1, 14, 26, -1, 33, -1, 34, 29, 33, -1, 34, 29, -1, 17, 36, 18, -1, 17, 18, -1, 25, -1, 36, 21, 25, -1, 27, 40, 28, -1, - 30, 15, 26, -1, 38, -1, 22, 25, 29, 15, - 26, -1, 39, -1, 40, 29, 39, -1, 40, 29, - -1, 25, 15, 26, -1, 19, 43, 20, -1, 19, - 20, -1, 41, -1, 43, 21, 41, -1 + 27, 5, 29, 40, 28, -1, 30, 15, 26, -1, + 38, -1, 22, 25, 29, 15, 26, -1, 39, -1, + 40, 29, 39, -1, 40, 29, -1, 25, 15, 26, + -1, 19, 43, 20, -1, 19, 20, -1, 41, -1, + 43, 21, 41, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -315,8 +316,8 @@ static const unsigned short yyrline[] = 0, 44, 44, 48, 52, 58, 59, 60, 69, 77, 83, 84, 102, 103, 106, 109, 117, 122, 130, 143, 150, 155, 156, 157, 158, 159, 165, 171, 177, 181, - 186, 195, 199, 205, 209, 219, 225, 240, 241, 249, - 250, 255, 264, 272, 276, 282, 283 + 186, 195, 199, 205, 209, 219, 223, 230, 245, 246, + 254, 255, 260, 269, 277, 281, 287, 288 }; #endif @@ -353,8 +354,8 @@ static const unsigned char yyr1[] = 0, 23, 24, 24, 24, 25, 25, 25, 25, 25, 26, 26, 27, 27, 28, 29, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 32, 33, 34, 34, - 34, 35, 35, 36, 36, 37, 38, 39, 39, 40, - 40, 40, 41, 42, 42, 43, 43 + 34, 35, 35, 36, 36, 37, 37, 38, 39, 39, + 40, 40, 40, 41, 42, 42, 43, 43 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -363,8 +364,8 @@ static const unsigned char yyr2[] = 0, 2, 1, 2, 0, 1, 1, 2, 1, 3, 1, 0, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 3, 2, 1, 3, - 2, 3, 2, 1, 3, 3, 3, 1, 5, 1, - 3, 2, 3, 3, 2, 1, 3 + 2, 3, 2, 1, 3, 3, 5, 3, 1, 5, + 1, 3, 2, 3, 3, 2, 1, 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -374,43 +375,43 @@ static const unsigned char yydefact[] = { 4, 0, 21, 0, 12, 0, 0, 0, 0, 2, 22, 23, 24, 25, 20, 0, 8, 0, 0, 18, - 19, 3, 0, 5, 6, 32, 33, 0, 44, 0, - 45, 0, 1, 0, 13, 11, 0, 0, 28, 0, - 37, 39, 0, 7, 16, 17, 0, 5, 31, 0, - 11, 43, 0, 10, 27, 0, 11, 15, 14, 26, - 30, 35, 41, 9, 34, 42, 46, 0, 36, 29, - 40, 11, 38 + 19, 3, 0, 5, 6, 32, 33, 0, 45, 0, + 46, 0, 1, 0, 13, 11, 0, 0, 28, 0, + 38, 40, 0, 7, 16, 0, 17, 0, 0, 5, + 31, 0, 11, 44, 0, 15, 0, 10, 27, 0, + 11, 14, 26, 30, 35, 42, 9, 34, 43, 47, + 0, 0, 37, 29, 41, 36, 11, 39 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yysigned_char yydefgoto[] = { - -1, 7, 53, 54, 22, 59, 60, 23, 24, 10, + -1, 7, 57, 58, 22, 62, 56, 23, 24, 10, 38, 39, 11, 27, 12, 40, 41, 42, 30, 13, 31 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -49 -static const yysigned_char yypact[] = +#define YYPACT_NINF -45 +static const short yypact[] = { - 7, 113, -49, 97, -49, 80, 52, 15, 68, -49, - -49, -49, -49, -49, -49, 97, -49, 104, 88, -49, - -49, -49, 24, -49, -49, -49, -49, 19, -49, 4, - -49, 28, -49, 88, -49, 97, 97, 6, -49, 32, - -49, -49, 32, -49, -49, -49, 26, 6, -49, 97, - 97, -49, 97, -49, -49, 30, 97, -49, -49, -49, - 39, -49, 59, -49, -49, -49, -49, 47, -49, -49, - -49, 97, -49 + 156, 167, -45, 121, -45, 104, 76, 19, 92, -45, + -45, -45, -45, -45, -45, 121, -45, 151, 111, -45, + -45, -45, 56, -45, -45, -45, -45, 8, -45, 9, + -45, -3, -45, 39, -45, 121, 121, 12, -45, 18, + -45, -45, 18, -45, -45, 111, -45, 136, 22, 12, + -45, 121, 121, -45, 121, -45, 83, -45, -45, 24, + 121, -45, -45, 26, -45, 83, -45, -45, -45, -45, + 18, 23, -45, -45, -45, -45, 121, -45 }; /* YYPGOTO[NTERM-NUM]. */ static const yysigned_char yypgoto[] = { - -49, -49, -2, -48, 5, -35, 37, -8, 51, -49, - 10, -49, -49, -49, -49, -49, 16, -49, 25, -49, - -49 + -45, -45, -2, -44, 6, -27, -37, -8, 11, -45, + -22, -45, -45, -45, -45, -45, -23, -6, 0, -45, + -45 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -420,38 +421,48 @@ static const yysigned_char yypgoto[] = #define YYTABLE_NINF -1 static const unsigned char yytable[] = { - 37, 21, 65, 26, 29, 8, 8, 61, 68, 44, - 45, 63, 1, 43, 47, 32, 2, 3, 4, 50, - 46, 56, 8, 72, 5, 44, 6, 15, 16, 17, - 18, 19, 20, 2, 55, 4, 34, 48, 35, 58, - 49, 5, 57, 6, 57, 58, 36, 64, 51, 52, - 29, 9, 14, 35, 37, 15, 16, 17, 18, 19, - 20, 2, 71, 4, 33, 18, 19, 20, 14, 5, - 69, 6, 28, 33, 18, 19, 20, 66, 70, 62, - 34, 36, 35, 15, 16, 17, 18, 19, 20, 2, - 36, 4, 67, 33, 18, 19, 20, 5, 25, 6, - 15, 16, 17, 18, 19, 20, 2, 0, 4, 17, - 18, 19, 20, 2, 5, 4, 6, 0, 1, 0, - 0, 5, 2, 6, 4, 0, 0, 0, 0, 0, - 5, 0, 6 + 37, 21, 63, 26, 29, 65, 8, 8, 68, 44, + 46, 9, 14, 43, 49, 64, 72, 53, 54, 32, + 48, 66, 71, 8, 52, 44, 50, 60, 14, 51, + 55, 61, 77, 65, 59, 61, 55, 44, 76, 44, + 35, 73, 74, 75, 45, 18, 19, 20, 37, 67, + 70, 55, 29, 8, 69, 0, 0, 37, 14, 15, + 16, 47, 18, 19, 20, 2, 0, 4, 34, 0, + 35, 0, 0, 5, 0, 6, 0, 0, 36, 15, + 16, 17, 18, 19, 20, 2, 0, 4, 45, 18, + 19, 20, 0, 5, 0, 6, 28, 33, 18, 19, + 20, 0, 0, 0, 34, 36, 35, 15, 16, 17, + 18, 19, 20, 2, 36, 4, 45, 18, 19, 20, + 0, 5, 25, 6, 15, 16, 17, 18, 19, 20, + 2, 0, 4, 0, 0, 0, 0, 0, 5, 0, + 6, 17, 18, 19, 20, 2, 0, 4, 55, 0, + 0, 0, 0, 5, 0, 6, 17, 18, 19, 20, + 2, 1, 4, 0, 0, 2, 3, 4, 5, 0, + 6, 0, 1, 5, 0, 6, 2, 0, 4, 0, + 0, 0, 0, 0, 5, 0, 6 }; static const yysigned_char yycheck[] = { - 8, 3, 50, 5, 6, 0, 1, 42, 56, 17, - 18, 46, 5, 15, 22, 0, 9, 10, 11, 15, - 22, 15, 17, 71, 17, 33, 19, 3, 4, 5, - 6, 7, 8, 9, 36, 11, 12, 18, 14, 13, - 21, 17, 12, 19, 12, 13, 22, 49, 20, 21, - 52, 0, 1, 14, 62, 3, 4, 5, 6, 7, - 8, 9, 15, 11, 5, 6, 7, 8, 17, 17, - 60, 19, 20, 5, 6, 7, 8, 52, 62, 42, - 12, 22, 14, 3, 4, 5, 6, 7, 8, 9, - 22, 11, 55, 5, 6, 7, 8, 17, 18, 19, - 3, 4, 5, 6, 7, 8, 9, -1, 11, 5, - 6, 7, 8, 9, 17, 11, 19, -1, 5, -1, - -1, 17, 9, 19, 11, -1, -1, -1, -1, -1, - 17, -1, 19 + 8, 3, 39, 5, 6, 42, 0, 1, 52, 17, + 18, 0, 1, 15, 22, 42, 60, 20, 21, 0, + 22, 48, 59, 17, 15, 33, 18, 15, 17, 21, + 12, 13, 76, 70, 36, 13, 12, 45, 15, 47, + 14, 63, 65, 70, 5, 6, 7, 8, 56, 51, + 56, 12, 54, 47, 54, -1, -1, 65, 47, 3, + 4, 5, 6, 7, 8, 9, -1, 11, 12, -1, + 14, -1, -1, 17, -1, 19, -1, -1, 22, 3, + 4, 5, 6, 7, 8, 9, -1, 11, 5, 6, + 7, 8, -1, 17, -1, 19, 20, 5, 6, 7, + 8, -1, -1, -1, 12, 22, 14, 3, 4, 5, + 6, 7, 8, 9, 22, 11, 5, 6, 7, 8, + -1, 17, 18, 19, 3, 4, 5, 6, 7, 8, + 9, -1, 11, -1, -1, -1, -1, -1, 17, -1, + 19, 5, 6, 7, 8, 9, -1, 11, 12, -1, + -1, -1, -1, 17, -1, 19, 5, 6, 7, 8, + 9, 5, 11, -1, -1, 9, 10, 11, 17, -1, + 19, -1, 5, 17, -1, 19, 9, -1, 11, -1, + -1, -1, -1, -1, 17, -1, 19 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -462,10 +473,10 @@ static const unsigned char yystos[] = 32, 35, 37, 42, 31, 3, 4, 5, 6, 7, 8, 25, 27, 30, 31, 18, 25, 36, 20, 25, 41, 43, 0, 5, 12, 14, 22, 30, 33, 34, - 38, 39, 40, 25, 30, 30, 25, 30, 18, 21, - 15, 20, 21, 25, 26, 25, 15, 12, 13, 28, - 29, 28, 29, 28, 25, 26, 41, 29, 26, 33, - 39, 15, 26 + 38, 39, 40, 25, 30, 5, 30, 5, 25, 30, + 18, 21, 15, 20, 21, 12, 29, 25, 26, 25, + 15, 13, 28, 29, 28, 29, 28, 25, 26, 41, + 40, 29, 26, 33, 39, 28, 15, 26 }; #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) @@ -1202,7 +1213,15 @@ yyreduce: break; case 36: -#line 226 "gram.y" +#line 224 "gram.y" + { + syck_add_transfer( yyvsp[-3].name, yyvsp[-1].nodeData, ((SyckParser *)parser)->taguri_expansion ); + yyval.nodeData = yyvsp[-1].nodeData; + } + break; + + case 37: +#line 231 "gram.y" { yyval.nodeData = syck_new_map( syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ), @@ -1210,8 +1229,8 @@ yyreduce: } break; - case 38: -#line 242 "gram.y" + case 39: +#line 247 "gram.y" { yyval.nodeData = syck_new_map( syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-3].nodeData ), @@ -1219,23 +1238,23 @@ yyreduce: } break; - case 40: -#line 251 "gram.y" + case 41: +#line 256 "gram.y" { syck_map_update( yyvsp[-2].nodeData, yyvsp[0].nodeData ); yyval.nodeData = yyvsp[-2].nodeData; } break; - case 41: -#line 256 "gram.y" + case 42: +#line 261 "gram.y" { yyval.nodeData = yyvsp[-1].nodeData; } break; - case 42: -#line 265 "gram.y" + case 43: +#line 270 "gram.y" { yyval.nodeData = syck_new_map( syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ), @@ -1243,22 +1262,22 @@ yyreduce: } break; - case 43: -#line 273 "gram.y" + case 44: +#line 278 "gram.y" { yyval.nodeData = yyvsp[-1].nodeData; } break; - case 44: -#line 277 "gram.y" + case 45: +#line 282 "gram.y" { yyval.nodeData = syck_alloc_map(); } break; - case 46: -#line 284 "gram.y" + case 47: +#line 289 "gram.y" { syck_map_update( yyvsp[-2].nodeData, yyvsp[0].nodeData ); yyval.nodeData = yyvsp[-2].nodeData; @@ -1269,7 +1288,7 @@ yyreduce: } /* Line 1016 of /usr/local/share/bison/yacc.c. */ -#line 1273 "y.tab.c" +#line 1292 "y.tab.c" yyvsp -= yylen; yyssp -= yylen; @@ -1488,7 +1507,7 @@ yyreturn: } -#line 290 "gram.y" +#line 295 "gram.y" -- cgit v1.2.3