summaryrefslogtreecommitdiff
path: root/ext/syck/gram.c
diff options
context:
space:
mode:
authorwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-05 04:43:05 +0000
committerwhy <why@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-05 04:43:05 +0000
commit017d4ff10ae32ed6570b5d33a8106bd1f22e008f (patch)
treec0485110aa5ea341f821cb6bfa210041b71813e3 /ext/syck/gram.c
parent45c7ea552d0293aa217bbb496d4238754ba701d2 (diff)
* ext/syck/token.c: directives choked on a period.
* ext/syck/gram.y: anchors work above a collection. [ruby-core:1071] * ext/syck/handler.c, ext/syck/syck.c: ensure a fresh strtable between parser iterations. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/syck/gram.c')
-rw-r--r--ext/syck/gram.c261
1 files changed, 151 insertions, 110 deletions
diff --git a/ext/syck/gram.c b/ext/syck/gram.c
index 03f31616661..18604370295 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 34
-#define YYLAST 284
+#define YYLAST 307
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 23
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 24
+#define YYNNTS 25
/* YYNRULES -- Number of rules. */
-#define YYNRULES 58
+#define YYNRULES 62
/* YYNRULES -- Number of states. */
-#define YYNSTATES 99
+#define YYNSTATES 104
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -288,8 +288,9 @@ static const unsigned char yyprhs[] =
22, 26, 28, 29, 31, 34, 36, 38, 40, 43,
46, 49, 52, 54, 56, 58, 61, 63, 65, 67,
69, 71, 75, 78, 80, 84, 87, 91, 94, 96,
- 100, 103, 107, 110, 112, 116, 120, 126, 130, 132,
- 138, 140, 144, 148, 151, 155, 159, 162, 164
+ 100, 103, 107, 110, 112, 116, 120, 124, 128, 131,
+ 135, 138, 142, 144, 150, 152, 156, 160, 163, 167,
+ 171, 174, 176
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -301,17 +302,18 @@ static const yysigned_char yyrhs[] =
-1, 28, 12, -1, 13, -1, 12, -1, 13, -1,
30, 31, -1, 5, 32, -1, 6, 32, -1, 3,
32, -1, 4, -1, 7, -1, 8, -1, 5, 33,
- -1, 9, -1, 34, -1, 38, -1, 40, -1, 45,
+ -1, 9, -1, 34, -1, 38, -1, 40, -1, 46,
-1, 28, 36, 29, -1, 14, 27, -1, 37, -1,
5, 30, 36, -1, 5, 36, -1, 3, 30, 36,
-1, 3, 36, -1, 35, -1, 37, 30, 35, -1,
37, 30, -1, 17, 39, 18, -1, 17, 18, -1,
- 25, -1, 39, 21, 25, -1, 28, 43, 29, -1,
- 28, 5, 30, 43, 29, -1, 32, 15, 27, -1,
- 41, -1, 22, 25, 30, 15, 27, -1, 42, -1,
- 43, 30, 35, -1, 43, 30, 42, -1, 43, 30,
- -1, 25, 15, 27, -1, 19, 46, 20, -1, 19,
- 20, -1, 44, -1, 46, 21, 44, -1
+ 25, -1, 39, 21, 25, -1, 28, 41, 29, -1,
+ 28, 44, 29, -1, 5, 30, 44, -1, 5, 41,
+ -1, 3, 30, 44, -1, 3, 41, -1, 32, 15,
+ 27, -1, 42, -1, 22, 25, 30, 15, 27, -1,
+ 43, -1, 44, 30, 35, -1, 44, 30, 43, -1,
+ 44, 30, -1, 25, 15, 27, -1, 19, 47, 20,
+ -1, 19, 20, -1, 45, -1, 47, 21, 45, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -321,8 +323,9 @@ static const unsigned short yyrline[] =
76, 82, 83, 101, 102, 105, 108, 111, 112, 120,
125, 133, 137, 145, 158, 165, 170, 171, 172, 173,
174, 180, 186, 192, 193, 198, 203, 207, 213, 217,
- 222, 231, 235, 241, 245, 255, 260, 268, 283, 284,
- 292, 293, 305, 312, 321, 329, 333, 339, 340
+ 222, 231, 235, 241, 245, 255, 260, 267, 272, 277,
+ 281, 287, 302, 303, 311, 312, 324, 331, 340, 348,
+ 352, 358, 359
};
#endif
@@ -337,9 +340,9 @@ static const char *const yytname[] =
"doc", "atom", "ind_rep", "atom_or_empty", "indent_open", "indent_end",
"indent_sep", "indent_flex_end", "word_rep", "struct_rep",
"implicit_seq", "basic_seq", "top_imp_seq", "in_implicit_seq",
- "inline_seq", "in_inline_seq", "implicit_map", "basic_mapping",
- "complex_mapping", "in_implicit_map", "basic_mapping2", "inline_map",
- "in_inline_map", 0
+ "inline_seq", "in_inline_seq", "implicit_map", "top_imp_map",
+ "basic_mapping", "complex_mapping", "in_implicit_map", "basic_mapping2",
+ "inline_map", "in_inline_map", 0
};
#endif
@@ -361,8 +364,9 @@ static const unsigned char yyr1[] =
26, 27, 27, 28, 28, 29, 30, 31, 31, 32,
32, 32, 32, 32, 32, 33, 33, 33, 33, 33,
33, 34, 35, 36, 36, 36, 36, 36, 37, 37,
- 37, 38, 38, 39, 39, 40, 40, 41, 42, 42,
- 43, 43, 43, 43, 44, 45, 45, 46, 46
+ 37, 38, 38, 39, 39, 40, 40, 41, 41, 41,
+ 41, 42, 43, 43, 44, 44, 44, 44, 45, 46,
+ 46, 47, 47
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -372,8 +376,9 @@ static const unsigned char yyr2[] =
3, 1, 0, 1, 2, 1, 1, 1, 2, 2,
2, 2, 1, 1, 1, 2, 1, 1, 1, 1,
1, 3, 2, 1, 3, 2, 3, 2, 1, 3,
- 2, 3, 2, 1, 3, 3, 5, 3, 1, 5,
- 1, 3, 3, 2, 3, 3, 2, 1, 3
+ 2, 3, 2, 1, 3, 3, 3, 3, 2, 3,
+ 2, 3, 1, 5, 1, 3, 3, 2, 3, 3,
+ 2, 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -384,46 +389,48 @@ static const unsigned char yydefact[] =
4, 0, 26, 12, 13, 0, 0, 0, 0, 2,
27, 28, 29, 30, 25, 0, 22, 0, 0, 23,
24, 11, 6, 3, 0, 5, 7, 42, 43, 0,
- 56, 0, 57, 0, 1, 0, 0, 14, 12, 0,
- 0, 38, 0, 33, 48, 50, 0, 8, 21, 0,
- 19, 0, 20, 0, 0, 0, 0, 41, 0, 12,
- 55, 0, 0, 16, 0, 37, 0, 35, 32, 0,
- 12, 15, 31, 40, 45, 53, 0, 17, 0, 10,
- 9, 44, 54, 58, 0, 0, 0, 36, 34, 0,
- 0, 47, 39, 51, 52, 18, 46, 12, 49
+ 60, 0, 61, 0, 1, 0, 0, 14, 12, 0,
+ 0, 38, 0, 33, 0, 52, 54, 0, 8, 21,
+ 0, 19, 0, 20, 0, 0, 0, 0, 41, 0,
+ 12, 59, 0, 16, 0, 37, 50, 0, 35, 48,
+ 32, 0, 12, 15, 31, 40, 45, 46, 57, 17,
+ 0, 10, 9, 44, 58, 62, 0, 0, 36, 49,
+ 34, 47, 0, 51, 39, 55, 56, 18, 0, 0,
+ 12, 0, 0, 53
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yysigned_char yydefgoto[] =
{
- -1, 7, 21, 22, 23, 24, 72, 64, 79, 25,
- 26, 10, 41, 67, 43, 11, 29, 12, 44, 45,
- 46, 32, 13, 33
+ -1, 7, 21, 22, 23, 24, 74, 78, 81, 25,
+ 26, 10, 41, 65, 43, 11, 29, 12, 44, 45,
+ 46, 47, 32, 13, 33
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -47
+#define YYPACT_NINF -48
static const short yypact[] =
{
- 4, 241, -47, 219, -47, 202, 150, 2, 114, -47,
- -47, -47, -47, -47, -47, 219, -47, 236, 276, -47,
- -47, -47, -47, -47, 94, -47, -47, -47, -47, 8,
- -47, 10, -47, -9, -47, 258, 258, -47, 219, 219,
- 15, -47, 29, 37, -47, -47, 6, -47, -47, 276,
- -47, 276, -47, 168, 185, 23, 35, -47, 219, 219,
- -47, 219, 258, -47, 81, -47, 126, -47, -47, 37,
- 219, -47, -47, 39, -47, 138, 185, -47, 23, -47,
- -47, -47, -47, -47, 81, 264, 264, -47, -47, 6,
- 40, -47, -47, -47, -47, -47, -47, 219, -47
+ 241, 252, -48, 219, -48, 202, 150, 13, 114, -48,
+ -48, -48, -48, -48, -48, 219, -48, 236, 299, -48,
+ -48, -48, -48, -48, 94, -48, -48, -48, -48, 4,
+ -48, 2, -48, -15, -48, 269, 269, -48, 219, 219,
+ 6, -48, 23, 20, 23, -48, -48, 54, -48, -48,
+ 299, -48, 299, -48, 168, 185, 75, 38, -48, 219,
+ 219, -48, 219, -48, 126, -48, -48, 126, -48, -48,
+ -48, 20, 219, -48, -48, 12, -48, -48, 138, -48,
+ 75, -48, -48, -48, -48, -48, 281, 281, -48, 20,
+ -48, 20, 37, -48, -48, -48, -48, -48, 79, 79,
+ 219, 287, 287, -48
};
/* YYPGOTO[NTERM-NUM]. */
static const yysigned_char yypgoto[] =
{
- -47, -47, 32, -7, -31, 3, -45, 18, -46, 16,
- 5, -47, -32, -8, -47, -47, -47, -47, -47, -15,
- -4, 7, -47, -47
+ -48, -48, -2, 19, -37, 7, 21, -16, -47, -6,
+ 14, -48, -33, -8, -48, -48, -48, -48, 41, -48,
+ -24, 11, 27, -48, -48
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -433,50 +440,52 @@ static const yysigned_char yypgoto[] =
#define YYTABLE_NINF -1
static const unsigned char yytable[] =
{
- 42, 74, 34, 8, 8, 9, 14, 68, 47, 1,
- 80, 60, 61, 2, 3, 4, 42, 55, 63, 71,
- 8, 5, 14, 6, 40, 59, 57, 65, 82, 58,
- 70, 48, 95, 50, 52, 63, 77, 28, 31, 91,
- 56, 92, 71, 93, 96, 65, 47, 63, 77, 63,
- 70, 48, 50, 38, 66, 97, 87, 8, 88, 14,
- 94, 73, 89, 0, 75, 48, 98, 50, 83, 48,
- 50, 69, 66, 78, 78, 0, 88, 65, 50, 8,
- 84, 14, 40, 0, 85, 0, 86, 90, 0, 0,
- 81, 40, 50, 31, 84, 38, 78, 53, 16, 54,
- 18, 19, 20, 2, 84, 4, 37, 75, 38, 0,
+ 42, 70, 40, 28, 31, 61, 62, 8, 8, 49,
+ 82, 51, 53, 34, 9, 14, 42, 60, 57, 64,
+ 67, 72, 58, 84, 8, 59, 38, 75, 68, 49,
+ 51, 14, 63, 97, 48, 93, 73, 71, 64, 67,
+ 80, 80, 94, 56, 49, 95, 51, 68, 49, 51,
+ 63, 79, 100, 72, 96, 92, 88, 83, 40, 90,
+ 31, 40, 8, 103, 80, 76, 63, 73, 77, 14,
+ 98, 99, 40, 48, 0, 89, 66, 69, 91, 68,
+ 49, 51, 101, 0, 102, 98, 99, 63, 79, 85,
+ 88, 90, 0, 38, 68, 66, 69, 54, 16, 55,
+ 18, 19, 20, 2, 0, 4, 37, 0, 38, 0,
0, 5, 0, 6, 0, 0, 39, 35, 16, 36,
- 18, 19, 20, 0, 0, 0, 37, 0, 38, 35,
- 16, 62, 18, 19, 20, 0, 39, 0, 0, 0,
- 38, 49, 16, 51, 18, 19, 20, 0, 39, 0,
+ 18, 19, 20, 0, 0, 0, 37, 0, 38, 86,
+ 16, 87, 18, 19, 20, 0, 39, 0, 0, 0,
+ 38, 50, 16, 52, 18, 19, 20, 0, 39, 0,
0, 0, 38, 15, 16, 17, 18, 19, 20, 2,
39, 4, 0, 0, 0, 0, 0, 5, 0, 6,
- 30, 53, 16, 76, 18, 19, 20, 2, 0, 4,
+ 30, 54, 16, 55, 18, 19, 20, 2, 0, 4,
63, 0, 38, 0, 0, 5, 0, 6, 35, 16,
- 76, 18, 19, 20, 2, 0, 4, 63, 0, 38,
+ 55, 18, 19, 20, 2, 0, 4, 63, 0, 38,
0, 0, 5, 0, 6, 15, 16, 17, 18, 19,
20, 2, 0, 4, 0, 0, 0, 0, 0, 5,
27, 6, 15, 16, 17, 18, 19, 20, 2, 0,
- 4, 0, 0, 0, 0, 0, 5, 0, 6, 49,
+ 4, 0, 0, 0, 0, 0, 5, 0, 6, 50,
16, 17, 18, 19, 20, 2, 1, 4, 0, 0,
- 2, 0, 4, 5, 0, 6, 0, 0, 5, 0,
- 6, 35, 16, 62, 18, 19, 20, 85, 0, 86,
- 63, 0, 38, 0, 0, 0, 63, 0, 38, 49,
- 16, 51, 18, 19, 20
+ 2, 3, 4, 5, 0, 6, 0, 1, 5, 0,
+ 6, 2, 0, 4, 0, 0, 0, 0, 0, 5,
+ 0, 6, 35, 16, 36, 18, 19, 20, 0, 0,
+ 0, 63, 0, 38, 86, 16, 87, 18, 19, 20,
+ 101, 0, 102, 63, 0, 38, 0, 0, 0, 63,
+ 0, 38, 50, 16, 52, 18, 19, 20
};
static const yysigned_char yycheck[] =
{
- 8, 46, 0, 0, 1, 0, 1, 38, 15, 5,
- 56, 20, 21, 9, 10, 11, 24, 24, 12, 13,
- 17, 17, 17, 19, 8, 15, 18, 35, 59, 21,
- 15, 15, 78, 17, 18, 12, 13, 5, 6, 70,
- 24, 73, 13, 75, 89, 53, 53, 12, 13, 12,
- 15, 35, 36, 14, 36, 15, 64, 54, 66, 54,
- 75, 43, 66, -1, 46, 49, 97, 51, 61, 53,
- 54, 39, 54, 55, 56, -1, 84, 85, 62, 76,
- 62, 76, 66, -1, 3, -1, 5, 69, -1, -1,
- 58, 75, 76, 61, 76, 14, 78, 3, 4, 5,
- 6, 7, 8, 9, 86, 11, 12, 89, 14, -1,
+ 8, 38, 8, 5, 6, 20, 21, 0, 1, 15,
+ 57, 17, 18, 0, 0, 1, 24, 15, 24, 35,
+ 36, 15, 18, 60, 17, 21, 14, 43, 36, 35,
+ 36, 17, 12, 80, 15, 72, 13, 39, 54, 55,
+ 56, 57, 75, 24, 50, 78, 52, 55, 54, 55,
+ 12, 13, 15, 15, 78, 71, 64, 59, 64, 67,
+ 62, 67, 55, 100, 80, 44, 12, 13, 47, 55,
+ 86, 87, 78, 54, -1, 64, 35, 36, 67, 87,
+ 86, 87, 3, -1, 5, 101, 102, 12, 13, 62,
+ 98, 99, -1, 14, 102, 54, 55, 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, -1, -1, -1, 12, -1, 14, 3,
4, 5, 6, 7, 8, -1, 22, -1, -1, -1,
@@ -491,10 +500,12 @@ static const yysigned_char yycheck[] =
18, 19, 3, 4, 5, 6, 7, 8, 9, -1,
11, -1, -1, -1, -1, -1, 17, -1, 19, 3,
4, 5, 6, 7, 8, 9, 5, 11, -1, -1,
- 9, -1, 11, 17, -1, 19, -1, -1, 17, -1,
- 19, 3, 4, 5, 6, 7, 8, 3, -1, 5,
- 12, -1, 14, -1, -1, -1, 12, -1, 14, 3,
- 4, 5, 6, 7, 8
+ 9, 10, 11, 17, -1, 19, -1, 5, 17, -1,
+ 19, 9, -1, 11, -1, -1, -1, -1, -1, 17,
+ -1, 19, 3, 4, 5, 6, 7, 8, -1, -1,
+ -1, 12, -1, 14, 3, 4, 5, 6, 7, 8,
+ 3, -1, 5, 12, -1, 14, -1, -1, -1, 12,
+ -1, 14, 3, 4, 5, 6, 7, 8
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -502,15 +513,16 @@ static const yysigned_char yycheck[] =
static const unsigned char yystos[] =
{
0, 5, 9, 10, 11, 17, 19, 24, 28, 33,
- 34, 38, 40, 45, 33, 3, 4, 5, 6, 7,
+ 34, 38, 40, 46, 33, 3, 4, 5, 6, 7,
8, 25, 26, 27, 28, 32, 33, 18, 25, 39,
- 20, 25, 44, 46, 0, 3, 5, 12, 14, 22,
- 32, 35, 36, 37, 41, 42, 43, 26, 32, 3,
- 32, 5, 32, 3, 5, 26, 32, 18, 21, 15,
- 20, 21, 5, 12, 30, 36, 30, 36, 27, 25,
- 15, 13, 29, 30, 29, 30, 5, 13, 30, 31,
- 31, 25, 27, 44, 30, 3, 5, 36, 36, 43,
- 30, 27, 35, 35, 42, 31, 29, 15, 27
+ 20, 25, 45, 47, 0, 3, 5, 12, 14, 22,
+ 32, 35, 36, 37, 41, 42, 43, 44, 26, 32,
+ 3, 32, 5, 32, 3, 5, 26, 32, 18, 21,
+ 15, 20, 21, 12, 30, 36, 41, 30, 36, 41,
+ 27, 25, 15, 13, 29, 30, 29, 29, 30, 13,
+ 30, 31, 31, 25, 27, 45, 3, 5, 36, 44,
+ 36, 44, 30, 27, 35, 35, 43, 31, 30, 30,
+ 15, 3, 5, 27
};
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
@@ -1295,13 +1307,42 @@ yyreduce:
#line 261 "gram.y"
{
apply_seq_in_map( (SyckParser *)parser, yyvsp[-1].nodeData );
- syck_add_transfer( yyvsp[-3].name, yyvsp[-1].nodeData, ((SyckParser *)parser)->taguri_expansion );
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
case 47:
-#line 269 "gram.y"
+#line 268 "gram.y"
+ {
+ syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
+ yyval.nodeData = yyvsp[0].nodeData;
+ }
+ break;
+
+ case 48:
+#line 273 "gram.y"
+ {
+ syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
+ yyval.nodeData = yyvsp[0].nodeData;
+ }
+ break;
+
+ case 49:
+#line 278 "gram.y"
+ {
+ yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-2].name, yyvsp[0].nodeData );
+ }
+ break;
+
+ case 50:
+#line 282 "gram.y"
+ {
+ yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
+ }
+ break;
+
+ case 51:
+#line 288 "gram.y"
{
yyval.nodeData = syck_new_map(
syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ),
@@ -1309,8 +1350,8 @@ yyreduce:
}
break;
- case 49:
-#line 285 "gram.y"
+ case 53:
+#line 304 "gram.y"
{
yyval.nodeData = syck_new_map(
syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-3].nodeData ),
@@ -1318,8 +1359,8 @@ yyreduce:
}
break;
- case 51:
-#line 294 "gram.y"
+ case 55:
+#line 313 "gram.y"
{
if ( yyvsp[-2].nodeData->shortcut == NULL )
{
@@ -1333,8 +1374,8 @@ yyreduce:
}
break;
- case 52:
-#line 306 "gram.y"
+ case 56:
+#line 325 "gram.y"
{
apply_seq_in_map( (SyckParser *)parser, yyvsp[-2].nodeData );
syck_map_update( yyvsp[-2].nodeData, yyvsp[0].nodeData );
@@ -1343,15 +1384,15 @@ yyreduce:
}
break;
- case 53:
-#line 313 "gram.y"
+ case 57:
+#line 332 "gram.y"
{
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 54:
-#line 322 "gram.y"
+ case 58:
+#line 341 "gram.y"
{
yyval.nodeData = syck_new_map(
syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ),
@@ -1359,22 +1400,22 @@ yyreduce:
}
break;
- case 55:
-#line 330 "gram.y"
+ case 59:
+#line 349 "gram.y"
{
yyval.nodeData = yyvsp[-1].nodeData;
}
break;
- case 56:
-#line 334 "gram.y"
+ case 60:
+#line 353 "gram.y"
{
yyval.nodeData = syck_alloc_map();
}
break;
- case 58:
-#line 341 "gram.y"
+ case 62:
+#line 360 "gram.y"
{
syck_map_update( yyvsp[-2].nodeData, yyvsp[0].nodeData );
syck_free_node( yyvsp[0].nodeData );
@@ -1386,7 +1427,7 @@ yyreduce:
}
/* Line 1016 of /usr/local/share/bison/yacc.c. */
-#line 1390 "y.tab.c"
+#line 1431 "y.tab.c"
yyvsp -= yylen;
yyssp -= yylen;
@@ -1605,7 +1646,7 @@ yyreturn:
}
-#line 348 "gram.y"
+#line 367 "gram.y"
void