* io.c (rb_open_file): encoding in mode string was ignored if perm is
[ruby-svn.git] / ext / syck / gram.c
blob615a594f613238679d5d6a3fb0d674122bfb9cea
1 /* A Bison parser, made by GNU Bison 1.875d. */
3 /* Skeleton parser for Yacc-like parsing with Bison,
4 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
21 /* As a special exception, when this file is copied by Bison into a
22 Bison output file, you may use that output file without restriction.
23 This special exception was added by the Free Software Foundation
24 in version 1.24 of Bison. */
26 /* Written by Richard Stallman by simplifying the original so called
27 ``semantic'' parser. */
29 /* All symbols defined below should begin with yy or YY, to avoid
30 infringing on user name space. This should be done even for local
31 variables, as they might otherwise be expanded by user macros.
32 There are some unavoidable exceptions within include files to
33 define necessary library symbols; they are noted "INFRINGES ON
34 USER NAME SPACE" below. */
36 /* Identify Bison output. */
37 #define YYBISON 1
39 /* Skeleton name. */
40 #define YYSKELETON_NAME "yacc.c"
42 /* Pure parsers. */
43 #define YYPURE 1
45 /* Using locations. */
46 #define YYLSP_NEEDED 0
48 /* If NAME_PREFIX is specified substitute the variables and functions
49 names. */
50 #define yyparse syckparse
51 #define yylex sycklex
52 #define yyerror syckerror
53 #define yylval sycklval
54 #define yychar syckchar
55 #define yydebug syckdebug
56 #define yynerrs sycknerrs
59 /* Tokens. */
60 #ifndef YYTOKENTYPE
61 # define YYTOKENTYPE
62 /* Put the tokens into the symbol table, so that GDB and other debuggers
63 know about them. */
64 enum yytokentype {
65 YAML_ANCHOR = 258,
66 YAML_ALIAS = 259,
67 YAML_TRANSFER = 260,
68 YAML_TAGURI = 261,
69 YAML_ITRANSFER = 262,
70 YAML_WORD = 263,
71 YAML_PLAIN = 264,
72 YAML_BLOCK = 265,
73 YAML_DOCSEP = 266,
74 YAML_IOPEN = 267,
75 YAML_INDENT = 268,
76 YAML_IEND = 269
78 #endif
79 #define YAML_ANCHOR 258
80 #define YAML_ALIAS 259
81 #define YAML_TRANSFER 260
82 #define YAML_TAGURI 261
83 #define YAML_ITRANSFER 262
84 #define YAML_WORD 263
85 #define YAML_PLAIN 264
86 #define YAML_BLOCK 265
87 #define YAML_DOCSEP 266
88 #define YAML_IOPEN 267
89 #define YAML_INDENT 268
90 #define YAML_IEND 269
95 /* Copy the first part of user declarations. */
96 #line 14 "gram.y"
99 #include "syck.h"
101 void apply_seq_in_map( SyckParser *parser, SyckNode *n );
103 #define YYPARSE_PARAM parser
104 #define YYLEX_PARAM parser
106 #define NULL_NODE(parser, node) \
107 SyckNode *node = syck_new_str( "", scalar_plain ); \
108 if ( ((SyckParser *)parser)->taguri_expansion == 1 ) \
110 node->type_id = syck_taguri( YAML_DOMAIN, "null", 4 ); \
112 else \
114 node->type_id = syck_strndup( "null", 4 ); \
118 /* Enabling traces. */
119 #ifndef YYDEBUG
120 # define YYDEBUG 1
121 #endif
123 /* Enabling verbose error messages. */
124 #ifdef YYERROR_VERBOSE
125 # undef YYERROR_VERBOSE
126 # define YYERROR_VERBOSE 1
127 #else
128 # define YYERROR_VERBOSE 0
129 #endif
131 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
132 #line 35 "gram.y"
133 typedef union YYSTYPE {
134 SYMID nodeId;
135 SyckNode *nodeData;
136 char *name;
137 } YYSTYPE;
138 /* Line 191 of yacc.c. */
139 #line 140 "gram.c"
140 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
141 # define YYSTYPE_IS_DECLARED 1
142 # define YYSTYPE_IS_TRIVIAL 1
143 #endif
147 /* Copy the second part of user declarations. */
150 /* Line 214 of yacc.c. */
151 #line 152 "gram.c"
153 #if ! defined (yyoverflow) || YYERROR_VERBOSE
155 # ifndef YYFREE
156 # define YYFREE free
157 # endif
158 # ifndef YYMALLOC
159 # define YYMALLOC malloc
160 # endif
162 /* The parser invokes alloca or malloc; define the necessary symbols. */
164 # ifdef YYSTACK_USE_ALLOCA
165 # if YYSTACK_USE_ALLOCA
166 # define YYSTACK_ALLOC alloca
167 # endif
168 # else
169 # if defined (alloca) || defined (_ALLOCA_H)
170 # define YYSTACK_ALLOC alloca
171 # else
172 # ifdef __GNUC__
173 # define YYSTACK_ALLOC __builtin_alloca
174 # endif
175 # endif
176 # endif
178 # ifdef YYSTACK_ALLOC
179 /* Pacify GCC's `empty if-body' warning. */
180 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
181 # else
182 # if defined (__STDC__) || defined (__cplusplus)
183 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
184 # define YYSIZE_T size_t
185 # endif
186 # define YYSTACK_ALLOC YYMALLOC
187 # define YYSTACK_FREE YYFREE
188 # endif
189 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
192 #if (! defined (yyoverflow) \
193 && (! defined (__cplusplus) \
194 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))
196 /* A type that is properly aligned for any stack member. */
197 union yyalloc
199 short int yyss;
200 YYSTYPE yyvs;
203 /* The size of the maximum gap between one aligned stack and the next. */
204 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
206 /* The size of an array large to enough to hold all stacks, each with
207 N elements. */
208 # define YYSTACK_BYTES(N) \
209 ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
210 + YYSTACK_GAP_MAXIMUM)
212 /* Copy COUNT objects from FROM to TO. The source and destination do
213 not overlap. */
214 # ifndef YYCOPY
215 # if defined (__GNUC__) && 1 < __GNUC__
216 # define YYCOPY(To, From, Count) \
217 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
218 # else
219 # define YYCOPY(To, From, Count) \
220 do \
222 register YYSIZE_T yyi; \
223 for (yyi = 0; yyi < (Count); yyi++) \
224 (To)[yyi] = (From)[yyi]; \
226 while (0)
227 # endif
228 # endif
230 /* Relocate STACK from its old location to the new one. The
231 local variables YYSIZE and YYSTACKSIZE give the old and new number of
232 elements in the stack, and YYPTR gives the new location of the
233 stack. Advance YYPTR to a properly aligned location for the next
234 stack. */
235 # define YYSTACK_RELOCATE(Stack) \
236 do \
238 YYSIZE_T yynewbytes; \
239 YYCOPY (&yyptr->Stack, Stack, yysize); \
240 Stack = &yyptr->Stack; \
241 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
242 yyptr += yynewbytes / sizeof (*yyptr); \
244 while (0)
246 #endif
248 #if defined (__STDC__) || defined (__cplusplus)
249 typedef signed char yysigned_char;
250 #else
251 typedef short int yysigned_char;
252 #endif
254 /* YYFINAL -- State number of the termination state. */
255 #define YYFINAL 52
256 /* YYLAST -- Last index in YYTABLE. */
257 #define YYLAST 396
259 /* YYNTOKENS -- Number of terminals. */
260 #define YYNTOKENS 23
261 /* YYNNTS -- Number of nonterminals. */
262 #define YYNNTS 29
263 /* YYNRULES -- Number of rules. */
264 #define YYNRULES 79
265 /* YYNRULES -- Number of states. */
266 #define YYNSTATES 128
268 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
269 #define YYUNDEFTOK 2
270 #define YYMAXUTOK 269
272 #define YYTRANSLATE(YYX) \
273 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
275 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
276 static const unsigned char yytranslate[] =
278 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
279 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
280 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
281 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
282 2, 2, 2, 2, 21, 15, 2, 2, 2, 2,
283 2, 2, 2, 2, 2, 2, 2, 2, 16, 2,
284 2, 2, 2, 22, 2, 2, 2, 2, 2, 2,
285 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
286 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
287 2, 17, 2, 18, 2, 2, 2, 2, 2, 2,
288 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
289 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
290 2, 2, 2, 19, 2, 20, 2, 2, 2, 2,
291 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
292 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
293 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
294 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
295 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
296 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
297 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
298 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
299 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
300 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
301 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
302 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
303 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
304 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
307 #if YYDEBUG
308 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
309 YYRHS. */
310 static const unsigned char yyprhs[] =
312 0, 0, 3, 5, 8, 9, 11, 13, 15, 18,
313 21, 24, 28, 30, 32, 36, 37, 40, 43, 46,
314 49, 51, 54, 56, 58, 60, 63, 66, 69, 72,
315 75, 77, 79, 81, 85, 87, 89, 91, 93, 95,
316 99, 103, 106, 110, 113, 117, 120, 124, 127, 129,
317 133, 136, 140, 143, 145, 149, 151, 153, 157, 161,
318 165, 168, 172, 175, 179, 182, 184, 188, 190, 194,
319 196, 200, 204, 207, 211, 215, 218, 220, 224, 226
322 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
323 static const yysigned_char yyrhs[] =
325 24, 0, -1, 25, -1, 11, 27, -1, -1, 33,
326 -1, 26, -1, 34, -1, 5, 26, -1, 6, 26,
327 -1, 3, 26, -1, 29, 26, 32, -1, 25, -1,
328 28, -1, 29, 28, 30, -1, -1, 7, 28, -1,
329 5, 28, -1, 6, 28, -1, 3, 28, -1, 12,
330 -1, 29, 13, -1, 14, -1, 13, -1, 14, -1,
331 31, 32, -1, 5, 33, -1, 6, 33, -1, 7,
332 33, -1, 3, 33, -1, 4, -1, 8, -1, 9,
333 -1, 29, 33, 32, -1, 10, -1, 35, -1, 39,
334 -1, 42, -1, 49, -1, 29, 37, 30, -1, 29,
335 38, 30, -1, 15, 27, -1, 5, 31, 38, -1,
336 5, 37, -1, 6, 31, 38, -1, 6, 37, -1,
337 3, 31, 38, -1, 3, 37, -1, 36, -1, 38,
338 31, 36, -1, 38, 31, -1, 17, 40, 18, -1,
339 17, 18, -1, 41, -1, 40, 21, 41, -1, 25,
340 -1, 48, -1, 29, 43, 30, -1, 29, 47, 30,
341 -1, 5, 31, 47, -1, 5, 43, -1, 6, 31,
342 47, -1, 6, 43, -1, 3, 31, 47, -1, 3,
343 43, -1, 33, -1, 22, 25, 31, -1, 27, -1,
344 44, 16, 45, -1, 46, -1, 47, 31, 36, -1,
345 47, 31, 46, -1, 47, 31, -1, 25, 16, 27,
346 -1, 19, 50, 20, -1, 19, 20, -1, 51, -1,
347 50, 21, 51, -1, 25, -1, 48, -1
350 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
351 static const unsigned short int yyrline[] =
353 0, 56, 56, 60, 65, 70, 71, 74, 75, 80,
354 85, 94, 100, 101, 104, 109, 113, 121, 126, 131,
355 145, 146, 149, 152, 155, 156, 164, 169, 174, 182,
356 186, 194, 207, 208, 218, 219, 220, 221, 222, 228,
357 232, 238, 244, 249, 254, 259, 264, 268, 274, 278,
358 283, 292, 296, 302, 306, 313, 314, 320, 325, 332,
359 337, 342, 347, 352, 356, 362, 363, 369, 379, 396,
360 397, 409, 417, 426, 434, 438, 444, 445, 454, 461
362 #endif
364 #if YYDEBUG || YYERROR_VERBOSE
365 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
366 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
367 static const char *const yytname[] =
369 "$end", "error", "$undefined", "YAML_ANCHOR", "YAML_ALIAS",
370 "YAML_TRANSFER", "YAML_TAGURI", "YAML_ITRANSFER", "YAML_WORD",
371 "YAML_PLAIN", "YAML_BLOCK", "YAML_DOCSEP", "YAML_IOPEN", "YAML_INDENT",
372 "YAML_IEND", "'-'", "':'", "'['", "']'", "'{'", "'}'", "','", "'?'",
373 "$accept", "doc", "atom", "ind_rep", "atom_or_empty", "empty",
374 "indent_open", "indent_end", "indent_sep", "indent_flex_end", "word_rep",
375 "struct_rep", "implicit_seq", "basic_seq", "top_imp_seq",
376 "in_implicit_seq", "inline_seq", "in_inline_seq", "inline_seq_atom",
377 "implicit_map", "top_imp_map", "complex_key", "complex_value",
378 "complex_mapping", "in_implicit_map", "basic_mapping", "inline_map",
379 "in_inline_map", "inline_map_atom", 0
381 #endif
383 # ifdef YYPRINT
384 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
385 token YYLEX-NUM. */
386 static const unsigned short int yytoknum[] =
388 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
389 265, 266, 267, 268, 269, 45, 58, 91, 93, 123,
390 125, 44, 63
392 # endif
394 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
395 static const unsigned char yyr1[] =
397 0, 23, 24, 24, 24, 25, 25, 26, 26, 26,
398 26, 26, 27, 27, 28, 28, 28, 28, 28, 28,
399 29, 29, 30, 31, 32, 32, 33, 33, 33, 33,
400 33, 33, 33, 33, 34, 34, 34, 34, 34, 35,
401 35, 36, 37, 37, 37, 37, 37, 37, 38, 38,
402 38, 39, 39, 40, 40, 41, 41, 42, 42, 43,
403 43, 43, 43, 43, 43, 44, 44, 45, 46, 47,
404 47, 47, 47, 48, 49, 49, 50, 50, 51, 51
407 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
408 static const unsigned char yyr2[] =
410 0, 2, 1, 2, 0, 1, 1, 1, 2, 2,
411 2, 3, 1, 1, 3, 0, 2, 2, 2, 2,
412 1, 2, 1, 1, 1, 2, 2, 2, 2, 2,
413 1, 1, 1, 3, 1, 1, 1, 1, 1, 3,
414 3, 2, 3, 2, 3, 2, 3, 2, 1, 3,
415 2, 3, 2, 1, 3, 1, 1, 3, 3, 3,
416 2, 3, 2, 3, 2, 1, 3, 1, 3, 1,
417 3, 3, 2, 3, 3, 2, 1, 3, 1, 1
420 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
421 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
422 means the default is an error. */
423 static const unsigned char yydefact[] =
425 4, 0, 30, 0, 0, 0, 31, 32, 34, 15,
426 20, 0, 0, 0, 2, 6, 0, 5, 7, 35,
427 36, 37, 38, 10, 29, 8, 26, 9, 27, 0,
428 0, 0, 0, 28, 15, 15, 15, 15, 12, 3,
429 13, 15, 52, 55, 0, 53, 56, 75, 78, 79,
430 0, 76, 1, 0, 0, 0, 21, 15, 0, 0,
431 65, 48, 0, 0, 0, 0, 69, 0, 0, 19,
432 17, 18, 15, 15, 15, 16, 15, 15, 15, 15,
433 0, 15, 51, 0, 74, 0, 23, 0, 47, 64,
434 0, 43, 60, 0, 45, 62, 41, 0, 24, 0,
435 11, 33, 22, 39, 40, 50, 57, 15, 58, 72,
436 14, 73, 54, 77, 65, 46, 63, 42, 59, 44,
437 61, 66, 25, 49, 67, 68, 70, 71
440 /* YYDEFGOTO[NTERM-NUM]. */
441 static const yysigned_char yydefgoto[] =
443 -1, 13, 38, 15, 39, 40, 16, 103, 99, 101,
444 17, 18, 19, 61, 62, 63, 20, 44, 45, 21,
445 64, 65, 125, 66, 67, 46, 22, 50, 51
448 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
449 STATE-NUM. */
450 #define YYPACT_NINF -97
451 static const short int yypact[] =
453 250, 318, -97, 318, 318, 374, -97, -97, -97, 335,
454 -97, 267, 232, 7, -97, -97, 192, -97, -97, -97,
455 -97, -97, -97, -97, -97, -97, -97, -97, -97, 374,
456 374, 374, 352, -97, 335, 335, 335, 384, -97, -97,
457 -97, 212, -97, 10, 0, -97, -97, -97, 10, -97,
458 -4, -97, -97, 284, 284, 284, -97, 335, 318, 30,
459 30, -97, -2, 36, -2, 16, -97, 36, 30, -97,
460 -97, -97, 384, 384, 384, -97, 363, 301, 301, 301,
461 -2, 335, -97, 318, -97, 318, -97, 158, -97, -97,
462 158, -97, -97, 158, -97, -97, -97, 24, -97, 30,
463 -97, -97, -97, -97, -97, 26, -97, 335, -97, 158,
464 -97, -97, -97, -97, -97, 24, 24, 24, 24, 24,
465 24, -97, -97, -97, -97, -97, -97, -97
468 /* YYPGOTO[NTERM-NUM]. */
469 static const yysigned_char yypgoto[] =
471 -97, -97, 8, 81, -56, 109, 33, -53, 74, -54,
472 -1, -97, -97, -96, -31, -32, -97, -97, -44, -97,
473 77, -97, -97, -52, 9, -6, -97, -97, -29
476 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
477 positive, shift that token. If negative, reduce the rule which
478 number is the opposite. If zero, do what YYDEFACT says.
479 If YYTABLE_NINF, syntax error. */
480 #define YYTABLE_NINF -1
481 static const unsigned char yytable[] =
483 24, 96, 26, 28, 33, 100, 49, 52, 14, 123,
484 104, 106, 102, 126, 108, 60, 84, 85, 82, 43,
485 48, 83, 88, 91, 94, 111, 81, 110, 24, 26,
486 28, 68, 107, 24, 26, 28, 33, 86, 32, 112,
487 60, 57, 41, 86, 98, 122, 88, 91, 94, 86,
488 102, 124, 24, 26, 28, 115, 113, 127, 117, 0,
489 0, 119, 32, 32, 32, 32, 97, 41, 41, 41,
490 76, 24, 26, 28, 41, 68, 24, 26, 28, 49,
491 0, 0, 23, 0, 25, 27, 114, 0, 0, 114,
492 41, 43, 114, 48, 0, 0, 116, 59, 0, 118,
493 0, 0, 120, 0, 0, 76, 76, 76, 114, 76,
494 41, 41, 41, 0, 41, 23, 25, 27, 0, 0,
495 32, 0, 59, 32, 0, 0, 32, 87, 90, 93,
496 89, 92, 95, 0, 23, 25, 27, 105, 0, 0,
497 41, 109, 32, 69, 70, 71, 75, 0, 0, 0,
498 80, 87, 90, 93, 89, 92, 95, 0, 23, 25,
499 27, 29, 2, 30, 31, 5, 6, 7, 0, 0,
500 10, 121, 0, 57, 0, 0, 0, 0, 0, 0,
501 58, 69, 70, 71, 0, 80, 69, 70, 71, 105,
502 109, 105, 109, 105, 109, 53, 2, 54, 55, 5,
503 6, 7, 8, 0, 10, 56, 0, 57, 0, 11,
504 0, 12, 0, 0, 58, 77, 2, 78, 79, 37,
505 6, 7, 8, 0, 10, 56, 0, 57, 0, 11,
506 0, 12, 0, 0, 58, 1, 2, 3, 4, 5,
507 6, 7, 8, 0, 10, 0, 0, 0, 0, 11,
508 0, 12, 47, 1, 2, 3, 4, 5, 6, 7,
509 8, 9, 10, 0, 0, 0, 0, 11, 0, 12,
510 1, 2, 3, 4, 5, 6, 7, 8, 0, 10,
511 0, 0, 0, 0, 11, 42, 12, 53, 2, 54,
512 55, 5, 6, 7, 8, 0, 10, 86, 0, 0,
513 0, 11, 0, 12, 77, 2, 78, 79, 37, 6,
514 7, 8, 0, 10, 86, 0, 0, 0, 11, 0,
515 12, 1, 2, 3, 4, 5, 6, 7, 8, 0,
516 10, 0, 0, 0, 0, 11, 0, 12, 34, 2,
517 35, 36, 37, 6, 7, 8, 0, 10, 0, 0,
518 0, 0, 11, 0, 12, 29, 2, 30, 31, 5,
519 6, 7, 0, 0, 10, 56, 72, 2, 73, 74,
520 37, 6, 7, 0, 0, 10, 56, 29, 2, 30,
521 31, 5, 6, 7, 0, 0, 10, 72, 2, 73,
522 74, 37, 6, 7, 0, 0, 10
525 static const yysigned_char yycheck[] =
527 1, 57, 3, 4, 5, 59, 12, 0, 0, 105,
528 63, 64, 14, 109, 67, 16, 20, 21, 18, 11,
529 12, 21, 53, 54, 55, 81, 16, 80, 29, 30,
530 31, 32, 16, 34, 35, 36, 37, 13, 5, 83,
531 41, 15, 9, 13, 14, 99, 77, 78, 79, 13,
532 14, 107, 53, 54, 55, 87, 85, 109, 90, -1,
533 -1, 93, 29, 30, 31, 32, 58, 34, 35, 36,
534 37, 72, 73, 74, 41, 76, 77, 78, 79, 85,
535 -1, -1, 1, -1, 3, 4, 87, -1, -1, 90,
536 57, 83, 93, 85, -1, -1, 87, 16, -1, 90,
537 -1, -1, 93, -1, -1, 72, 73, 74, 109, 76,
538 77, 78, 79, -1, 81, 34, 35, 36, -1, -1,
539 87, -1, 41, 90, -1, -1, 93, 53, 54, 55,
540 53, 54, 55, -1, 53, 54, 55, 63, -1, -1,
541 107, 67, 109, 34, 35, 36, 37, -1, -1, -1,
542 41, 77, 78, 79, 77, 78, 79, -1, 77, 78,
543 79, 3, 4, 5, 6, 7, 8, 9, -1, -1,
544 12, 97, -1, 15, -1, -1, -1, -1, -1, -1,
545 22, 72, 73, 74, -1, 76, 77, 78, 79, 115,
546 116, 117, 118, 119, 120, 3, 4, 5, 6, 7,
547 8, 9, 10, -1, 12, 13, -1, 15, -1, 17,
548 -1, 19, -1, -1, 22, 3, 4, 5, 6, 7,
549 8, 9, 10, -1, 12, 13, -1, 15, -1, 17,
550 -1, 19, -1, -1, 22, 3, 4, 5, 6, 7,
551 8, 9, 10, -1, 12, -1, -1, -1, -1, 17,
552 -1, 19, 20, 3, 4, 5, 6, 7, 8, 9,
553 10, 11, 12, -1, -1, -1, -1, 17, -1, 19,
554 3, 4, 5, 6, 7, 8, 9, 10, -1, 12,
555 -1, -1, -1, -1, 17, 18, 19, 3, 4, 5,
556 6, 7, 8, 9, 10, -1, 12, 13, -1, -1,
557 -1, 17, -1, 19, 3, 4, 5, 6, 7, 8,
558 9, 10, -1, 12, 13, -1, -1, -1, 17, -1,
559 19, 3, 4, 5, 6, 7, 8, 9, 10, -1,
560 12, -1, -1, -1, -1, 17, -1, 19, 3, 4,
561 5, 6, 7, 8, 9, 10, -1, 12, -1, -1,
562 -1, -1, 17, -1, 19, 3, 4, 5, 6, 7,
563 8, 9, -1, -1, 12, 13, 3, 4, 5, 6,
564 7, 8, 9, -1, -1, 12, 13, 3, 4, 5,
565 6, 7, 8, 9, -1, -1, 12, 3, 4, 5,
566 6, 7, 8, 9, -1, -1, 12
569 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
570 symbol of state STATE-NUM. */
571 static const unsigned char yystos[] =
573 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
574 12, 17, 19, 24, 25, 26, 29, 33, 34, 35,
575 39, 42, 49, 26, 33, 26, 33, 26, 33, 3,
576 5, 6, 29, 33, 3, 5, 6, 7, 25, 27,
577 28, 29, 18, 25, 40, 41, 48, 20, 25, 48,
578 50, 51, 0, 3, 5, 6, 13, 15, 22, 26,
579 33, 36, 37, 38, 43, 44, 46, 47, 33, 28,
580 28, 28, 3, 5, 6, 28, 29, 3, 5, 6,
581 28, 16, 18, 21, 20, 21, 13, 31, 37, 43,
582 31, 37, 43, 31, 37, 43, 27, 25, 14, 31,
583 32, 32, 14, 30, 30, 31, 30, 16, 30, 31,
584 30, 27, 41, 51, 33, 38, 47, 38, 47, 38,
585 47, 31, 32, 36, 27, 45, 36, 46
588 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
589 # define YYSIZE_T __SIZE_TYPE__
590 #endif
591 #if ! defined (YYSIZE_T) && defined (size_t)
592 # define YYSIZE_T size_t
593 #endif
594 #if ! defined (YYSIZE_T)
595 # if defined (__STDC__) || defined (__cplusplus)
596 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
597 # define YYSIZE_T size_t
598 # endif
599 #endif
600 #if ! defined (YYSIZE_T)
601 # define YYSIZE_T unsigned int
602 #endif
604 #define yyerrok (yyerrstatus = 0)
605 #define yyclearin (yychar = YYEMPTY)
606 #define YYEMPTY (-2)
607 #define YYEOF 0
609 #define YYACCEPT goto yyacceptlab
610 #define YYABORT goto yyabortlab
611 #define YYERROR goto yyerrorlab
614 /* Like YYERROR except do call yyerror. This remains here temporarily
615 to ease the transition to the new meaning of YYERROR, for GCC.
616 Once GCC version 2 has supplanted version 1, this can go. */
618 #define YYFAIL goto yyerrlab
620 #define YYRECOVERING() (!!yyerrstatus)
622 #define YYBACKUP(Token, Value) \
623 do \
624 if (yychar == YYEMPTY && yylen == 1) \
626 yychar = (Token); \
627 yylval = (Value); \
628 yytoken = YYTRANSLATE (yychar); \
629 YYPOPSTACK; \
630 goto yybackup; \
632 else \
634 yyerror ("syntax error: cannot back up");\
635 YYERROR; \
637 while (0)
639 #define YYTERROR 1
640 #define YYERRCODE 256
642 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
643 are run). */
645 #ifndef YYLLOC_DEFAULT
646 # define YYLLOC_DEFAULT(Current, Rhs, N) \
647 ((Current).first_line = (Rhs)[1].first_line, \
648 (Current).first_column = (Rhs)[1].first_column, \
649 (Current).last_line = (Rhs)[N].last_line, \
650 (Current).last_column = (Rhs)[N].last_column)
651 #endif
653 /* YYLEX -- calling `yylex' with the right arguments. */
655 #ifdef YYLEX_PARAM
656 # define YYLEX yylex (&yylval, YYLEX_PARAM)
657 #else
658 # define YYLEX yylex (&yylval)
659 #endif
661 /* Enable debugging if requested. */
662 #if YYDEBUG
664 # ifndef YYFPRINTF
665 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
666 # define YYFPRINTF fprintf
667 # endif
669 # define YYDPRINTF(Args) \
670 do { \
671 if (yydebug) \
672 YYFPRINTF Args; \
673 } while (0)
675 # define YYDSYMPRINT(Args) \
676 do { \
677 if (yydebug) \
678 yysymprint Args; \
679 } while (0)
681 # define YYDSYMPRINTF(Title, Token, Value, Location) \
682 do { \
683 if (yydebug) \
685 YYFPRINTF (stderr, "%s ", Title); \
686 yysymprint (stderr, \
687 Token, Value); \
688 YYFPRINTF (stderr, "\n"); \
690 } while (0)
692 /*------------------------------------------------------------------.
693 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
694 | TOP (included). |
695 `------------------------------------------------------------------*/
697 #if defined (__STDC__) || defined (__cplusplus)
698 static void
699 yy_stack_print (short int *bottom, short int *top)
700 #else
701 static void
702 yy_stack_print (bottom, top)
703 short int *bottom;
704 short int *top;
705 #endif
707 YYFPRINTF (stderr, "Stack now");
708 for (/* Nothing. */; bottom <= top; ++bottom)
709 YYFPRINTF (stderr, " %d", *bottom);
710 YYFPRINTF (stderr, "\n");
713 # define YY_STACK_PRINT(Bottom, Top) \
714 do { \
715 if (yydebug) \
716 yy_stack_print ((Bottom), (Top)); \
717 } while (0)
720 /*------------------------------------------------.
721 | Report that the YYRULE is going to be reduced. |
722 `------------------------------------------------*/
724 #if defined (__STDC__) || defined (__cplusplus)
725 static void
726 yy_reduce_print (int yyrule)
727 #else
728 static void
729 yy_reduce_print (yyrule)
730 int yyrule;
731 #endif
733 int yyi;
734 unsigned int yylno = yyrline[yyrule];
735 YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
736 yyrule - 1, yylno);
737 /* Print the symbols being reduced, and their result. */
738 for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
739 YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
740 YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
743 # define YY_REDUCE_PRINT(Rule) \
744 do { \
745 if (yydebug) \
746 yy_reduce_print (Rule); \
747 } while (0)
749 /* Nonzero means print parse trace. It is left uninitialized so that
750 multiple parsers can coexist. */
751 int yydebug;
752 #else /* !YYDEBUG */
753 # define YYDPRINTF(Args)
754 # define YYDSYMPRINT(Args)
755 # define YYDSYMPRINTF(Title, Token, Value, Location)
756 # define YY_STACK_PRINT(Bottom, Top)
757 # define YY_REDUCE_PRINT(Rule)
758 #endif /* !YYDEBUG */
761 /* YYINITDEPTH -- initial size of the parser's stacks. */
762 #ifndef YYINITDEPTH
763 # define YYINITDEPTH 200
764 #endif
766 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
767 if the built-in stack extension method is used).
769 Do not make this value too large; the results are undefined if
770 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
771 evaluated with infinite-precision integer arithmetic. */
773 #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
774 # undef YYMAXDEPTH
775 #endif
777 #ifndef YYMAXDEPTH
778 # define YYMAXDEPTH 10000
779 #endif
783 #if YYERROR_VERBOSE
785 # ifndef yystrlen
786 # if defined (__GLIBC__) && defined (_STRING_H)
787 # define yystrlen strlen
788 # else
789 /* Return the length of YYSTR. */
790 static YYSIZE_T
791 # if defined (__STDC__) || defined (__cplusplus)
792 yystrlen (const char *yystr)
793 # else
794 yystrlen (yystr)
795 const char *yystr;
796 # endif
798 register const char *yys = yystr;
800 while (*yys++ != '\0')
801 continue;
803 return yys - yystr - 1;
805 # endif
806 # endif
808 # ifndef yystpcpy
809 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
810 # define yystpcpy stpcpy
811 # else
812 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
813 YYDEST. */
814 static char *
815 # if defined (__STDC__) || defined (__cplusplus)
816 yystpcpy (char *yydest, const char *yysrc)
817 # else
818 yystpcpy (yydest, yysrc)
819 char *yydest;
820 const char *yysrc;
821 # endif
823 register char *yyd = yydest;
824 register const char *yys = yysrc;
826 while ((*yyd++ = *yys++) != '\0')
827 continue;
829 return yyd - 1;
831 # endif
832 # endif
834 #endif /* !YYERROR_VERBOSE */
838 #if YYDEBUG
839 /*--------------------------------.
840 | Print this symbol on YYOUTPUT. |
841 `--------------------------------*/
843 #if defined (__STDC__) || defined (__cplusplus)
844 static void
845 yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
846 #else
847 static void
848 yysymprint (yyoutput, yytype, yyvaluep)
849 FILE *yyoutput;
850 int yytype;
851 YYSTYPE *yyvaluep;
852 #endif
854 /* Pacify ``unused variable'' warnings. */
855 (void) yyvaluep;
857 if (yytype < YYNTOKENS)
859 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
860 # ifdef YYPRINT
861 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
862 # endif
864 else
865 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
867 switch (yytype)
869 default:
870 break;
872 YYFPRINTF (yyoutput, ")");
875 #endif /* ! YYDEBUG */
876 /*-----------------------------------------------.
877 | Release the memory associated to this symbol. |
878 `-----------------------------------------------*/
880 #if defined (__STDC__) || defined (__cplusplus)
881 static void
882 yydestruct (int yytype, YYSTYPE *yyvaluep)
883 #else
884 static void
885 yydestruct (yytype, yyvaluep)
886 int yytype;
887 YYSTYPE *yyvaluep;
888 #endif
890 /* Pacify ``unused variable'' warnings. */
891 (void) yyvaluep;
893 switch (yytype)
896 default:
897 break;
902 /* Prevent warnings from -Wmissing-prototypes. */
904 #ifdef YYPARSE_PARAM
905 # if defined (__STDC__) || defined (__cplusplus)
906 int yyparse (void *YYPARSE_PARAM);
907 # else
908 int yyparse ();
909 # endif
910 #else /* ! YYPARSE_PARAM */
911 #if defined (__STDC__) || defined (__cplusplus)
912 int yyparse (void);
913 #else
914 int yyparse ();
915 #endif
916 #endif /* ! YYPARSE_PARAM */
923 /*----------.
924 | yyparse. |
925 `----------*/
927 #ifdef YYPARSE_PARAM
928 # if defined (__STDC__) || defined (__cplusplus)
929 int yyparse (void *YYPARSE_PARAM)
930 # else
931 int yyparse (YYPARSE_PARAM)
932 void *YYPARSE_PARAM;
933 # endif
934 #else /* ! YYPARSE_PARAM */
935 #if defined (__STDC__) || defined (__cplusplus)
937 yyparse (void)
938 #else
940 yyparse ()
942 #endif
943 #endif
945 /* The lookahead symbol. */
946 int yychar;
948 /* The semantic value of the lookahead symbol. */
949 YYSTYPE yylval;
951 /* Number of syntax errors so far. */
952 int yynerrs;
954 register int yystate;
955 register int yyn;
956 int yyresult;
957 /* Number of tokens to shift before error messages enabled. */
958 int yyerrstatus;
959 /* Lookahead token as an internal (translated) token number. */
960 int yytoken = 0;
962 /* Three stacks and their tools:
963 `yyss': related to states,
964 `yyvs': related to semantic values,
965 `yyls': related to locations.
967 Refer to the stacks thru separate pointers, to allow yyoverflow
968 to reallocate them elsewhere. */
970 /* The state stack. */
971 short int yyssa[YYINITDEPTH];
972 short int *yyss = yyssa;
973 register short int *yyssp;
975 /* The semantic value stack. */
976 YYSTYPE yyvsa[YYINITDEPTH];
977 YYSTYPE *yyvs = yyvsa;
978 register YYSTYPE *yyvsp;
982 #define YYPOPSTACK (yyvsp--, yyssp--)
984 YYSIZE_T yystacksize = YYINITDEPTH;
986 /* The variables used to return semantic value and location from the
987 action routines. */
988 YYSTYPE yyval;
991 /* When reducing, the number of symbols on the RHS of the reduced
992 rule. */
993 int yylen;
995 YYDPRINTF ((stderr, "Starting parse\n"));
997 yystate = 0;
998 yyerrstatus = 0;
999 yynerrs = 0;
1000 yychar = YYEMPTY; /* Cause a token to be read. */
1002 /* Initialize stack pointers.
1003 Waste one element of value and location stack
1004 so that they stay on the same level as the state stack.
1005 The wasted elements are never initialized. */
1007 yyssp = yyss;
1008 yyvsp = yyvs;
1011 goto yysetstate;
1013 /*------------------------------------------------------------.
1014 | yynewstate -- Push a new state, which is found in yystate. |
1015 `------------------------------------------------------------*/
1016 yynewstate:
1017 /* In all cases, when you get here, the value and location stacks
1018 have just been pushed. so pushing a state here evens the stacks.
1020 yyssp++;
1022 yysetstate:
1023 *yyssp = yystate;
1025 if (yyss + yystacksize - 1 <= yyssp)
1027 /* Get the current used size of the three stacks, in elements. */
1028 YYSIZE_T yysize = yyssp - yyss + 1;
1030 #ifdef yyoverflow
1032 /* Give user a chance to reallocate the stack. Use copies of
1033 these so that the &'s don't force the real ones into
1034 memory. */
1035 YYSTYPE *yyvs1 = yyvs;
1036 short int *yyss1 = yyss;
1039 /* Each stack pointer address is followed by the size of the
1040 data in use in that stack, in bytes. This used to be a
1041 conditional around just the two extra args, but that might
1042 be undefined if yyoverflow is a macro. */
1043 yyoverflow ("parser stack overflow",
1044 &yyss1, yysize * sizeof (*yyssp),
1045 &yyvs1, yysize * sizeof (*yyvsp),
1047 &yystacksize);
1049 yyss = yyss1;
1050 yyvs = yyvs1;
1052 #else /* no yyoverflow */
1053 # ifndef YYSTACK_RELOCATE
1054 goto yyoverflowlab;
1055 # else
1056 /* Extend the stack our own way. */
1057 if (YYMAXDEPTH <= yystacksize)
1058 goto yyoverflowlab;
1059 yystacksize *= 2;
1060 if (YYMAXDEPTH < yystacksize)
1061 yystacksize = YYMAXDEPTH;
1064 short int *yyss1 = yyss;
1065 union yyalloc *yyptr =
1066 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1067 if (! yyptr)
1068 goto yyoverflowlab;
1069 YYSTACK_RELOCATE (yyss);
1070 YYSTACK_RELOCATE (yyvs);
1072 # undef YYSTACK_RELOCATE
1073 if (yyss1 != yyssa)
1074 YYSTACK_FREE (yyss1);
1076 # endif
1077 #endif /* no yyoverflow */
1079 yyssp = yyss + yysize - 1;
1080 yyvsp = yyvs + yysize - 1;
1083 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1084 (unsigned long int) yystacksize));
1086 if (yyss + yystacksize - 1 <= yyssp)
1087 YYABORT;
1090 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1092 goto yybackup;
1094 /*-----------.
1095 | yybackup. |
1096 `-----------*/
1097 yybackup:
1099 /* Do appropriate processing given the current state. */
1100 /* Read a lookahead token if we need one and don't already have one. */
1101 /* yyresume: */
1103 /* First try to decide what to do without reference to lookahead token. */
1105 yyn = yypact[yystate];
1106 if (yyn == YYPACT_NINF)
1107 goto yydefault;
1109 /* Not known => get a lookahead token if don't already have one. */
1111 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1112 if (yychar == YYEMPTY)
1114 YYDPRINTF ((stderr, "Reading a token: "));
1115 yychar = YYLEX;
1118 if (yychar <= YYEOF)
1120 yychar = yytoken = YYEOF;
1121 YYDPRINTF ((stderr, "Now at end of input.\n"));
1123 else
1125 yytoken = YYTRANSLATE (yychar);
1126 YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
1129 /* If the proper action on seeing token YYTOKEN is to reduce or to
1130 detect an error, take that action. */
1131 yyn += yytoken;
1132 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1133 goto yydefault;
1134 yyn = yytable[yyn];
1135 if (yyn <= 0)
1137 if (yyn == 0 || yyn == YYTABLE_NINF)
1138 goto yyerrlab;
1139 yyn = -yyn;
1140 goto yyreduce;
1143 if (yyn == YYFINAL)
1144 YYACCEPT;
1146 /* Shift the lookahead token. */
1147 YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
1149 /* Discard the token being shifted unless it is eof. */
1150 if (yychar != YYEOF)
1151 yychar = YYEMPTY;
1153 *++yyvsp = yylval;
1156 /* Count tokens shifted since error; after three, turn off error
1157 status. */
1158 if (yyerrstatus)
1159 yyerrstatus--;
1161 yystate = yyn;
1162 goto yynewstate;
1165 /*-----------------------------------------------------------.
1166 | yydefault -- do the default action for the current state. |
1167 `-----------------------------------------------------------*/
1168 yydefault:
1169 yyn = yydefact[yystate];
1170 if (yyn == 0)
1171 goto yyerrlab;
1172 goto yyreduce;
1175 /*-----------------------------.
1176 | yyreduce -- Do a reduction. |
1177 `-----------------------------*/
1178 yyreduce:
1179 /* yyn is the number of a rule to reduce with. */
1180 yylen = yyr2[yyn];
1182 /* If YYLEN is nonzero, implement the default value of the action:
1183 `$$ = $1'.
1185 Otherwise, the following line sets YYVAL to garbage.
1186 This behavior is undocumented and Bison
1187 users should not rely upon it. Assigning to YYVAL
1188 unconditionally makes the parser a bit smaller, and it avoids a
1189 GCC warning that YYVAL may be used uninitialized. */
1190 yyval = yyvsp[1-yylen];
1193 YY_REDUCE_PRINT (yyn);
1194 switch (yyn)
1196 case 2:
1197 #line 57 "gram.y"
1199 ((SyckParser *)parser)->root = syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData );
1201 break;
1203 case 3:
1204 #line 61 "gram.y"
1206 ((SyckParser *)parser)->root = syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData );
1208 break;
1210 case 4:
1211 #line 65 "gram.y"
1213 ((SyckParser *)parser)->eof = 1;
1215 break;
1217 case 8:
1218 #line 76 "gram.y"
1220 syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
1221 yyval.nodeData = yyvsp[0].nodeData;
1223 break;
1225 case 9:
1226 #line 81 "gram.y"
1228 syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 );
1229 yyval.nodeData = yyvsp[0].nodeData;
1231 break;
1233 case 10:
1234 #line 86 "gram.y"
1237 * _Anchors_: The language binding must keep a separate symbol table
1238 * for anchors. The actual ID in the symbol table is returned to the
1239 * higher nodes, though.
1241 yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
1243 break;
1245 case 11:
1246 #line 95 "gram.y"
1248 yyval.nodeData = yyvsp[-1].nodeData;
1250 break;
1252 case 14:
1253 #line 105 "gram.y"
1255 yyval.nodeData = yyvsp[-1].nodeData;
1257 break;
1259 case 15:
1260 #line 109 "gram.y"
1262 NULL_NODE( parser, n );
1263 yyval.nodeData = n;
1265 break;
1267 case 16:
1268 #line 114 "gram.y"
1270 if ( ((SyckParser *)parser)->implicit_typing == 1 )
1272 try_tag_implicit( yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
1274 yyval.nodeData = yyvsp[0].nodeData;
1276 break;
1278 case 17:
1279 #line 122 "gram.y"
1281 syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
1282 yyval.nodeData = yyvsp[0].nodeData;
1284 break;
1286 case 18:
1287 #line 127 "gram.y"
1289 syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 );
1290 yyval.nodeData = yyvsp[0].nodeData;
1292 break;
1294 case 19:
1295 #line 132 "gram.y"
1298 * _Anchors_: The language binding must keep a separate symbol table
1299 * for anchors. The actual ID in the symbol table is returned to the
1300 * higher nodes, though.
1302 yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
1304 break;
1306 case 26:
1307 #line 165 "gram.y"
1309 syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
1310 yyval.nodeData = yyvsp[0].nodeData;
1312 break;
1314 case 27:
1315 #line 170 "gram.y"
1317 syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 );
1318 yyval.nodeData = yyvsp[0].nodeData;
1320 break;
1322 case 28:
1323 #line 175 "gram.y"
1325 if ( ((SyckParser *)parser)->implicit_typing == 1 )
1327 try_tag_implicit( yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
1329 yyval.nodeData = yyvsp[0].nodeData;
1331 break;
1333 case 29:
1334 #line 183 "gram.y"
1336 yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
1338 break;
1340 case 30:
1341 #line 187 "gram.y"
1344 * _Aliases_: The anchor symbol table is scanned for the anchor name.
1345 * The anchor's ID in the language's symbol table is returned.
1347 yyval.nodeData = syck_hdlr_get_anchor( (SyckParser *)parser, yyvsp[0].name );
1349 break;
1351 case 31:
1352 #line 195 "gram.y"
1354 SyckNode *n = yyvsp[0].nodeData;
1355 if ( ((SyckParser *)parser)->taguri_expansion == 1 )
1357 n->type_id = syck_taguri( YAML_DOMAIN, "str", 3 );
1359 else
1361 n->type_id = syck_strndup( "str", 3 );
1363 yyval.nodeData = n;
1365 break;
1367 case 33:
1368 #line 209 "gram.y"
1370 yyval.nodeData = yyvsp[-1].nodeData;
1372 break;
1374 case 39:
1375 #line 229 "gram.y"
1377 yyval.nodeData = yyvsp[-1].nodeData;
1379 break;
1381 case 40:
1382 #line 233 "gram.y"
1384 yyval.nodeData = yyvsp[-1].nodeData;
1386 break;
1388 case 41:
1389 #line 239 "gram.y"
1391 yyval.nodeId = syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData );
1393 break;
1395 case 42:
1396 #line 245 "gram.y"
1398 syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
1399 yyval.nodeData = yyvsp[0].nodeData;
1401 break;
1403 case 43:
1404 #line 250 "gram.y"
1406 syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
1407 yyval.nodeData = yyvsp[0].nodeData;
1409 break;
1411 case 44:
1412 #line 255 "gram.y"
1414 syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, 0 );
1415 yyval.nodeData = yyvsp[0].nodeData;
1417 break;
1419 case 45:
1420 #line 260 "gram.y"
1422 syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 );
1423 yyval.nodeData = yyvsp[0].nodeData;
1425 break;
1427 case 46:
1428 #line 265 "gram.y"
1430 yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-2].name, yyvsp[0].nodeData );
1432 break;
1434 case 47:
1435 #line 269 "gram.y"
1437 yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
1439 break;
1441 case 48:
1442 #line 275 "gram.y"
1444 yyval.nodeData = syck_new_seq( yyvsp[0].nodeId );
1446 break;
1448 case 49:
1449 #line 279 "gram.y"
1451 syck_seq_add( yyvsp[-2].nodeData, yyvsp[0].nodeId );
1452 yyval.nodeData = yyvsp[-2].nodeData;
1454 break;
1456 case 50:
1457 #line 284 "gram.y"
1459 yyval.nodeData = yyvsp[-1].nodeData;
1461 break;
1463 case 51:
1464 #line 293 "gram.y"
1466 yyval.nodeData = yyvsp[-1].nodeData;
1468 break;
1470 case 52:
1471 #line 297 "gram.y"
1473 yyval.nodeData = syck_alloc_seq();
1475 break;
1477 case 53:
1478 #line 303 "gram.y"
1480 yyval.nodeData = syck_new_seq( syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
1482 break;
1484 case 54:
1485 #line 307 "gram.y"
1487 syck_seq_add( yyvsp[-2].nodeData, syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
1488 yyval.nodeData = yyvsp[-2].nodeData;
1490 break;
1492 case 57:
1493 #line 321 "gram.y"
1495 apply_seq_in_map( (SyckParser *)parser, yyvsp[-1].nodeData );
1496 yyval.nodeData = yyvsp[-1].nodeData;
1498 break;
1500 case 58:
1501 #line 326 "gram.y"
1503 apply_seq_in_map( (SyckParser *)parser, yyvsp[-1].nodeData );
1504 yyval.nodeData = yyvsp[-1].nodeData;
1506 break;
1508 case 59:
1509 #line 333 "gram.y"
1511 syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
1512 yyval.nodeData = yyvsp[0].nodeData;
1514 break;
1516 case 60:
1517 #line 338 "gram.y"
1519 syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, ((SyckParser *)parser)->taguri_expansion );
1520 yyval.nodeData = yyvsp[0].nodeData;
1522 break;
1524 case 61:
1525 #line 343 "gram.y"
1527 syck_add_transfer( yyvsp[-2].name, yyvsp[0].nodeData, 0 );
1528 yyval.nodeData = yyvsp[0].nodeData;
1530 break;
1532 case 62:
1533 #line 348 "gram.y"
1535 syck_add_transfer( yyvsp[-1].name, yyvsp[0].nodeData, 0 );
1536 yyval.nodeData = yyvsp[0].nodeData;
1538 break;
1540 case 63:
1541 #line 353 "gram.y"
1543 yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-2].name, yyvsp[0].nodeData );
1545 break;
1547 case 64:
1548 #line 357 "gram.y"
1550 yyval.nodeData = syck_hdlr_add_anchor( (SyckParser *)parser, yyvsp[-1].name, yyvsp[0].nodeData );
1552 break;
1554 case 66:
1555 #line 364 "gram.y"
1557 yyval.nodeData = yyvsp[-1].nodeData;
1559 break;
1561 case 68:
1562 #line 380 "gram.y"
1564 yyval.nodeData = syck_new_map(
1565 syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ),
1566 syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
1568 break;
1570 case 70:
1571 #line 398 "gram.y"
1573 if ( yyvsp[-2].nodeData->shortcut == NULL )
1575 yyvsp[-2].nodeData->shortcut = syck_new_seq( yyvsp[0].nodeId );
1577 else
1579 syck_seq_add( yyvsp[-2].nodeData->shortcut, yyvsp[0].nodeId );
1581 yyval.nodeData = yyvsp[-2].nodeData;
1583 break;
1585 case 71:
1586 #line 410 "gram.y"
1588 apply_seq_in_map( (SyckParser *)parser, yyvsp[-2].nodeData );
1589 syck_map_update( yyvsp[-2].nodeData, yyvsp[0].nodeData );
1590 syck_free_node( yyvsp[0].nodeData );
1591 yyvsp[0].nodeData = NULL;
1592 yyval.nodeData = yyvsp[-2].nodeData;
1594 break;
1596 case 72:
1597 #line 418 "gram.y"
1599 yyval.nodeData = yyvsp[-1].nodeData;
1601 break;
1603 case 73:
1604 #line 427 "gram.y"
1606 yyval.nodeData = syck_new_map(
1607 syck_hdlr_add_node( (SyckParser *)parser, yyvsp[-2].nodeData ),
1608 syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ) );
1610 break;
1612 case 74:
1613 #line 435 "gram.y"
1615 yyval.nodeData = yyvsp[-1].nodeData;
1617 break;
1619 case 75:
1620 #line 439 "gram.y"
1622 yyval.nodeData = syck_alloc_map();
1624 break;
1626 case 77:
1627 #line 446 "gram.y"
1629 syck_map_update( yyvsp[-2].nodeData, yyvsp[0].nodeData );
1630 syck_free_node( yyvsp[0].nodeData );
1631 yyvsp[0].nodeData = NULL;
1632 yyval.nodeData = yyvsp[-2].nodeData;
1634 break;
1636 case 78:
1637 #line 455 "gram.y"
1639 NULL_NODE( parser, n );
1640 yyval.nodeData = syck_new_map(
1641 syck_hdlr_add_node( (SyckParser *)parser, yyvsp[0].nodeData ),
1642 syck_hdlr_add_node( (SyckParser *)parser, n ) );
1644 break;
1649 /* Line 1010 of yacc.c. */
1650 #line 1651 "gram.c"
1652 yyvsp -= yylen;
1653 yyssp -= yylen;
1656 YY_STACK_PRINT (yyss, yyssp);
1658 *++yyvsp = yyval;
1661 /* Now `shift' the result of the reduction. Determine what state
1662 that goes to, based on the state we popped back to and the rule
1663 number reduced by. */
1665 yyn = yyr1[yyn];
1667 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1668 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1669 yystate = yytable[yystate];
1670 else
1671 yystate = yydefgoto[yyn - YYNTOKENS];
1673 goto yynewstate;
1676 /*------------------------------------.
1677 | yyerrlab -- here on detecting error |
1678 `------------------------------------*/
1679 yyerrlab:
1680 /* If not already recovering from an error, report this error. */
1681 if (!yyerrstatus)
1683 ++yynerrs;
1684 #if YYERROR_VERBOSE
1685 yyn = yypact[yystate];
1687 if (YYPACT_NINF < yyn && yyn < YYLAST)
1689 YYSIZE_T yysize = 0;
1690 int yytype = YYTRANSLATE (yychar);
1691 const char* yyprefix;
1692 char *yymsg;
1693 int yyx;
1695 /* Start YYX at -YYN if negative to avoid negative indexes in
1696 YYCHECK. */
1697 int yyxbegin = yyn < 0 ? -yyn : 0;
1699 /* Stay within bounds of both yycheck and yytname. */
1700 int yychecklim = YYLAST - yyn;
1701 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1702 int yycount = 0;
1704 yyprefix = ", expecting ";
1705 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1706 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1708 yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
1709 yycount += 1;
1710 if (yycount == 5)
1712 yysize = 0;
1713 break;
1716 yysize += (sizeof ("syntax error, unexpected ")
1717 + yystrlen (yytname[yytype]));
1718 yymsg = (char *) YYSTACK_ALLOC (yysize);
1719 if (yymsg != 0)
1721 char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
1722 yyp = yystpcpy (yyp, yytname[yytype]);
1724 if (yycount < 5)
1726 yyprefix = ", expecting ";
1727 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1728 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1730 yyp = yystpcpy (yyp, yyprefix);
1731 yyp = yystpcpy (yyp, yytname[yyx]);
1732 yyprefix = " or ";
1735 yyerror (yymsg);
1736 YYSTACK_FREE (yymsg);
1738 else
1739 yyerror ("syntax error; also virtual memory exhausted");
1741 else
1742 #endif /* YYERROR_VERBOSE */
1743 yyerror ("syntax error");
1748 if (yyerrstatus == 3)
1750 /* If just tried and failed to reuse lookahead token after an
1751 error, discard it. */
1753 if (yychar <= YYEOF)
1755 /* If at end of input, pop the error token,
1756 then the rest of the stack, then return failure. */
1757 if (yychar == YYEOF)
1758 for (;;)
1760 YYPOPSTACK;
1761 if (yyssp == yyss)
1762 YYABORT;
1763 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1764 yydestruct (yystos[*yyssp], yyvsp);
1767 else
1769 YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
1770 yydestruct (yytoken, &yylval);
1771 yychar = YYEMPTY;
1776 /* Else will try to reuse lookahead token after shifting the error
1777 token. */
1778 goto yyerrlab1;
1781 /*---------------------------------------------------.
1782 | yyerrorlab -- error raised explicitly by YYERROR. |
1783 `---------------------------------------------------*/
1784 yyerrorlab:
1786 #ifdef __GNUC__
1787 /* Pacify GCC when the user code never invokes YYERROR and the label
1788 yyerrorlab therefore never appears in user code. */
1789 if (0)
1790 goto yyerrorlab;
1791 #endif
1793 yyvsp -= yylen;
1794 yyssp -= yylen;
1795 yystate = *yyssp;
1796 goto yyerrlab1;
1799 /*-------------------------------------------------------------.
1800 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1801 `-------------------------------------------------------------*/
1802 yyerrlab1:
1803 yyerrstatus = 3; /* Each real token shifted decrements this. */
1805 for (;;)
1807 yyn = yypact[yystate];
1808 if (yyn != YYPACT_NINF)
1810 yyn += YYTERROR;
1811 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1813 yyn = yytable[yyn];
1814 if (0 < yyn)
1815 break;
1819 /* Pop the current state because it cannot handle the error token. */
1820 if (yyssp == yyss)
1821 YYABORT;
1823 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
1824 yydestruct (yystos[yystate], yyvsp);
1825 YYPOPSTACK;
1826 yystate = *yyssp;
1827 YY_STACK_PRINT (yyss, yyssp);
1830 if (yyn == YYFINAL)
1831 YYACCEPT;
1833 YYDPRINTF ((stderr, "Shifting error token, "));
1835 *++yyvsp = yylval;
1838 yystate = yyn;
1839 goto yynewstate;
1842 /*-------------------------------------.
1843 | yyacceptlab -- YYACCEPT comes here. |
1844 `-------------------------------------*/
1845 yyacceptlab:
1846 yyresult = 0;
1847 goto yyreturn;
1849 /*-----------------------------------.
1850 | yyabortlab -- YYABORT comes here. |
1851 `-----------------------------------*/
1852 yyabortlab:
1853 yyresult = 1;
1854 goto yyreturn;
1856 #ifndef yyoverflow
1857 /*----------------------------------------------.
1858 | yyoverflowlab -- parser overflow comes here. |
1859 `----------------------------------------------*/
1860 yyoverflowlab:
1861 yyerror ("parser stack overflow");
1862 yyresult = 2;
1863 /* Fall through. */
1864 #endif
1866 yyreturn:
1867 #ifndef yyoverflow
1868 if (yyss != yyssa)
1869 YYSTACK_FREE (yyss);
1870 #endif
1871 return yyresult;
1875 #line 464 "gram.y"
1878 void
1879 apply_seq_in_map( SyckParser *parser, SyckNode *n )
1881 long map_len;
1882 if ( n->shortcut == NULL )
1884 return;
1887 map_len = syck_map_count( n );
1888 syck_map_assign( n, map_value, map_len - 1,
1889 syck_hdlr_add_node( parser, n->shortcut ) );
1891 n->shortcut = NULL;