1 /* A Bison parser, made by GNU Bison 2.3. */
2
3 /* Skeleton implementation for Bison's Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
6 Free Software Foundation, Inc.
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
11 any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
22
23 /* As a special exception, you may create a larger work that contains
24 part or all of the Bison parser skeleton and distribute that work
25 under terms of your choice, so long as that work isn't itself a
26 parser generator using the skeleton or a modified version thereof
27 as a parser skeleton. Alternatively, if you modify or redistribute
28 the parser skeleton itself, you may (at your option) remove this
29 special exception, which will cause the skeleton and the resulting
30 Bison output files to be licensed under the GNU General Public
31 License without this special exception.
32
33 This special exception was added by the Free Software Foundation in
34 version 2.2 of Bison. */
35
36 /* C LALR(1) parser skeleton written by Richard Stallman, by
37 simplifying the original so-called "semantic" parser. */
38
39 /* All symbols defined below should begin with yy or YY, to avoid
40 infringing on user name space. This should be done even for local
41 variables, as they might otherwise be expanded by user macros.
42 There are some unavoidable exceptions within include files to
43 define necessary library symbols; they are noted "INFRINGES ON
44 USER NAME SPACE" below. */
45
46 /* Identify Bison output. */
47 #define YYBISON 1
48
49 /* Bison version. */
50 #define YYBISON_VERSION "2.3"
51
52 /* Skeleton name. */
53 #define YYSKELETON_NAME "yacc.c"
54
55 /* Pure parsers. */
56 #define YYPURE 0
57
58 /* Using locations. */
59 #define YYLSP_NEEDED 0
60
61 /* Substitute the variable and function names. */
62 #define yyparse guidoarparse
63 #define yylex guidoarlex
64 #define yyerror guidoarerror
65 #define yylval guidoarlval
66 #define yychar guidoarchar
67 #define yydebug guidoardebug
68 #define yynerrs guidoarnerrs
69
70
71 /* Tokens. */
72 #ifndef YYTOKENTYPE
73 # define YYTOKENTYPE
74 /* Put the tokens into the symbol table, so that GDB and other debuggers
75 know about them. */
76 enum yytokentype {
77 NUMBER = 258,
78 PNUMBER = 259,
79 NNUMBER = 260,
80 FLOAT = 261,
81 STARTCHORD = 262,
82 ENDCHORD = 263,
83 STARTSEQ = 264,
84 ENDSEQ = 265,
85 STARTPARAM = 266,
86 ENDPARAM = 267,
87 STARTRANGE = 268,
88 ENDRANGE = 269,
89 SEP = 270,
90 IDSEP = 271,
91 BAR = 272,
92 TAGNAME = 273,
93 ID = 274,
94 DIATONIC = 275,
95 CHROMATIC = 276,
96 SOLFEGE = 277,
97 EMPTY = 278,
98 REST = 279,
99 DOT = 280,
100 DDOT = 281,
101 SHARP = 282,
102 FLAT = 283,
103 MLS = 284,
104 SEC = 285,
105 UNIT = 286,
106 MULT = 287,
107 DIV = 288,
108 EQUAL = 289,
109 STRING = 290,
110 EXTRA = 291
111 };
112 #endif
113 /* Tokens. */
114 #define NUMBER 258
115 #define PNUMBER 259
116 #define NNUMBER 260
117 #define FLOAT 261
118 #define STARTCHORD 262
119 #define ENDCHORD 263
120 #define STARTSEQ 264
121 #define ENDSEQ 265
122 #define STARTPARAM 266
123 #define ENDPARAM 267
124 #define STARTRANGE 268
125 #define ENDRANGE 269
126 #define SEP 270
127 #define IDSEP 271
128 #define BAR 272
129 #define TAGNAME 273
130 #define ID 274
131 #define DIATONIC 275
132 #define CHROMATIC 276
133 #define SOLFEGE 277
134 #define EMPTY 278
135 #define REST 279
136 #define DOT 280
137 #define DDOT 281
138 #define SHARP 282
139 #define FLAT 283
140 #define MLS 284
141 #define SEC 285
142 #define UNIT 286
143 #define MULT 287
144 #define DIV 288
145 #define EQUAL 289
146 #define STRING 290
147 #define EXTRA 291
148
149
150
151
152 /* Copy the first part of user declarations. */
153 #line 1 "guido.y"
154
155
156 #include <string>
157 #include <iostream>
158 #include <vector>
159 #include <assert.h>
160
161 #include "guidoelement.h"
162 #include "gmnreader.h"
163 #include "guidorational.h"
164
165 #include "guidoparse.h++"
166 #include "guidolex.c++"
167
168 int guidoarerror(const char*s);
guidoarwrap()169 int guidoarwrap() { return(1); }
170
171 extern guido::gmnreader* gReader;
172
vadd(std::vector<guido::Sguidoelement> * v1,std::vector<guido::Sguidoelement> * v2)173 static void vadd (std::vector<guido::Sguidoelement>* v1, std::vector<guido::Sguidoelement>* v2)
174 {
175 for (std::vector<guido::Sguidoelement>::iterator i = v2->begin(); i != v2->end(); i++)
176 v1->push_back(*i);
177 }
178
179 //#define parseDebug
180
181 #ifdef parseDebug
182 #define debug(msg) cout << msg << endl;
183 #define vdebug(msg,v) cout << msg << " " << v << endl;
184 #else
185 #define debug(msg)
186 #define vdebug(msg, v)
187 #endif
188
189 #define addElt(to,elt) (to)->push(*elt); delete elt
190
191 using namespace std;
192
193 namespace guido
194 {
195
196
197
198 /* Enabling traces. */
199 #ifndef YYDEBUG
200 # define YYDEBUG 0
201 #endif
202
203 /* Enabling verbose error messages. */
204 #ifdef YYERROR_VERBOSE
205 # undef YYERROR_VERBOSE
206 # define YYERROR_VERBOSE 1
207 #else
208 # define YYERROR_VERBOSE 0
209 #endif
210
211 /* Enabling the token table. */
212 #ifndef YYTOKEN_TABLE
213 # define YYTOKEN_TABLE 0
214 #endif
215
216 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
217 typedef union YYSTYPE
218 #line 48 "guido.y"
219 {
220 long int num;
221 float real;
222 const char* token;
223 std::string* str;
224 char c;
225 guido::Sguidoelement * elt;
226 guido::Sguidoattribute* attr;
227 std::vector<guido::Sguidoelement>* velt;
228 std::vector<guido::Sguidoattribute>* vattr;
229 guido::rational * r;
230 }
231 /* Line 193 of yacc.c. */
232 #line 233 "guidoparse.c++"
233 YYSTYPE;
234 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
235 # define YYSTYPE_IS_DECLARED 1
236 # define YYSTYPE_IS_TRIVIAL 1
237 #endif
238
239
240
241 /* Copy the second part of user declarations. */
242
243
244 /* Line 216 of yacc.c. */
245 #line 246 "guidoparse.c++"
246
247 #ifdef short
248 # undef short
249 #endif
250
251 #ifdef YYTYPE_UINT8
252 typedef YYTYPE_UINT8 yytype_uint8;
253 #else
254 typedef unsigned char yytype_uint8;
255 #endif
256
257 #ifdef YYTYPE_INT8
258 typedef YYTYPE_INT8 yytype_int8;
259 #elif (defined __STDC__ || defined __C99__FUNC__ \
260 || defined __cplusplus || defined _MSC_VER)
261 typedef signed char yytype_int8;
262 #else
263 typedef short int yytype_int8;
264 #endif
265
266 #ifdef YYTYPE_UINT16
267 typedef YYTYPE_UINT16 yytype_uint16;
268 #else
269 typedef unsigned short int yytype_uint16;
270 #endif
271
272 #ifdef YYTYPE_INT16
273 typedef YYTYPE_INT16 yytype_int16;
274 #else
275 typedef short int yytype_int16;
276 #endif
277
278 #ifndef YYSIZE_T
279 # ifdef __SIZE_TYPE__
280 # define YYSIZE_T __SIZE_TYPE__
281 # elif defined size_t
282 # define YYSIZE_T size_t
283 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
284 || defined __cplusplus || defined _MSC_VER)
285 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
286 # define YYSIZE_T size_t
287 # else
288 # define YYSIZE_T unsigned int
289 # endif
290 #endif
291
292 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
293
294 #ifndef YY_
295 # if defined YYENABLE_NLS && YYENABLE_NLS
296 # if ENABLE_NLS
297 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
298 # define YY_(msgid) dgettext ("bison-runtime", msgid)
299 # endif
300 # endif
301 # ifndef YY_
302 # define YY_(msgid) msgid
303 # endif
304 #endif
305
306 /* Suppress unused-variable warnings by "using" E. */
307 #if ! defined lint || defined __GNUC__
308 # define YYUSE(e) ((void) (e))
309 #else
310 # define YYUSE(e) /* empty */
311 #endif
312
313 /* Identity function, used to suppress warnings about constant conditions. */
314 #ifndef lint
315 # define YYID(n) (n)
316 #else
317 #if (defined __STDC__ || defined __C99__FUNC__ \
318 || defined __cplusplus || defined _MSC_VER)
319 static int
YYID(int i)320 YYID (int i)
321 #else
322 static int
323 YYID (i)
324 int i;
325 #endif
326 {
327 return i;
328 }
329 #endif
330
331 #if ! defined yyoverflow || YYERROR_VERBOSE
332
333 /* The parser invokes alloca or malloc; define the necessary symbols. */
334
335 # ifdef YYSTACK_USE_ALLOCA
336 # if YYSTACK_USE_ALLOCA
337 # ifdef __GNUC__
338 # define YYSTACK_ALLOC __builtin_alloca
339 # elif defined __BUILTIN_VA_ARG_INCR
340 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
341 # elif defined _AIX
342 # define YYSTACK_ALLOC __alloca
343 # elif defined _MSC_VER
344 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
345 # define alloca _alloca
346 # else
347 # define YYSTACK_ALLOC alloca
348 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
349 || defined __cplusplus || defined _MSC_VER)
350 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
351 # ifndef _STDLIB_H
352 # define _STDLIB_H 1
353 # endif
354 # endif
355 # endif
356 # endif
357 # endif
358
359 # ifdef YYSTACK_ALLOC
360 /* Pacify GCC's `empty if-body' warning. */
361 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
362 # ifndef YYSTACK_ALLOC_MAXIMUM
363 /* The OS might guarantee only one guard page at the bottom of the stack,
364 and a page size can be as small as 4096 bytes. So we cannot safely
365 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
366 to allow for a few compiler-allocated temporary stack slots. */
367 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
368 # endif
369 # else
370 # define YYSTACK_ALLOC YYMALLOC
371 # define YYSTACK_FREE YYFREE
372 # ifndef YYSTACK_ALLOC_MAXIMUM
373 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
374 # endif
375 # if (defined __cplusplus && ! defined _STDLIB_H \
376 && ! ((defined YYMALLOC || defined malloc) \
377 && (defined YYFREE || defined free)))
378 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
379 # ifndef _STDLIB_H
380 # define _STDLIB_H 1
381 # endif
382 # endif
383 # ifndef YYMALLOC
384 # define YYMALLOC malloc
385 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
386 || defined __cplusplus || defined _MSC_VER)
387 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
388 # endif
389 # endif
390 # ifndef YYFREE
391 # define YYFREE free
392 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
393 || defined __cplusplus || defined _MSC_VER)
394 void free (void *); /* INFRINGES ON USER NAME SPACE */
395 # endif
396 # endif
397 # endif
398 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
399
400
401 #if (! defined yyoverflow \
402 && (! defined __cplusplus \
403 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
404
405 /* A type that is properly aligned for any stack member. */
406 union yyalloc
407 {
408 yytype_int16 yyss;
409 YYSTYPE yyvs;
410 };
411
412 /* The size of the maximum gap between one aligned stack and the next. */
413 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
414
415 /* The size of an array large to enough to hold all stacks, each with
416 N elements. */
417 # define YYSTACK_BYTES(N) \
418 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
419 + YYSTACK_GAP_MAXIMUM)
420
421 /* Copy COUNT objects from FROM to TO. The source and destination do
422 not overlap. */
423 # ifndef YYCOPY
424 # if defined __GNUC__ && 1 < __GNUC__
425 # define YYCOPY(To, From, Count) \
426 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
427 # else
428 # define YYCOPY(To, From, Count) \
429 do \
430 { \
431 YYSIZE_T yyi; \
432 for (yyi = 0; yyi < (Count); yyi++) \
433 (To)[yyi] = (From)[yyi]; \
434 } \
435 while (YYID (0))
436 # endif
437 # endif
438
439 /* Relocate STACK from its old location to the new one. The
440 local variables YYSIZE and YYSTACKSIZE give the old and new number of
441 elements in the stack, and YYPTR gives the new location of the
442 stack. Advance YYPTR to a properly aligned location for the next
443 stack. */
444 # define YYSTACK_RELOCATE(Stack) \
445 do \
446 { \
447 YYSIZE_T yynewbytes; \
448 YYCOPY (&yyptr->Stack, Stack, yysize); \
449 Stack = &yyptr->Stack; \
450 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
451 yyptr += yynewbytes / sizeof (*yyptr); \
452 } \
453 while (YYID (0))
454
455 #endif
456
457 /* YYFINAL -- State number of the termination state. */
458 #define YYFINAL 10
459 /* YYLAST -- Last index in YYTABLE. */
460 #define YYLAST 107
461
462 /* YYNTOKENS -- Number of terminals. */
463 #define YYNTOKENS 37
464 /* YYNNTS -- Number of nonterminals. */
465 #define YYNNTS 36
466 /* YYNRULES -- Number of rules. */
467 #define YYNRULES 76
468 /* YYNRULES -- Number of states. */
469 #define YYNSTATES 112
470
471 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
472 #define YYUNDEFTOK 2
473 #define YYMAXUTOK 291
474
475 #define YYTRANSLATE(YYX) \
476 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
477
478 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
479 static const yytype_uint8 yytranslate[] =
480 {
481 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
482 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
483 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
484 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
485 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
486 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
487 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
488 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
489 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
490 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
491 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
492 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
493 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
494 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
495 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
496 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
497 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
498 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
499 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
500 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
501 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
502 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
503 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
504 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
505 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
506 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
507 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
508 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
509 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
510 35, 36
511 };
512
513 #if YYDEBUG
514 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
515 YYRHS. */
516 static const yytype_uint8 yyprhs[] =
517 {
518 0, 0, 3, 5, 8, 12, 14, 16, 20, 24,
519 25, 28, 31, 34, 36, 38, 40, 45, 50, 52,
520 54, 58, 60, 62, 64, 67, 70, 72, 74, 76,
521 80, 82, 86, 90, 92, 96, 98, 101, 104, 108,
522 110, 112, 117, 119, 122, 124, 126, 130, 137, 142,
523 148, 150, 155, 157, 159, 161, 163, 165, 168, 170,
524 172, 173, 175, 176, 181, 184, 187, 188, 190, 192,
525 194, 196, 198, 200, 202, 204, 206
526 };
527
528 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
529 static const yytype_int8 yyrhs[] =
530 {
531 38, 0, -1, 39, -1, 7, 8, -1, 7, 40,
532 8, -1, 41, -1, 41, -1, 40, 15, 41, -1,
533 9, 42, 10, -1, -1, 42, 57, -1, 42, 43,
534 -1, 42, 51, -1, 44, -1, 45, -1, 47, -1,
535 47, 11, 50, 12, -1, 44, 13, 42, 14, -1,
536 18, -1, 46, -1, 46, 16, 3, -1, 17, -1,
537 72, -1, 71, -1, 72, 31, -1, 71, 31, -1,
538 35, -1, 67, -1, 48, -1, 67, 34, 48, -1,
539 49, -1, 50, 15, 49, -1, 7, 52, 8, -1,
540 53, -1, 52, 15, 53, -1, 54, -1, 56, 54,
541 -1, 54, 56, -1, 56, 54, 56, -1, 57, -1,
542 55, -1, 44, 13, 53, 14, -1, 44, -1, 56,
543 44, -1, 59, -1, 58, -1, 24, 65, 66, -1,
544 24, 11, 3, 12, 65, 66, -1, 60, 64, 65,
545 66, -1, 60, 62, 64, 65, 66, -1, 61, -1,
546 61, 11, 3, 12, -1, 20, -1, 21, -1, 22,
547 -1, 23, -1, 63, -1, 62, 63, -1, 27, -1,
548 28, -1, -1, 72, -1, -1, 32, 68, 33, 68,
549 -1, 32, 68, -1, 33, 68, -1, -1, 25, -1,
550 26, -1, 19, -1, 3, -1, 4, -1, 5, -1,
551 6, -1, 68, -1, 69, -1, 70, -1
552 };
553
554 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
555 static const yytype_uint16 yyrline[] =
556 {
557 0, 122, 122, 126, 127, 128, 131, 132, 135, 138,
558 139, 140, 141, 146, 147, 150, 151, 154, 157, 160,
559 161, 162, 165, 166, 167, 168, 169, 170, 173, 174,
560 177, 178, 185, 188, 189, 192, 193, 194, 195, 198,
561 199, 202, 205, 206, 212, 213, 216, 217, 220, 221,
562 224, 225, 228, 229, 230, 231, 234, 235, 238, 239,
563 242, 243, 246, 247, 248, 249, 252, 253, 254, 260,
564 262, 264, 266, 268, 270, 271, 272
565 };
566 #endif
567
568 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
569 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
570 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
571 static const char *const yytname[] =
572 {
573 "$end", "error", "$undefined", "NUMBER", "PNUMBER", "NNUMBER", "FLOAT",
574 "STARTCHORD", "ENDCHORD", "STARTSEQ", "ENDSEQ", "STARTPARAM", "ENDPARAM",
575 "STARTRANGE", "ENDRANGE", "SEP", "IDSEP", "BAR", "TAGNAME", "ID",
576 "DIATONIC", "CHROMATIC", "SOLFEGE", "EMPTY", "REST", "DOT", "DDOT",
577 "SHARP", "FLAT", "MLS", "SEC", "UNIT", "MULT", "DIV", "EQUAL", "STRING",
578 "EXTRA", "$accept", "start", "score", "voicelist", "voice", "symbols",
579 "tag", "positiontag", "rangetag", "tagname", "tagid", "tagarg",
580 "tagparam", "tagparams", "chord", "chordsymbols", "tagchordsymbol",
581 "chordsymbol", "rangechordtag", "taglist", "music", "rest", "note",
582 "noteid", "notename", "accidentals", "accidental", "octave", "duration",
583 "dots", "id", "number", "pnumber", "nnumber", "floatn", "signednumber", 0
584 };
585 #endif
586
587 # ifdef YYPRINT
588 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
589 token YYLEX-NUM. */
590 static const yytype_uint16 yytoknum[] =
591 {
592 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
593 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
594 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
595 285, 286, 287, 288, 289, 290, 291
596 };
597 # endif
598
599 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
600 static const yytype_uint8 yyr1[] =
601 {
602 0, 37, 38, 39, 39, 39, 40, 40, 41, 42,
603 42, 42, 42, 43, 43, 44, 44, 45, 46, 47,
604 47, 47, 48, 48, 48, 48, 48, 48, 49, 49,
605 50, 50, 51, 52, 52, 53, 53, 53, 53, 54,
606 54, 55, 56, 56, 57, 57, 58, 58, 59, 59,
607 60, 60, 61, 61, 61, 61, 62, 62, 63, 63,
608 64, 64, 65, 65, 65, 65, 66, 66, 66, 67,
609 68, 69, 70, 71, 72, 72, 72
610 };
611
612 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
613 static const yytype_uint8 yyr2[] =
614 {
615 0, 2, 1, 2, 3, 1, 1, 3, 3, 0,
616 2, 2, 2, 1, 1, 1, 4, 4, 1, 1,
617 3, 1, 1, 1, 2, 2, 1, 1, 1, 3,
618 1, 3, 3, 1, 3, 1, 2, 2, 3, 1,
619 1, 4, 1, 2, 1, 1, 3, 6, 4, 5,
620 1, 4, 1, 1, 1, 1, 1, 2, 1, 1,
621 0, 1, 0, 4, 2, 2, 0, 1, 1, 1,
622 1, 1, 1, 1, 1, 1, 1
623 };
624
625 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
626 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
627 means the default is an error. */
628 static const yytype_uint8 yydefact[] =
629 {
630 0, 0, 9, 0, 2, 5, 3, 0, 6, 0,
631 1, 4, 0, 0, 8, 21, 18, 52, 53, 54,
632 55, 62, 11, 13, 14, 19, 15, 12, 10, 45,
633 44, 60, 50, 7, 42, 0, 33, 35, 40, 0,
634 39, 0, 0, 0, 66, 9, 0, 0, 70, 71,
635 72, 58, 59, 60, 56, 62, 74, 75, 76, 61,
636 0, 0, 32, 0, 42, 37, 43, 36, 0, 64,
637 65, 67, 68, 46, 0, 20, 73, 69, 26, 28,
638 30, 0, 27, 23, 22, 57, 62, 66, 0, 0,
639 34, 43, 38, 62, 0, 17, 16, 0, 0, 25,
640 24, 66, 48, 51, 41, 66, 63, 31, 29, 27,
641 49, 47
642 };
643
644 /* YYDEFGOTO[NTERM-NUM]. */
645 static const yytype_int8 yydefgoto[] =
646 {
647 -1, 3, 4, 7, 5, 9, 22, 34, 24, 25,
648 26, 79, 80, 81, 27, 35, 36, 37, 38, 39,
649 40, 29, 30, 31, 32, 53, 54, 55, 44, 73,
650 82, 56, 57, 58, 83, 84
651 };
652
653 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
654 STATE-NUM. */
655 #define YYPACT_NINF -68
656 static const yytype_int8 yypact[] =
657 {
658 52, 5, -68, 63, -68, -68, -68, 7, -68, 50,
659 -68, -68, 10, 58, -68, -68, -68, -68, -68, -68,
660 -68, -1, -68, 16, -68, 61, 73, -68, -68, -68,
661 -68, 13, 76, -68, 56, 40, -68, 8, -68, 58,
662 -68, 85, 86, 86, 19, -68, 87, 2, -68, -68,
663 -68, -68, -68, 13, -68, 53, -68, -68, -68, -68,
664 88, 58, -68, 58, -68, 8, 56, 8, 80, 60,
665 -68, -68, -68, -68, 29, -68, -68, -68, -68, -68,
666 -68, 12, 62, 64, 66, -68, 53, 19, 82, 84,
667 -68, -68, 8, 53, 86, -68, -68, 2, 2, -68,
668 -68, 19, -68, -68, -68, 19, -68, -68, -68, -68,
669 -68, -68
670 };
671
672 /* YYPGOTO[NTERM-NUM]. */
673 static const yytype_int8 yypgoto[] =
674 {
675 -68, -68, -68, -68, 11, 54, -68, -9, -68, -68,
676 -68, 3, 6, -68, -68, -68, 1, 65, -68, -28,
677 -8, -68, -68, -68, -68, -68, 47, 49, -51, -67,
678 9, -40, -68, -68, -68, -20
679 };
680
681 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
682 positive, shift that token. If negative, reduce the rule which
683 number is the opposite. If zero, do what YYDEFACT says.
684 If YYTABLE_NINF, syntax error. */
685 #define YYTABLE_NINF -1
686 static const yytype_uint8 yytable[] =
687 {
688 23, 28, 69, 70, 87, 48, 49, 50, 76, 65,
689 41, 59, 8, 6, 2, 11, 48, 49, 50, 2,
690 102, 77, 12, 33, 96, 15, 16, 97, 64, 45,
691 66, 42, 43, 59, 110, 101, 13, 78, 111, 92,
692 51, 52, 105, 95, 71, 72, 15, 16, 62, 17,
693 18, 19, 20, 21, 106, 63, 91, 13, 64, 1,
694 14, 2, 89, 10, 90, 23, 28, 15, 16, 61,
695 17, 18, 19, 20, 21, 15, 16, 46, 17, 18,
696 19, 20, 21, 91, 47, 42, 43, 60, 68, 48,
697 75, 88, 93, 94, 103, 99, 98, 100, 104, 74,
698 85, 108, 86, 107, 67, 0, 0, 109
699 };
700
701 static const yytype_int8 yycheck[] =
702 {
703 9, 9, 42, 43, 55, 3, 4, 5, 6, 37,
704 11, 31, 1, 8, 9, 8, 3, 4, 5, 9,
705 87, 19, 15, 12, 12, 17, 18, 15, 37, 13,
706 39, 32, 33, 53, 101, 86, 7, 35, 105, 67,
707 27, 28, 93, 14, 25, 26, 17, 18, 8, 20,
708 21, 22, 23, 24, 94, 15, 65, 7, 67, 7,
709 10, 9, 61, 0, 63, 74, 74, 17, 18, 13,
710 20, 21, 22, 23, 24, 17, 18, 16, 20, 21,
711 22, 23, 24, 92, 11, 32, 33, 11, 3, 3,
712 3, 3, 12, 33, 12, 31, 34, 31, 14, 45,
713 53, 98, 53, 97, 39, -1, -1, 98
714 };
715
716 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
717 symbol of state STATE-NUM. */
718 static const yytype_uint8 yystos[] =
719 {
720 0, 7, 9, 38, 39, 41, 8, 40, 41, 42,
721 0, 8, 15, 7, 10, 17, 18, 20, 21, 22,
722 23, 24, 43, 44, 45, 46, 47, 51, 57, 58,
723 59, 60, 61, 41, 44, 52, 53, 54, 55, 56,
724 57, 11, 32, 33, 65, 13, 16, 11, 3, 4,
725 5, 27, 28, 62, 63, 64, 68, 69, 70, 72,
726 11, 13, 8, 15, 44, 56, 44, 54, 3, 68,
727 68, 25, 26, 66, 42, 3, 6, 19, 35, 48,
728 49, 50, 67, 71, 72, 63, 64, 65, 3, 53,
729 53, 44, 56, 12, 33, 14, 12, 15, 34, 31,
730 31, 65, 66, 12, 14, 65, 68, 49, 48, 67,
731 66, 66
732 };
733
734 #define yyerrok (yyerrstatus = 0)
735 #define yyclearin (yychar = YYEMPTY)
736 #define YYEMPTY (-2)
737 #define YYEOF 0
738
739 #define YYACCEPT goto yyacceptlab
740 #define YYABORT goto yyabortlab
741 #define YYERROR goto yyerrorlab
742
743
744 /* Like YYERROR except do call yyerror. This remains here temporarily
745 to ease the transition to the new meaning of YYERROR, for GCC.
746 Once GCC version 2 has supplanted version 1, this can go. */
747
748 #define YYFAIL goto yyerrlab
749
750 #define YYRECOVERING() (!!yyerrstatus)
751
752 #define YYBACKUP(Token, Value) \
753 do \
754 if (yychar == YYEMPTY && yylen == 1) \
755 { \
756 yychar = (Token); \
757 yylval = (Value); \
758 yytoken = YYTRANSLATE (yychar); \
759 YYPOPSTACK (1); \
760 goto yybackup; \
761 } \
762 else \
763 { \
764 yyerror (YY_("syntax error: cannot back up")); \
765 YYERROR; \
766 } \
767 while (YYID (0))
768
769
770 #define YYTERROR 1
771 #define YYERRCODE 256
772
773
774 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
775 If N is 0, then set CURRENT to the empty location which ends
776 the previous symbol: RHS[0] (always defined). */
777
778 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
779 #ifndef YYLLOC_DEFAULT
780 # define YYLLOC_DEFAULT(Current, Rhs, N) \
781 do \
782 if (YYID (N)) \
783 { \
784 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
785 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
786 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
787 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
788 } \
789 else \
790 { \
791 (Current).first_line = (Current).last_line = \
792 YYRHSLOC (Rhs, 0).last_line; \
793 (Current).first_column = (Current).last_column = \
794 YYRHSLOC (Rhs, 0).last_column; \
795 } \
796 while (YYID (0))
797 #endif
798
799
800 /* YY_LOCATION_PRINT -- Print the location on the stream.
801 This macro was not mandated originally: define only if we know
802 we won't break user code: when these are the locations we know. */
803
804 #ifndef YY_LOCATION_PRINT
805 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
806 # define YY_LOCATION_PRINT(File, Loc) \
807 fprintf (File, "%d.%d-%d.%d", \
808 (Loc).first_line, (Loc).first_column, \
809 (Loc).last_line, (Loc).last_column)
810 # else
811 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
812 # endif
813 #endif
814
815
816 /* YYLEX -- calling `yylex' with the right arguments. */
817
818 #ifdef YYLEX_PARAM
819 # define YYLEX yylex (YYLEX_PARAM)
820 #else
821 # define YYLEX yylex ()
822 #endif
823
824 /* Enable debugging if requested. */
825 #if YYDEBUG
826
827 # ifndef YYFPRINTF
828 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
829 # define YYFPRINTF fprintf
830 # endif
831
832 # define YYDPRINTF(Args) \
833 do { \
834 if (yydebug) \
835 YYFPRINTF Args; \
836 } while (YYID (0))
837
838 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
839 do { \
840 if (yydebug) \
841 { \
842 YYFPRINTF (stderr, "%s ", Title); \
843 yy_symbol_print (stderr, \
844 Type, Value); \
845 YYFPRINTF (stderr, "\n"); \
846 } \
847 } while (YYID (0))
848
849
850 /*--------------------------------.
851 | Print this symbol on YYOUTPUT. |
852 `--------------------------------*/
853
854 /*ARGSUSED*/
855 #if (defined __STDC__ || defined __C99__FUNC__ \
856 || defined __cplusplus || defined _MSC_VER)
857 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)858 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
859 #else
860 static void
861 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
862 FILE *yyoutput;
863 int yytype;
864 YYSTYPE const * const yyvaluep;
865 #endif
866 {
867 if (!yyvaluep)
868 return;
869 # ifdef YYPRINT
870 if (yytype < YYNTOKENS)
871 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
872 # else
873 YYUSE (yyoutput);
874 # endif
875 switch (yytype)
876 {
877 default:
878 break;
879 }
880 }
881
882
883 /*--------------------------------.
884 | Print this symbol on YYOUTPUT. |
885 `--------------------------------*/
886
887 #if (defined __STDC__ || defined __C99__FUNC__ \
888 || defined __cplusplus || defined _MSC_VER)
889 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)890 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
891 #else
892 static void
893 yy_symbol_print (yyoutput, yytype, yyvaluep)
894 FILE *yyoutput;
895 int yytype;
896 YYSTYPE const * const yyvaluep;
897 #endif
898 {
899 if (yytype < YYNTOKENS)
900 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
901 else
902 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
903
904 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
905 YYFPRINTF (yyoutput, ")");
906 }
907
908 /*------------------------------------------------------------------.
909 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
910 | TOP (included). |
911 `------------------------------------------------------------------*/
912
913 #if (defined __STDC__ || defined __C99__FUNC__ \
914 || defined __cplusplus || defined _MSC_VER)
915 static void
yy_stack_print(yytype_int16 * bottom,yytype_int16 * top)916 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
917 #else
918 static void
919 yy_stack_print (bottom, top)
920 yytype_int16 *bottom;
921 yytype_int16 *top;
922 #endif
923 {
924 YYFPRINTF (stderr, "Stack now");
925 for (; bottom <= top; ++bottom)
926 YYFPRINTF (stderr, " %d", *bottom);
927 YYFPRINTF (stderr, "\n");
928 }
929
930 # define YY_STACK_PRINT(Bottom, Top) \
931 do { \
932 if (yydebug) \
933 yy_stack_print ((Bottom), (Top)); \
934 } while (YYID (0))
935
936
937 /*------------------------------------------------.
938 | Report that the YYRULE is going to be reduced. |
939 `------------------------------------------------*/
940
941 #if (defined __STDC__ || defined __C99__FUNC__ \
942 || defined __cplusplus || defined _MSC_VER)
943 static void
yy_reduce_print(YYSTYPE * yyvsp,int yyrule)944 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
945 #else
946 static void
947 yy_reduce_print (yyvsp, yyrule)
948 YYSTYPE *yyvsp;
949 int yyrule;
950 #endif
951 {
952 int yynrhs = yyr2[yyrule];
953 int yyi;
954 unsigned long int yylno = yyrline[yyrule];
955 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
956 yyrule - 1, yylno);
957 /* The symbols being reduced. */
958 for (yyi = 0; yyi < yynrhs; yyi++)
959 {
960 fprintf (stderr, " $%d = ", yyi + 1);
961 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
962 &(yyvsp[(yyi + 1) - (yynrhs)])
963 );
964 fprintf (stderr, "\n");
965 }
966 }
967
968 # define YY_REDUCE_PRINT(Rule) \
969 do { \
970 if (yydebug) \
971 yy_reduce_print (yyvsp, Rule); \
972 } while (YYID (0))
973
974 /* Nonzero means print parse trace. It is left uninitialized so that
975 multiple parsers can coexist. */
976 int yydebug;
977 #else /* !YYDEBUG */
978 # define YYDPRINTF(Args)
979 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
980 # define YY_STACK_PRINT(Bottom, Top)
981 # define YY_REDUCE_PRINT(Rule)
982 #endif /* !YYDEBUG */
983
984
985 /* YYINITDEPTH -- initial size of the parser's stacks. */
986 #ifndef YYINITDEPTH
987 # define YYINITDEPTH 200
988 #endif
989
990 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
991 if the built-in stack extension method is used).
992
993 Do not make this value too large; the results are undefined if
994 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
995 evaluated with infinite-precision integer arithmetic. */
996
997 #ifndef YYMAXDEPTH
998 # define YYMAXDEPTH 10000
999 #endif
1000
1001
1002
1003 #if YYERROR_VERBOSE
1004
1005 # ifndef yystrlen
1006 # if defined __GLIBC__ && defined _STRING_H
1007 # define yystrlen strlen
1008 # else
1009 /* Return the length of YYSTR. */
1010 #if (defined __STDC__ || defined __C99__FUNC__ \
1011 || defined __cplusplus || defined _MSC_VER)
1012 static YYSIZE_T
yystrlen(const char * yystr)1013 yystrlen (const char *yystr)
1014 #else
1015 static YYSIZE_T
1016 yystrlen (yystr)
1017 const char *yystr;
1018 #endif
1019 {
1020 YYSIZE_T yylen;
1021 for (yylen = 0; yystr[yylen]; yylen++)
1022 continue;
1023 return yylen;
1024 }
1025 # endif
1026 # endif
1027
1028 # ifndef yystpcpy
1029 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1030 # define yystpcpy stpcpy
1031 # else
1032 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1033 YYDEST. */
1034 #if (defined __STDC__ || defined __C99__FUNC__ \
1035 || defined __cplusplus || defined _MSC_VER)
1036 static char *
yystpcpy(char * yydest,const char * yysrc)1037 yystpcpy (char *yydest, const char *yysrc)
1038 #else
1039 static char *
1040 yystpcpy (yydest, yysrc)
1041 char *yydest;
1042 const char *yysrc;
1043 #endif
1044 {
1045 char *yyd = yydest;
1046 const char *yys = yysrc;
1047
1048 while ((*yyd++ = *yys++) != '\0')
1049 continue;
1050
1051 return yyd - 1;
1052 }
1053 # endif
1054 # endif
1055
1056 # ifndef yytnamerr
1057 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1058 quotes and backslashes, so that it's suitable for yyerror. The
1059 heuristic is that double-quoting is unnecessary unless the string
1060 contains an apostrophe, a comma, or backslash (other than
1061 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1062 null, do not copy; instead, return the length of what the result
1063 would have been. */
1064 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)1065 yytnamerr (char *yyres, const char *yystr)
1066 {
1067 if (*yystr == '"')
1068 {
1069 YYSIZE_T yyn = 0;
1070 char const *yyp = yystr;
1071
1072 for (;;)
1073 switch (*++yyp)
1074 {
1075 case '\'':
1076 case ',':
1077 goto do_not_strip_quotes;
1078
1079 case '\\':
1080 if (*++yyp != '\\')
1081 goto do_not_strip_quotes;
1082 /* Fall through. */
1083 default:
1084 if (yyres)
1085 yyres[yyn] = *yyp;
1086 yyn++;
1087 break;
1088
1089 case '"':
1090 if (yyres)
1091 yyres[yyn] = '\0';
1092 return yyn;
1093 }
1094 do_not_strip_quotes: ;
1095 }
1096
1097 if (! yyres)
1098 return yystrlen (yystr);
1099
1100 return yystpcpy (yyres, yystr) - yyres;
1101 }
1102 # endif
1103
1104 /* Copy into YYRESULT an error message about the unexpected token
1105 YYCHAR while in state YYSTATE. Return the number of bytes copied,
1106 including the terminating null byte. If YYRESULT is null, do not
1107 copy anything; just return the number of bytes that would be
1108 copied. As a special case, return 0 if an ordinary "syntax error"
1109 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
1110 size calculation. */
1111 static YYSIZE_T
yysyntax_error(char * yyresult,int yystate,int yychar)1112 yysyntax_error (char *yyresult, int yystate, int yychar)
1113 {
1114 int yyn = yypact[yystate];
1115
1116 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
1117 return 0;
1118 else
1119 {
1120 int yytype = YYTRANSLATE (yychar);
1121 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
1122 YYSIZE_T yysize = yysize0;
1123 YYSIZE_T yysize1;
1124 int yysize_overflow = 0;
1125 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1126 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1127 int yyx;
1128
1129 # if 0
1130 /* This is so xgettext sees the translatable formats that are
1131 constructed on the fly. */
1132 YY_("syntax error, unexpected %s");
1133 YY_("syntax error, unexpected %s, expecting %s");
1134 YY_("syntax error, unexpected %s, expecting %s or %s");
1135 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
1136 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
1137 # endif
1138 char *yyfmt;
1139 char const *yyf;
1140 static char const yyunexpected[] = "syntax error, unexpected %s";
1141 static char const yyexpecting[] = ", expecting %s";
1142 static char const yyor[] = " or %s";
1143 char yyformat[sizeof yyunexpected
1144 + sizeof yyexpecting - 1
1145 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1146 * (sizeof yyor - 1))];
1147 char const *yyprefix = yyexpecting;
1148
1149 /* Start YYX at -YYN if negative to avoid negative indexes in
1150 YYCHECK. */
1151 int yyxbegin = yyn < 0 ? -yyn : 0;
1152
1153 /* Stay within bounds of both yycheck and yytname. */
1154 int yychecklim = YYLAST - yyn + 1;
1155 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1156 int yycount = 1;
1157
1158 yyarg[0] = yytname[yytype];
1159 yyfmt = yystpcpy (yyformat, yyunexpected);
1160
1161 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1162 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1163 {
1164 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1165 {
1166 yycount = 1;
1167 yysize = yysize0;
1168 yyformat[sizeof yyunexpected - 1] = '\0';
1169 break;
1170 }
1171 yyarg[yycount++] = yytname[yyx];
1172 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1173 yysize_overflow |= (yysize1 < yysize);
1174 yysize = yysize1;
1175 yyfmt = yystpcpy (yyfmt, yyprefix);
1176 yyprefix = yyor;
1177 }
1178
1179 yyf = YY_(yyformat);
1180 yysize1 = yysize + yystrlen (yyf);
1181 yysize_overflow |= (yysize1 < yysize);
1182 yysize = yysize1;
1183
1184 if (yysize_overflow)
1185 return YYSIZE_MAXIMUM;
1186
1187 if (yyresult)
1188 {
1189 /* Avoid sprintf, as that infringes on the user's name space.
1190 Don't have undefined behavior even if the translation
1191 produced a string with the wrong number of "%s"s. */
1192 char *yyp = yyresult;
1193 int yyi = 0;
1194 while ((*yyp = *yyf) != '\0')
1195 {
1196 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1197 {
1198 yyp += yytnamerr (yyp, yyarg[yyi++]);
1199 yyf += 2;
1200 }
1201 else
1202 {
1203 yyp++;
1204 yyf++;
1205 }
1206 }
1207 }
1208 return yysize;
1209 }
1210 }
1211 #endif /* YYERROR_VERBOSE */
1212
1213
1214 /*-----------------------------------------------.
1215 | Release the memory associated to this symbol. |
1216 `-----------------------------------------------*/
1217
1218 /*ARGSUSED*/
1219 #if (defined __STDC__ || defined __C99__FUNC__ \
1220 || defined __cplusplus || defined _MSC_VER)
1221 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)1222 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1223 #else
1224 static void
1225 yydestruct (yymsg, yytype, yyvaluep)
1226 const char *yymsg;
1227 int yytype;
1228 YYSTYPE *yyvaluep;
1229 #endif
1230 {
1231 YYUSE (yyvaluep);
1232
1233 if (!yymsg)
1234 yymsg = "Deleting";
1235 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1236
1237 switch (yytype)
1238 {
1239
1240 default:
1241 break;
1242 }
1243 }
1244
1245
1246 /* Prevent warnings from -Wmissing-prototypes. */
1247
1248 #ifdef YYPARSE_PARAM
1249 #if defined __STDC__ || defined __cplusplus
1250 int yyparse (void *YYPARSE_PARAM);
1251 #else
1252 int yyparse ();
1253 #endif
1254 #else /* ! YYPARSE_PARAM */
1255 #if defined __STDC__ || defined __cplusplus
1256 int yyparse (void);
1257 #else
1258 int yyparse ();
1259 #endif
1260 #endif /* ! YYPARSE_PARAM */
1261
1262
1263
1264 /* The look-ahead symbol. */
1265 int yychar;
1266
1267 /* The semantic value of the look-ahead symbol. */
1268 YYSTYPE yylval;
1269
1270 /* Number of syntax errors so far. */
1271 int yynerrs;
1272
1273
1274
1275 /*----------.
1276 | yyparse. |
1277 `----------*/
1278
1279 #ifdef YYPARSE_PARAM
1280 #if (defined __STDC__ || defined __C99__FUNC__ \
1281 || defined __cplusplus || defined _MSC_VER)
1282 int
yyparse(void * YYPARSE_PARAM)1283 yyparse (void *YYPARSE_PARAM)
1284 #else
1285 int
1286 yyparse (YYPARSE_PARAM)
1287 void *YYPARSE_PARAM;
1288 #endif
1289 #else /* ! YYPARSE_PARAM */
1290 #if (defined __STDC__ || defined __C99__FUNC__ \
1291 || defined __cplusplus || defined _MSC_VER)
1292 int
1293 yyparse (void)
1294 #else
1295 int
1296 yyparse ()
1297
1298 #endif
1299 #endif
1300 {
1301
1302 int yystate;
1303 int yyn;
1304 int yyresult;
1305 /* Number of tokens to shift before error messages enabled. */
1306 int yyerrstatus;
1307 /* Look-ahead token as an internal (translated) token number. */
1308 int yytoken = 0;
1309 #if YYERROR_VERBOSE
1310 /* Buffer for error messages, and its allocated size. */
1311 char yymsgbuf[128];
1312 char *yymsg = yymsgbuf;
1313 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1314 #endif
1315
1316 /* Three stacks and their tools:
1317 `yyss': related to states,
1318 `yyvs': related to semantic values,
1319 `yyls': related to locations.
1320
1321 Refer to the stacks thru separate pointers, to allow yyoverflow
1322 to reallocate them elsewhere. */
1323
1324 /* The state stack. */
1325 yytype_int16 yyssa[YYINITDEPTH];
1326 yytype_int16 *yyss = yyssa;
1327 yytype_int16 *yyssp;
1328
1329 /* The semantic value stack. */
1330 YYSTYPE yyvsa[YYINITDEPTH];
1331 YYSTYPE *yyvs = yyvsa;
1332 YYSTYPE *yyvsp;
1333
1334
1335
1336 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1337
1338 YYSIZE_T yystacksize = YYINITDEPTH;
1339
1340 /* The variables used to return semantic value and location from the
1341 action routines. */
1342 YYSTYPE yyval;
1343
1344
1345 /* The number of symbols on the RHS of the reduced rule.
1346 Keep to zero when no symbol should be popped. */
1347 int yylen = 0;
1348
1349 YYDPRINTF ((stderr, "Starting parse\n"));
1350
1351 yystate = 0;
1352 yyerrstatus = 0;
1353 yynerrs = 0;
1354 yychar = YYEMPTY; /* Cause a token to be read. */
1355
1356 /* Initialize stack pointers.
1357 Waste one element of value and location stack
1358 so that they stay on the same level as the state stack.
1359 The wasted elements are never initialized. */
1360
1361 yyssp = yyss;
1362 yyvsp = yyvs;
1363
1364 goto yysetstate;
1365
1366 /*------------------------------------------------------------.
1367 | yynewstate -- Push a new state, which is found in yystate. |
1368 `------------------------------------------------------------*/
1369 yynewstate:
1370 /* In all cases, when you get here, the value and location stacks
1371 have just been pushed. So pushing a state here evens the stacks. */
1372 yyssp++;
1373
1374 yysetstate:
1375 *yyssp = yystate;
1376
1377 if (yyss + yystacksize - 1 <= yyssp)
1378 {
1379 /* Get the current used size of the three stacks, in elements. */
1380 YYSIZE_T yysize = yyssp - yyss + 1;
1381
1382 #ifdef yyoverflow
1383 {
1384 /* Give user a chance to reallocate the stack. Use copies of
1385 these so that the &'s don't force the real ones into
1386 memory. */
1387 YYSTYPE *yyvs1 = yyvs;
1388 yytype_int16 *yyss1 = yyss;
1389
1390
1391 /* Each stack pointer address is followed by the size of the
1392 data in use in that stack, in bytes. This used to be a
1393 conditional around just the two extra args, but that might
1394 be undefined if yyoverflow is a macro. */
1395 yyoverflow (YY_("memory exhausted"),
1396 &yyss1, yysize * sizeof (*yyssp),
1397 &yyvs1, yysize * sizeof (*yyvsp),
1398
1399 &yystacksize);
1400
1401 yyss = yyss1;
1402 yyvs = yyvs1;
1403 }
1404 #else /* no yyoverflow */
1405 # ifndef YYSTACK_RELOCATE
1406 goto yyexhaustedlab;
1407 # else
1408 /* Extend the stack our own way. */
1409 if (YYMAXDEPTH <= yystacksize)
1410 goto yyexhaustedlab;
1411 yystacksize *= 2;
1412 if (YYMAXDEPTH < yystacksize)
1413 yystacksize = YYMAXDEPTH;
1414
1415 {
1416 yytype_int16 *yyss1 = yyss;
1417 union yyalloc *yyptr =
1418 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1419 if (! yyptr)
1420 goto yyexhaustedlab;
1421 YYSTACK_RELOCATE (yyss);
1422 YYSTACK_RELOCATE (yyvs);
1423
1424 # undef YYSTACK_RELOCATE
1425 if (yyss1 != yyssa)
1426 YYSTACK_FREE (yyss1);
1427 }
1428 # endif
1429 #endif /* no yyoverflow */
1430
1431 yyssp = yyss + yysize - 1;
1432 yyvsp = yyvs + yysize - 1;
1433
1434
1435 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1436 (unsigned long int) yystacksize));
1437
1438 if (yyss + yystacksize - 1 <= yyssp)
1439 YYABORT;
1440 }
1441
1442 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1443
1444 goto yybackup;
1445
1446 /*-----------.
1447 | yybackup. |
1448 `-----------*/
1449 yybackup:
1450
1451 /* Do appropriate processing given the current state. Read a
1452 look-ahead token if we need one and don't already have one. */
1453
1454 /* First try to decide what to do without reference to look-ahead token. */
1455 yyn = yypact[yystate];
1456 if (yyn == YYPACT_NINF)
1457 goto yydefault;
1458
1459 /* Not known => get a look-ahead token if don't already have one. */
1460
1461 /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
1462 if (yychar == YYEMPTY)
1463 {
1464 YYDPRINTF ((stderr, "Reading a token: "));
1465 yychar = YYLEX;
1466 }
1467
1468 if (yychar <= YYEOF)
1469 {
1470 yychar = yytoken = YYEOF;
1471 YYDPRINTF ((stderr, "Now at end of input.\n"));
1472 }
1473 else
1474 {
1475 yytoken = YYTRANSLATE (yychar);
1476 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1477 }
1478
1479 /* If the proper action on seeing token YYTOKEN is to reduce or to
1480 detect an error, take that action. */
1481 yyn += yytoken;
1482 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1483 goto yydefault;
1484 yyn = yytable[yyn];
1485 if (yyn <= 0)
1486 {
1487 if (yyn == 0 || yyn == YYTABLE_NINF)
1488 goto yyerrlab;
1489 yyn = -yyn;
1490 goto yyreduce;
1491 }
1492
1493 if (yyn == YYFINAL)
1494 YYACCEPT;
1495
1496 /* Count tokens shifted since error; after three, turn off error
1497 status. */
1498 if (yyerrstatus)
1499 yyerrstatus--;
1500
1501 /* Shift the look-ahead token. */
1502 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1503
1504 /* Discard the shifted token unless it is eof. */
1505 if (yychar != YYEOF)
1506 yychar = YYEMPTY;
1507
1508 yystate = yyn;
1509 *++yyvsp = yylval;
1510
1511 goto yynewstate;
1512
1513
1514 /*-----------------------------------------------------------.
1515 | yydefault -- do the default action for the current state. |
1516 `-----------------------------------------------------------*/
1517 yydefault:
1518 yyn = yydefact[yystate];
1519 if (yyn == 0)
1520 goto yyerrlab;
1521 goto yyreduce;
1522
1523
1524 /*-----------------------------.
1525 | yyreduce -- Do a reduction. |
1526 `-----------------------------*/
1527 yyreduce:
1528 /* yyn is the number of a rule to reduce with. */
1529 yylen = yyr2[yyn];
1530
1531 /* If YYLEN is nonzero, implement the default value of the action:
1532 `$$ = $1'.
1533
1534 Otherwise, the following line sets YYVAL to garbage.
1535 This behavior is undocumented and Bison
1536 users should not rely upon it. Assigning to YYVAL
1537 unconditionally makes the parser a bit smaller, and it avoids a
1538 GCC warning that YYVAL may be used uninitialized. */
1539 yyval = yyvsp[1-yylen];
1540
1541
1542 YY_REDUCE_PRINT (yyn);
1543 switch (yyn)
1544 {
1545 case 2:
1546 #line 122 "guido.y"
1547 {delete (yyvsp[(1) - (1)].elt);;}
1548 break;
1549
1550 case 3:
1551 #line 126 "guido.y"
1552 { debug("new score"); (yyval.elt) = gReader->newScore(); ;}
1553 break;
1554
1555 case 4:
1556 #line 127 "guido.y"
1557 { debug("score voicelist"); (yyval.elt) = gReader->newScore(); addElt(*(yyval.elt), (yyvsp[(2) - (3)].velt)); ;}
1558 break;
1559
1560 case 5:
1561 #line 128 "guido.y"
1562 { debug("score voice"); (yyval.elt) = gReader->newScore(); addElt(*(yyval.elt), (yyvsp[(1) - (1)].elt)); ;}
1563 break;
1564
1565 case 6:
1566 #line 131 "guido.y"
1567 { debug("new voicelist"); (yyval.velt) = new vector<Sguidoelement>; (yyval.velt)->push_back (*(yyvsp[(1) - (1)].elt)); delete (yyvsp[(1) - (1)].elt); ;}
1568 break;
1569
1570 case 7:
1571 #line 132 "guido.y"
1572 { debug("add voicelist"); (yyval.velt) = (yyvsp[(1) - (3)].velt); (yyval.velt)->push_back (*(yyvsp[(3) - (3)].elt)); delete (yyvsp[(3) - (3)].elt); ;}
1573 break;
1574
1575 case 8:
1576 #line 135 "guido.y"
1577 { debug("new voice"); (yyval.elt) = gReader->newVoice(); addElt(*(yyval.elt), (yyvsp[(2) - (3)].velt)); ;}
1578 break;
1579
1580 case 9:
1581 #line 138 "guido.y"
1582 { debug("new symbols"); (yyval.velt) = new vector<Sguidoelement>; ;}
1583 break;
1584
1585 case 10:
1586 #line 139 "guido.y"
1587 { debug("add music"); (yyval.velt) = (yyvsp[(1) - (2)].velt); (yyval.velt)->push_back(*(yyvsp[(2) - (2)].elt)); delete (yyvsp[(2) - (2)].elt); ;}
1588 break;
1589
1590 case 11:
1591 #line 140 "guido.y"
1592 { debug("add tag"); (yyval.velt) = (yyvsp[(1) - (2)].velt); (yyval.velt)->push_back(*(yyvsp[(2) - (2)].elt)); delete (yyvsp[(2) - (2)].elt); ;}
1593 break;
1594
1595 case 12:
1596 #line 141 "guido.y"
1597 { debug("add chord"); (yyval.velt) = (yyvsp[(1) - (2)].velt); (yyval.velt)->push_back(*(yyvsp[(2) - (2)].elt)); delete (yyvsp[(2) - (2)].elt); ;}
1598 break;
1599
1600 case 13:
1601 #line 146 "guido.y"
1602 { debug("position tag "); (yyval.elt) = (yyvsp[(1) - (1)].elt); ;}
1603 break;
1604
1605 case 14:
1606 #line 147 "guido.y"
1607 { debug("range tag "); (yyval.elt) = (yyvsp[(1) - (1)].elt); ;}
1608 break;
1609
1610 case 15:
1611 #line 150 "guido.y"
1612 { debug("new position tag "); (yyval.elt) = (yyvsp[(1) - (1)].elt); ;}
1613 break;
1614
1615 case 16:
1616 #line 151 "guido.y"
1617 { debug("new tag + params"); (yyval.elt) = (yyvsp[(1) - (4)].elt); (*(yyvsp[(1) - (4)].elt))->add (*(yyvsp[(3) - (4)].vattr)); delete (yyvsp[(3) - (4)].vattr); ;}
1618 break;
1619
1620 case 17:
1621 #line 154 "guido.y"
1622 { debug("new range tag "); (yyval.elt) = (yyvsp[(1) - (4)].elt); (*(yyvsp[(1) - (4)].elt))->push (*(yyvsp[(3) - (4)].velt)); delete (yyvsp[(3) - (4)].velt); ;}
1623 break;
1624
1625 case 18:
1626 #line 157 "guido.y"
1627 { debug("tag name "); (yyval.str) = new string(guidoartext); ;}
1628 break;
1629
1630 case 19:
1631 #line 160 "guido.y"
1632 { vdebug("new tag", *(yyvsp[(1) - (1)].str)); (yyval.elt) = gReader->newTag(*(yyvsp[(1) - (1)].str), 0); delete (yyvsp[(1) - (1)].str); if (!(yyval.elt)) { guidoarerror("unknown tag"); YYERROR;} ;}
1633 break;
1634
1635 case 20:
1636 #line 161 "guido.y"
1637 { debug("new tag::id"); (yyval.elt) = gReader->newTag(*(yyvsp[(1) - (3)].str), (yyvsp[(2) - (3)].c)); delete (yyvsp[(1) - (3)].str); if (!(yyval.elt)) { guidoarerror("unknown tag"); YYERROR;} ;}
1638 break;
1639
1640 case 21:
1641 #line 162 "guido.y"
1642 { debug("new bar"); (yyval.elt) = gReader->newTag("bar", 0); ;}
1643 break;
1644
1645 case 22:
1646 #line 165 "guido.y"
1647 { debug("new signednumber arg"); (yyval.attr) = gReader->newAttribute((yyvsp[(1) - (1)].num)); ;}
1648 break;
1649
1650 case 23:
1651 #line 166 "guido.y"
1652 { debug("new FLOAT arg"); (yyval.attr) = gReader->newAttribute((yyvsp[(1) - (1)].real)); ;}
1653 break;
1654
1655 case 24:
1656 #line 167 "guido.y"
1657 { debug("new signednumber UNIT arg"); (yyval.attr) = gReader->newAttribute((yyvsp[(1) - (2)].num)); (*(yyval.attr))->setUnit(guidoartext); ;}
1658 break;
1659
1660 case 25:
1661 #line 168 "guido.y"
1662 { debug("new FLOAT UNIT arg"); (yyval.attr) = gReader->newAttribute((yyvsp[(1) - (2)].real)); (*(yyval.attr))->setUnit(guidoartext); ;}
1663 break;
1664
1665 case 26:
1666 #line 169 "guido.y"
1667 { debug("new STRING arg"); (yyval.attr) = gReader->newAttribute(guidoartext, true); ;}
1668 break;
1669
1670 case 27:
1671 #line 170 "guido.y"
1672 { debug("new ID arg"); (yyval.attr) = gReader->newAttribute(*(yyvsp[(1) - (1)].str), false); delete (yyvsp[(1) - (1)].str); ;}
1673 break;
1674
1675 case 28:
1676 #line 173 "guido.y"
1677 { (yyval.attr) = (yyvsp[(1) - (1)].attr); ;}
1678 break;
1679
1680 case 29:
1681 #line 174 "guido.y"
1682 { (yyval.attr) = (yyvsp[(3) - (3)].attr); (*(yyvsp[(3) - (3)].attr))->setName(*(yyvsp[(1) - (3)].str)); delete (yyvsp[(1) - (3)].str); ;}
1683 break;
1684
1685 case 30:
1686 #line 177 "guido.y"
1687 { (yyval.vattr) = new vector<Sguidoattribute>; (yyval.vattr)->push_back(*(yyvsp[(1) - (1)].attr)); delete (yyvsp[(1) - (1)].attr); ;}
1688 break;
1689
1690 case 31:
1691 #line 178 "guido.y"
1692 { (yyval.vattr) = (yyvsp[(1) - (3)].vattr); (yyval.vattr)->push_back(*(yyvsp[(3) - (3)].attr)); delete (yyvsp[(3) - (3)].attr); ;}
1693 break;
1694
1695 case 32:
1696 #line 185 "guido.y"
1697 { debug("new chord"); (yyval.elt) = gReader->newChord(); (*(yyval.elt))->push(*(yyvsp[(2) - (3)].velt)); delete (yyvsp[(2) - (3)].velt); ;}
1698 break;
1699
1700 case 33:
1701 #line 188 "guido.y"
1702 { (yyval.velt) = new vector<Sguidoelement>; vadd((yyval.velt), (yyvsp[(1) - (1)].velt)); delete (yyvsp[(1) - (1)].velt); ;}
1703 break;
1704
1705 case 34:
1706 #line 189 "guido.y"
1707 { (yyval.velt) = (yyvsp[(1) - (3)].velt); vadd((yyval.velt), (yyvsp[(3) - (3)].velt)); delete (yyvsp[(3) - (3)].velt); ;}
1708 break;
1709
1710 case 35:
1711 #line 192 "guido.y"
1712 { (yyval.velt) = (yyvsp[(1) - (1)].velt);;}
1713 break;
1714
1715 case 36:
1716 #line 193 "guido.y"
1717 { (yyval.velt) = (yyvsp[(1) - (2)].velt); vadd((yyval.velt), (yyvsp[(2) - (2)].velt)); delete (yyvsp[(2) - (2)].velt); ;}
1718 break;
1719
1720 case 37:
1721 #line 194 "guido.y"
1722 { (yyval.velt) = (yyvsp[(1) - (2)].velt); vadd((yyval.velt), (yyvsp[(2) - (2)].velt)); delete (yyvsp[(2) - (2)].velt); ;}
1723 break;
1724
1725 case 38:
1726 #line 195 "guido.y"
1727 { (yyval.velt) = (yyvsp[(1) - (3)].velt); vadd((yyval.velt), (yyvsp[(2) - (3)].velt)); delete (yyvsp[(2) - (3)].velt); vadd((yyval.velt), (yyvsp[(3) - (3)].velt)); delete (yyvsp[(3) - (3)].velt); ;}
1728 break;
1729
1730 case 39:
1731 #line 198 "guido.y"
1732 { (yyval.velt) = new vector<Sguidoelement>; (yyval.velt)->push_back(*(yyvsp[(1) - (1)].elt)); delete (yyvsp[(1) - (1)].elt); ;}
1733 break;
1734
1735 case 40:
1736 #line 199 "guido.y"
1737 { (yyval.velt) = new vector<Sguidoelement>; (yyval.velt)->push_back(*(yyvsp[(1) - (1)].elt)); delete (yyvsp[(1) - (1)].elt); ;}
1738 break;
1739
1740 case 41:
1741 #line 202 "guido.y"
1742 { debug("range chord tag"); (yyval.elt) = (yyvsp[(1) - (4)].elt); (*(yyval.elt))->push(*(yyvsp[(3) - (4)].velt)); delete (yyvsp[(3) - (4)].velt); ;}
1743 break;
1744
1745 case 42:
1746 #line 205 "guido.y"
1747 { debug("new taglist 1"); (yyval.velt) = new vector<Sguidoelement>; (yyval.velt)->push_back(*(yyvsp[(1) - (1)].elt)); delete (yyvsp[(1) - (1)].elt); ;}
1748 break;
1749
1750 case 43:
1751 #line 206 "guido.y"
1752 { debug("new taglist 2"); (yyval.velt) = (yyvsp[(1) - (2)].velt); (yyval.velt)->push_back(*(yyvsp[(2) - (2)].elt)); delete (yyvsp[(2) - (2)].elt); ;}
1753 break;
1754
1755 case 44:
1756 #line 212 "guido.y"
1757 { (yyval.elt) = (yyvsp[(1) - (1)].elt); ;}
1758 break;
1759
1760 case 45:
1761 #line 213 "guido.y"
1762 { (yyval.elt) = (yyvsp[(1) - (1)].elt); ;}
1763 break;
1764
1765 case 46:
1766 #line 216 "guido.y"
1767 { debug("new rest 1"); (yyval.elt) = gReader->newRest((yyvsp[(2) - (3)].r), (yyvsp[(3) - (3)].num)); delete (yyvsp[(2) - (3)].r); ;}
1768 break;
1769
1770 case 47:
1771 #line 217 "guido.y"
1772 { debug("new rest 2"); (yyval.elt) = gReader->newRest((yyvsp[(5) - (6)].r), (yyvsp[(6) - (6)].num)); delete (yyvsp[(5) - (6)].r); ;}
1773 break;
1774
1775 case 48:
1776 #line 220 "guido.y"
1777 { debug("new note v1"); (yyval.elt) = gReader->newNote(*(yyvsp[(1) - (4)].str), 0, (yyvsp[(2) - (4)].num), (yyvsp[(3) - (4)].r), (yyvsp[(4) - (4)].num)); delete (yyvsp[(1) - (4)].str); delete (yyvsp[(3) - (4)].r); ;}
1778 break;
1779
1780 case 49:
1781 #line 221 "guido.y"
1782 { debug("new note v2"); (yyval.elt) = gReader->newNote(*(yyvsp[(1) - (5)].str), (yyvsp[(2) - (5)].num), (yyvsp[(3) - (5)].num), (yyvsp[(4) - (5)].r), (yyvsp[(5) - (5)].num)); delete (yyvsp[(1) - (5)].str); delete (yyvsp[(4) - (5)].r); ;}
1783 break;
1784
1785 case 50:
1786 #line 224 "guido.y"
1787 { vdebug("notename", *(yyvsp[(1) - (1)].str)); (yyval.str) = (yyvsp[(1) - (1)].str); ;}
1788 break;
1789
1790 case 51:
1791 #line 225 "guido.y"
1792 { (yyval.str) = (yyvsp[(1) - (4)].str); ;}
1793 break;
1794
1795 case 52:
1796 #line 228 "guido.y"
1797 { debug("new diatonic note"); (yyval.str) = new string(guidoartext); ;}
1798 break;
1799
1800 case 53:
1801 #line 229 "guido.y"
1802 { debug("new chromatic note"); (yyval.str) = new string(guidoartext); ;}
1803 break;
1804
1805 case 54:
1806 #line 230 "guido.y"
1807 { debug("new solfege note"); (yyval.str) = new string(guidoartext); ;}
1808 break;
1809
1810 case 55:
1811 #line 231 "guido.y"
1812 { debug("new empty note"); (yyval.str) = new string(guidoartext); ;}
1813 break;
1814
1815 case 56:
1816 #line 234 "guido.y"
1817 { debug("accidental"); (yyval.num) = (yyvsp[(1) - (1)].num); ;}
1818 break;
1819
1820 case 57:
1821 #line 235 "guido.y"
1822 { debug("accidentals"); (yyval.num) = (yyvsp[(1) - (2)].num) + (yyvsp[(2) - (2)].num); ;}
1823 break;
1824
1825 case 58:
1826 #line 238 "guido.y"
1827 { debug("sharp"); (yyval.num) = 1; ;}
1828 break;
1829
1830 case 59:
1831 #line 239 "guido.y"
1832 { debug("flat"); (yyval.num) = -1; ;}
1833 break;
1834
1835 case 60:
1836 #line 242 "guido.y"
1837 { debug("no octave"); (yyval.num) = -1000; ;}
1838 break;
1839
1840 case 61:
1841 #line 243 "guido.y"
1842 { debug("octave"); (yyval.num) = (yyvsp[(1) - (1)].num); ;}
1843 break;
1844
1845 case 62:
1846 #line 246 "guido.y"
1847 { debug("implicit duration"); (yyval.r) = new rational(-1, 1); ;}
1848 break;
1849
1850 case 63:
1851 #line 247 "guido.y"
1852 { debug("duration ./."); (yyval.r) = new rational((yyvsp[(2) - (4)].num), (yyvsp[(4) - (4)].num)); ;}
1853 break;
1854
1855 case 64:
1856 #line 248 "guido.y"
1857 { debug("duration *"); (yyval.r) = new rational((yyvsp[(2) - (2)].num), 1); ;}
1858 break;
1859
1860 case 65:
1861 #line 249 "guido.y"
1862 { debug("duration /"); (yyval.r) = new rational(1, (yyvsp[(2) - (2)].num)); ;}
1863 break;
1864
1865 case 66:
1866 #line 252 "guido.y"
1867 { debug("dots 0"); (yyval.num) = 0; ;}
1868 break;
1869
1870 case 67:
1871 #line 253 "guido.y"
1872 { debug("dots 1"); (yyval.num) = 1; ;}
1873 break;
1874
1875 case 68:
1876 #line 254 "guido.y"
1877 { debug("dots 2"); (yyval.num) = 2; ;}
1878 break;
1879
1880 case 69:
1881 #line 260 "guido.y"
1882 { (yyval.str) = new string(guidoartext); ;}
1883 break;
1884
1885 case 70:
1886 #line 262 "guido.y"
1887 { vdebug("NUMBER", guidoartext); (yyval.num) = atol(guidoartext); ;}
1888 break;
1889
1890 case 71:
1891 #line 264 "guido.y"
1892 { vdebug("NUMBER", guidoartext); (yyval.num) = atol(guidoartext); ;}
1893 break;
1894
1895 case 72:
1896 #line 266 "guido.y"
1897 { vdebug("NUMBER", guidoartext); (yyval.num) = atol(guidoartext); ;}
1898 break;
1899
1900 case 73:
1901 #line 268 "guido.y"
1902 { (yyval.real) = atof(guidoartext); ;}
1903 break;
1904
1905 case 74:
1906 #line 270 "guido.y"
1907 { (yyval.num) = (yyvsp[(1) - (1)].num); ;}
1908 break;
1909
1910 case 75:
1911 #line 271 "guido.y"
1912 { (yyval.num) = (yyvsp[(1) - (1)].num); ;}
1913 break;
1914
1915 case 76:
1916 #line 272 "guido.y"
1917 { (yyval.num) = (yyvsp[(1) - (1)].num); ;}
1918 break;
1919
1920
1921 /* Line 1267 of yacc.c. */
1922 #line 1923 "guidoparse.c++"
1923 default: break;
1924 }
1925 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1926
1927 YYPOPSTACK (yylen);
1928 yylen = 0;
1929 YY_STACK_PRINT (yyss, yyssp);
1930
1931 *++yyvsp = yyval;
1932
1933
1934 /* Now `shift' the result of the reduction. Determine what state
1935 that goes to, based on the state we popped back to and the rule
1936 number reduced by. */
1937
1938 yyn = yyr1[yyn];
1939
1940 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1941 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1942 yystate = yytable[yystate];
1943 else
1944 yystate = yydefgoto[yyn - YYNTOKENS];
1945
1946 goto yynewstate;
1947
1948
1949 /*------------------------------------.
1950 | yyerrlab -- here on detecting error |
1951 `------------------------------------*/
1952 yyerrlab:
1953 /* If not already recovering from an error, report this error. */
1954 if (!yyerrstatus)
1955 {
1956 ++yynerrs;
1957 #if ! YYERROR_VERBOSE
1958 yyerror (YY_("syntax error"));
1959 #else
1960 {
1961 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1962 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1963 {
1964 YYSIZE_T yyalloc = 2 * yysize;
1965 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1966 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1967 if (yymsg != yymsgbuf)
1968 YYSTACK_FREE (yymsg);
1969 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1970 if (yymsg)
1971 yymsg_alloc = yyalloc;
1972 else
1973 {
1974 yymsg = yymsgbuf;
1975 yymsg_alloc = sizeof yymsgbuf;
1976 }
1977 }
1978
1979 if (0 < yysize && yysize <= yymsg_alloc)
1980 {
1981 (void) yysyntax_error (yymsg, yystate, yychar);
1982 yyerror (yymsg);
1983 }
1984 else
1985 {
1986 yyerror (YY_("syntax error"));
1987 if (yysize != 0)
1988 goto yyexhaustedlab;
1989 }
1990 }
1991 #endif
1992 }
1993
1994
1995
1996 if (yyerrstatus == 3)
1997 {
1998 /* If just tried and failed to reuse look-ahead token after an
1999 error, discard it. */
2000
2001 if (yychar <= YYEOF)
2002 {
2003 /* Return failure if at end of input. */
2004 if (yychar == YYEOF)
2005 YYABORT;
2006 }
2007 else
2008 {
2009 yydestruct ("Error: discarding",
2010 yytoken, &yylval);
2011 yychar = YYEMPTY;
2012 }
2013 }
2014
2015 /* Else will try to reuse look-ahead token after shifting the error
2016 token. */
2017 goto yyerrlab1;
2018
2019
2020 /*---------------------------------------------------.
2021 | yyerrorlab -- error raised explicitly by YYERROR. |
2022 `---------------------------------------------------*/
2023 yyerrorlab:
2024
2025 /* Pacify compilers like GCC when the user code never invokes
2026 YYERROR and the label yyerrorlab therefore never appears in user
2027 code. */
2028 if (/*CONSTCOND*/ 0)
2029 goto yyerrorlab;
2030
2031 /* Do not reclaim the symbols of the rule which action triggered
2032 this YYERROR. */
2033 YYPOPSTACK (yylen);
2034 yylen = 0;
2035 YY_STACK_PRINT (yyss, yyssp);
2036 yystate = *yyssp;
2037 goto yyerrlab1;
2038
2039
2040 /*-------------------------------------------------------------.
2041 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2042 `-------------------------------------------------------------*/
2043 yyerrlab1:
2044 yyerrstatus = 3; /* Each real token shifted decrements this. */
2045
2046 for (;;)
2047 {
2048 yyn = yypact[yystate];
2049 if (yyn != YYPACT_NINF)
2050 {
2051 yyn += YYTERROR;
2052 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2053 {
2054 yyn = yytable[yyn];
2055 if (0 < yyn)
2056 break;
2057 }
2058 }
2059
2060 /* Pop the current state because it cannot handle the error token. */
2061 if (yyssp == yyss)
2062 YYABORT;
2063
2064
2065 yydestruct ("Error: popping",
2066 yystos[yystate], yyvsp);
2067 YYPOPSTACK (1);
2068 yystate = *yyssp;
2069 YY_STACK_PRINT (yyss, yyssp);
2070 }
2071
2072 if (yyn == YYFINAL)
2073 YYACCEPT;
2074
2075 *++yyvsp = yylval;
2076
2077
2078 /* Shift the error token. */
2079 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2080
2081 yystate = yyn;
2082 goto yynewstate;
2083
2084
2085 /*-------------------------------------.
2086 | yyacceptlab -- YYACCEPT comes here. |
2087 `-------------------------------------*/
2088 yyacceptlab:
2089 yyresult = 0;
2090 goto yyreturn;
2091
2092 /*-----------------------------------.
2093 | yyabortlab -- YYABORT comes here. |
2094 `-----------------------------------*/
2095 yyabortlab:
2096 yyresult = 1;
2097 goto yyreturn;
2098
2099 #ifndef yyoverflow
2100 /*-------------------------------------------------.
2101 | yyexhaustedlab -- memory exhaustion comes here. |
2102 `-------------------------------------------------*/
2103 yyexhaustedlab:
2104 yyerror (YY_("memory exhausted"));
2105 yyresult = 2;
2106 /* Fall through. */
2107 #endif
2108
2109 yyreturn:
2110 if (yychar != YYEOF && yychar != YYEMPTY)
2111 yydestruct ("Cleanup: discarding lookahead",
2112 yytoken, &yylval);
2113 /* Do not reclaim the symbols of the rule which action triggered
2114 this YYABORT or YYACCEPT. */
2115 YYPOPSTACK (yylen);
2116 YY_STACK_PRINT (yyss, yyssp);
2117 while (yyssp != yyss)
2118 {
2119 yydestruct ("Cleanup: popping",
2120 yystos[*yyssp], yyvsp);
2121 YYPOPSTACK (1);
2122 }
2123 #ifndef yyoverflow
2124 if (yyss != yyssa)
2125 YYSTACK_FREE (yyss);
2126 #endif
2127 #if YYERROR_VERBOSE
2128 if (yymsg != yymsgbuf)
2129 YYSTACK_FREE (yymsg);
2130 #endif
2131 /* Make sure YYID is used. */
2132 return YYID (yyresult);
2133 }
2134
2135
2136 #line 274 "guido.y"
2137
2138
2139 } // namespace
2140
guidoarerror(const char * s)2141 int guidoarerror(const char*s) {
2142 YY_FLUSH_BUFFER;
2143 return gReader->error(s, guidoarlineno);
2144 }
2145
2146