chiark / gitweb /
Merge branch 'arkkra' into shiny
[mup] / mup / mup / ytab.c
1 /* A Bison parser, made from gram.y, by GNU bison 1.75.  */
2
3 /* Skeleton parser for Yacc-like parsing with Bison,
4    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
5
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.
10
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.
15
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.  */
20
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.  */
25
26 /* Written by Richard Stallman by simplifying the original so called
27    ``semantic'' parser.  */
28
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.  */
35
36 /* Identify Bison output.  */
37 #define YYBISON 1
38
39 /* Pure parsers.  */
40 #define YYPURE  0
41
42 /* Using locations.  */
43 #define YYLSP_NEEDED 0
44
45
46
47 /* Tokens.  */
48 #ifndef YYTOKENTYPE
49 # define YYTOKENTYPE
50    /* Put the tokens into the symbol table, so that GDB and other debuggers
51       know about them.  */
52    enum yytokentype {
53      T_SCORE = 258,
54      T_STAFF = 259,
55      T_VOICE = 260,
56      T_GRIDS = 261,
57      T_BLOCKHEAD = 262,
58      T_NUMBER = 263,
59      T_EQUAL = 264,
60      T_SEMICOLON = 265,
61      T_NEWLINE = 266,
62      T_COLON = 267,
63      T_COMMA = 268,
64      T_LBRACKET = 269,
65      T_RBRACKET = 270,
66      T_LBRACE = 271,
67      T_RBRACE = 272,
68      T_VARIABLE = 273,
69      T_DASH = 274,
70      T_PLUS = 275,
71      T_PLACE = 276,
72      T_ALL = 277,
73      T_WITH = 278,
74      T_CUE = 279,
75      T_GRACE = 280,
76      T_XNOTE = 281,
77      T_DIAM = 282,
78      T_DOT = 283,
79      T_MULTIWHOLE = 284,
80      T_LET_M = 285,
81      T_LET_R = 286,
82      T_LET_S = 287,
83      T_LET_U = 288,
84      T_PITCH = 289,
85      T_SHARP = 290,
86      T_AMPERSAND = 291,
87      T_LET_N = 292,
88      T_LET_X = 293,
89      T_DBLFLAT = 294,
90      T_LETTER = 295,
91      T_LYRICS = 296,
92      T_PAD = 297,
93      T_LPAREN = 298,
94      T_RPAREN = 299,
95      T_LVAR = 300,
96      T_MUSIC = 301,
97      T_HEADSHAPES = 302,
98      T_HS = 303,
99      T_SWINGUNIT = 304,
100      T_POSTSCRIPT = 305,
101      T_SCOREFEED = 306,
102      T_BARTYPE = 307,
103      T_HAT = 308,
104      T_TILDE = 309,
105      T_QUESTION = 310,
106      T_LINETYPE = 311,
107      T_LINE = 312,
108      T_TO = 313,
109      T_STAR = 314,
110      T_BULGE = 315,
111      T_CURVE = 316,
112      T_TIE = 317,
113      T_PRINTTYPE = 318,
114      T_NL = 319,
115      T_STAFFLINES = 320,
116      T_FFAMILY = 321,
117      T_PARAGRAPH = 322,
118      T_PARATYPE = 323,
119      T_NUMVAR = 324,
120      T_FNUMVAR = 325,
121      T_2FNUMVAR = 326,
122      T_RATNUMLISTVAR = 327,
123      T_RANGELISTVAR = 328,
124      T_TIMEUNIT = 329,
125      T_FONTVAR = 330,
126      T_STRVAR = 331,
127      T_CLEFVAR = 332,
128      T_VVAR = 333,
129      T_BARSTLISTVAR = 334,
130      T_SCORESEP = 335,
131      T_FONT = 336,
132      T_SLASH = 337,
133      T_KEY = 338,
134      T_TIME = 339,
135      T_CUT = 340,
136      T_COMMON = 341,
137      T_CLEF = 342,
138      T_MULTIREST = 343,
139      T_YESNOVAR = 344,
140      T_BM = 345,
141      T_ESBM = 346,
142      T_EBM = 347,
143      T_INVISBAR = 348,
144      T_OCTAVE = 349,
145      T_ROLL = 350,
146      T_VISVAR = 351,
147      T_WHEREUSED = 352,
148      T_UNSET = 353,
149      T_VCOMBINE = 354,
150      T_VCOMBVAL = 355,
151      T_SCOREPAD = 356,
152      T_WORD = 357,
153      T_UP = 358,
154      T_DOWN = 359,
155      T_ENDING = 360,
156      T_ENDENDING = 361,
157      T_FAMILY = 362,
158      T_ENDSTYLE = 363,
159      T_ENDTYPE = 364,
160      T_SLASHMARK = 365,
161      T_ALT = 366,
162      T_TITLE = 367,
163      T_REHEARSAL = 368,
164      T_NUM = 369,
165      T_LET = 370,
166      T_MNUM = 371,
167      T_TRANSPOSE = 372,
168      T_XPOS_INT = 373,
169      T_PEDAL = 374,
170      T_PHRASE = 375,
171      T_MUSSYM = 376,
172      T_L_ANGLE = 377,
173      T_MODIFIER = 378,
174      T_R_ANGLE = 379,
175      T_TIL = 380,
176      T_MIDI = 381,
177      T_PEDSTYLE = 382,
178      T_PEDSTAR = 383,
179      T_HIDECHANGES = 384,
180      T_SLUR = 385,
181      T_UNITS = 386,
182      T_CENTIMETERS = 387,
183      T_UNITTYPE = 388,
184      T_TAB = 389,
185      T_TICKS = 390,
186      T_NOWHERE_SLIDE = 391,
187      T_LEN = 392,
188      T_EXCLAM = 393,
189      T_OTHERTEXT = 394,
190      T_ORDER = 395,
191      T_GRIDPLACE = 396,
192      T_GRPLVALUE = 397,
193      T_DRUM = 398,
194      T_RPT = 399,
195      T_STRING = 400,
196      T_HO = 401,
197      T_REH_STYLE = 402,
198      T_REHTYPE = 403,
199      T_L_DBLANGLE = 404,
200      T_R_DBLANGLE = 405,
201      T_SLOPE = 406,
202      T_PSVAR = 407,
203      T_PAGESIZE = 408,
204      T_ORIENTATION = 409
205    };
206 #endif
207 #define T_SCORE 258
208 #define T_STAFF 259
209 #define T_VOICE 260
210 #define T_GRIDS 261
211 #define T_BLOCKHEAD 262
212 #define T_NUMBER 263
213 #define T_EQUAL 264
214 #define T_SEMICOLON 265
215 #define T_NEWLINE 266
216 #define T_COLON 267
217 #define T_COMMA 268
218 #define T_LBRACKET 269
219 #define T_RBRACKET 270
220 #define T_LBRACE 271
221 #define T_RBRACE 272
222 #define T_VARIABLE 273
223 #define T_DASH 274
224 #define T_PLUS 275
225 #define T_PLACE 276
226 #define T_ALL 277
227 #define T_WITH 278
228 #define T_CUE 279
229 #define T_GRACE 280
230 #define T_XNOTE 281
231 #define T_DIAM 282
232 #define T_DOT 283
233 #define T_MULTIWHOLE 284
234 #define T_LET_M 285
235 #define T_LET_R 286
236 #define T_LET_S 287
237 #define T_LET_U 288
238 #define T_PITCH 289
239 #define T_SHARP 290
240 #define T_AMPERSAND 291
241 #define T_LET_N 292
242 #define T_LET_X 293
243 #define T_DBLFLAT 294
244 #define T_LETTER 295
245 #define T_LYRICS 296
246 #define T_PAD 297
247 #define T_LPAREN 298
248 #define T_RPAREN 299
249 #define T_LVAR 300
250 #define T_MUSIC 301
251 #define T_HEADSHAPES 302
252 #define T_HS 303
253 #define T_SWINGUNIT 304
254 #define T_POSTSCRIPT 305
255 #define T_SCOREFEED 306
256 #define T_BARTYPE 307
257 #define T_HAT 308
258 #define T_TILDE 309
259 #define T_QUESTION 310
260 #define T_LINETYPE 311
261 #define T_LINE 312
262 #define T_TO 313
263 #define T_STAR 314
264 #define T_BULGE 315
265 #define T_CURVE 316
266 #define T_TIE 317
267 #define T_PRINTTYPE 318
268 #define T_NL 319
269 #define T_STAFFLINES 320
270 #define T_FFAMILY 321
271 #define T_PARAGRAPH 322
272 #define T_PARATYPE 323
273 #define T_NUMVAR 324
274 #define T_FNUMVAR 325
275 #define T_2FNUMVAR 326
276 #define T_RATNUMLISTVAR 327
277 #define T_RANGELISTVAR 328
278 #define T_TIMEUNIT 329
279 #define T_FONTVAR 330
280 #define T_STRVAR 331
281 #define T_CLEFVAR 332
282 #define T_VVAR 333
283 #define T_BARSTLISTVAR 334
284 #define T_SCORESEP 335
285 #define T_FONT 336
286 #define T_SLASH 337
287 #define T_KEY 338
288 #define T_TIME 339
289 #define T_CUT 340
290 #define T_COMMON 341
291 #define T_CLEF 342
292 #define T_MULTIREST 343
293 #define T_YESNOVAR 344
294 #define T_BM 345
295 #define T_ESBM 346
296 #define T_EBM 347
297 #define T_INVISBAR 348
298 #define T_OCTAVE 349
299 #define T_ROLL 350
300 #define T_VISVAR 351
301 #define T_WHEREUSED 352
302 #define T_UNSET 353
303 #define T_VCOMBINE 354
304 #define T_VCOMBVAL 355
305 #define T_SCOREPAD 356
306 #define T_WORD 357
307 #define T_UP 358
308 #define T_DOWN 359
309 #define T_ENDING 360
310 #define T_ENDENDING 361
311 #define T_FAMILY 362
312 #define T_ENDSTYLE 363
313 #define T_ENDTYPE 364
314 #define T_SLASHMARK 365
315 #define T_ALT 366
316 #define T_TITLE 367
317 #define T_REHEARSAL 368
318 #define T_NUM 369
319 #define T_LET 370
320 #define T_MNUM 371
321 #define T_TRANSPOSE 372
322 #define T_XPOS_INT 373
323 #define T_PEDAL 374
324 #define T_PHRASE 375
325 #define T_MUSSYM 376
326 #define T_L_ANGLE 377
327 #define T_MODIFIER 378
328 #define T_R_ANGLE 379
329 #define T_TIL 380
330 #define T_MIDI 381
331 #define T_PEDSTYLE 382
332 #define T_PEDSTAR 383
333 #define T_HIDECHANGES 384
334 #define T_SLUR 385
335 #define T_UNITS 386
336 #define T_CENTIMETERS 387
337 #define T_UNITTYPE 388
338 #define T_TAB 389
339 #define T_TICKS 390
340 #define T_NOWHERE_SLIDE 391
341 #define T_LEN 392
342 #define T_EXCLAM 393
343 #define T_OTHERTEXT 394
344 #define T_ORDER 395
345 #define T_GRIDPLACE 396
346 #define T_GRPLVALUE 397
347 #define T_DRUM 398
348 #define T_RPT 399
349 #define T_STRING 400
350 #define T_HO 401
351 #define T_REH_STYLE 402
352 #define T_REHTYPE 403
353 #define T_L_DBLANGLE 404
354 #define T_R_DBLANGLE 405
355 #define T_SLOPE 406
356 #define T_PSVAR 407
357 #define T_PAGESIZE 408
358 #define T_ORIENTATION 409
359
360
361
362
363 /* Copy the first part of user declarations.  */
364 #line 2 "gram.y"
365
366
367 /* Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
368  * 2005, 2006 by Arkkra Enterprises */
369 /* All rights reserved */
370
371 /* parser for music publication program. Uses lex to get tokens. */
372
373
374 #include "rational.h"
375 #include "globals.h"
376 #include "defines.h"
377 #include "structs.h"
378
379 #define YYDEBUG 1
380
381
382 /* how many items to allocate at a time for
383  * "with" list, and location lists, etc */
384 #define ITEMS   (4)
385
386
387 static struct MAINLL *Currstruct_p;     /* main list struct being filled in */
388 static struct BLOCKHEAD *Currblock_p;   /* current block, if non-zero */
389
390 static struct INPCOORD *Curr_loc_info_p; /* location info being collected */
391
392
393 static short Gotheader, Gotfooter;      /* boolean: to make sure each is defined only once */
394 static short Gothead2, Gotfoot2;
395 static short Getting_tup_dur;           /* YES if currently collection tuplet
396                                          * duration rather than GRPSYL dur */
397
398 static struct GRPSYL *Curr_grpsyl_p;    /* current GRPSYL struct being filled in */
399 static struct GRPSYL *Last_grpsyl_p;    /* previous GRPSYL struct filled in (contains
400                                          * defaults for the current one */
401 static struct TIMELIST *Extra_time_p;   /* If user enters times to be added
402                                          * together, like 2.+16 this points to
403                                          * a linked list of the extra times */
404 static struct TIMELIST *Curr_timelist_p;/* current additive time, used to know
405                                          * where to link items to the list */
406 static struct TIMELIST *Last_alloced_timelist_p; /* Most recently allocated
407                                          * list. Keeping track of this lets us
408                                          * avoid trying to free the list
409                                          * when Extra_time_p is pointing
410                                          * to a list from an SSV. */
411 static struct GRPSYL *Prev_grpsyl_p;    /* Like Last_grpsyl_p except in the
412                                          * case of additive times,
413                                          * in which case it points to the
414                                          * first group. This is needed in case
415                                          * the following group is to get its
416                                          * time value by defaulting to that
417                                          * of its previous group. */
418 static int Extra_basictime;             /* for saving basictime, when doing
419                                          * additive times */
420 static int Doing_timeunit = NO;         /* YES if gathering timeunit param */
421 static struct GRPSYL *Lyrics_p;         /* pointer to current list of lyrics */
422 static char **Curr_marklist;            /* current "with" list */
423 static struct PRINTDATA **Next_print_link_p_p;  /* points to where to attach next
424                                                  * print command that we get */
425 static int Item_count;                  /* items in current list */
426 static int Max_items;                   /* current amount of space in lists
427                                          * "with" list, curve locations, etc) */
428
429 static int Plus_minus;                  /* if 1 add, if -1 subtract offset */
430 static int Defining_multiple = NO;      /* if defining multiple voices at once */
431 static int Chord_at_a_time = NO;        /* YES for chord-at-a-time,
432                                          * NO for voice-at-a-time */
433 static short Endingloc;                 /* if current bar starts or ends an
434                                          * ending, etc (STARTITEM, ENDITEM, etc) */
435 static short Got_ending;                /* YES if got ending on this bar */
436
437 static int Til_bars;                    /* number of bars in "til" clause */
438 static int Dist;                        /* dist for a specific STUFF */
439 static int Dist_usage;                  /* meaning of Dist field */
440 static short User_meas_time;            /* YES if user specified a time for
441                                          * an 'm' item. Only valid on mr */
442 static int Order_place;                 /* PL_* for markorder in SSV */
443 static int Order_prio;                  /* value in markorder in SSV */
444 static int Gracebackup;                 /* how many grace notes to back up
445                                          * before starting a "stuff" */
446 static float Til_offset;                /* beat count in "til" clause */
447 static int Slurstyle;                   /* L_DOTTED, L_DASHED, or L_NORMAL */
448
449 static char *String1, *String2;         /* to temporarily keep track
450                                          * of labels and other temporary
451                                          * strings */
452 static char Tmpbuff[20];                /* temporary buffer for converting
453                                          * float numbers */
454 static char Stringbuff[100];            /* temporary string storage */
455 static int Titlefont, Titlesize;        /* font/size for title command */
456 static double Extra;                    /* extra vertical space for prints */
457 static short Good_till_canceled = NO;   /* if [] things should be continued
458                                          * until turned off */
459 static short Curr_paratype = J_JUSTPARA; /* current paragraph type */
460 static struct TIMEDSSV *Curr_tssv_p;    /* current mid-measure param change */
461 static char Timerep[MAXTSLEN];          /* Internal representation of time
462                                          * signature being collected */
463 static int Tsig_offset;                 /* Current place in Timerep while
464                                          * collecting a time signature */
465 static char *Alt_timesig_list;          /* If user specified alternating
466                                          * time signatures, this points to
467                                          * the beginning of the list, for
468                                          * when we need to wrap around */
469 static char *Next_alt_timesig;          /* If user specified alternating
470                                          * time signatures, this points to
471                                          * the one for the next measure */
472 static short Tsig_visibility;           /* If EACHMEAS, alternating
473                                          * time signatures will be done
474                                          * by explicitly printing
475                                          * the appropriate time signature at
476                                          * the beginning of every measure,
477                                          * rather than printing them all just
478                                          * once at the beginning of the run
479                                          * of measures that alternate. */
480
481 /* Row index values must match the PS_* value definitions in defines.h.
482  * Column [0] is height in portrait mode, and column [1] is height. */
483 double pagesztbl[7][2] = {
484         { 8.5, 11.0 },          /* PS_LETTER */
485         { 8.5, 14.0 },          /* PS_LEGAL */
486         { 8.5, 13.0 },          /* PS_FLSA */
487         { 5.5, 8.5 },           /* PS_HALFLETTER */
488         { 8.26, 11.69 },        /* PS_A4 */
489         { 5.84, 8.26 },         /* PS_A5 */
490         { 4.12, 5.84 }          /* PS_A6 */
491 };
492
493
494
495 /* static functions */
496 static char *stripquotes P((char *string));     /* rmv double quotes
497                                                  * from string */
498 static void chkdup_headfoot P((int flag, char *which));
499 static void end_prev_context P((void));
500 static void var_valid P((void));         /* check if okay to set location var */
501 static void proc_printcmd P((int justifytype, struct INPCOORD *inpc_p,
502                 char *str, int font, int size, int got_nl,
503                 int isPostScript, double extra));
504 static double extra_needed P((int font, int size, char *string));
505 static void keyword_notes P((char *str));
506 static void free_extra_time P((void));
507 static void tsig_item P((int item));
508
509
510
511
512 /* Enabling traces.  */
513 #ifndef YYDEBUG
514 # define YYDEBUG 0
515 #endif
516
517 /* Enabling verbose error messages.  */
518 #ifdef YYERROR_VERBOSE
519 # undef YYERROR_VERBOSE
520 # define YYERROR_VERBOSE 1
521 #else
522 # define YYERROR_VERBOSE 0
523 #endif
524
525 #ifndef YYSTYPE
526 #line 152 "gram.y"
527 typedef union {
528 int     intval;         /* for tokens/nonterminals that return int values */
529 char    *stringval;     /* for tokens/nonterminals that return strings */
530 float   floatval;       /* for nonterminals that return floats */
531 RATIONAL ratval;        /* for nonterminals that return rational numbers */
532 struct INPCOORD *inpcoord_p;    /* for nonterminals that return coord info */
533 } yystype;
534 /* Line 193 of /usr/share/bison/yacc.c.  */
535 #line 536 "y.tab.c"
536 # define YYSTYPE yystype
537 # define YYSTYPE_IS_TRIVIAL 1
538 #endif
539
540 #ifndef YYLTYPE
541 typedef struct yyltype
542 {
543   int first_line;
544   int first_column;
545   int last_line;
546   int last_column;
547 } yyltype;
548 # define YYLTYPE yyltype
549 # define YYLTYPE_IS_TRIVIAL 1
550 #endif
551
552 /* Copy the second part of user declarations.  */
553
554
555 /* Line 213 of /usr/share/bison/yacc.c.  */
556 #line 557 "y.tab.c"
557
558 #if ! defined (yyoverflow) || YYERROR_VERBOSE
559
560 /* The parser invokes alloca or malloc; define the necessary symbols.  */
561
562 # if YYSTACK_USE_ALLOCA
563 #  define YYSTACK_ALLOC alloca
564 # else
565 #  ifndef YYSTACK_USE_ALLOCA
566 #   if defined (alloca) || defined (_ALLOCA_H)
567 #    define YYSTACK_ALLOC alloca
568 #   else
569 #    ifdef __GNUC__
570 #     define YYSTACK_ALLOC __builtin_alloca
571 #    endif
572 #   endif
573 #  endif
574 # endif
575
576 # ifdef YYSTACK_ALLOC
577    /* Pacify GCC's `empty if-body' warning. */
578 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
579 # else
580 #  if defined (__STDC__) || defined (__cplusplus)
581 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
582 #   define YYSIZE_T size_t
583 #  endif
584 #  define YYSTACK_ALLOC malloc
585 #  define YYSTACK_FREE free
586 # endif
587 #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
588
589
590 #if (! defined (yyoverflow) \
591      && (! defined (__cplusplus) \
592          || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
593
594 /* A type that is properly aligned for any stack member.  */
595 union yyalloc
596 {
597   short yyss;
598   YYSTYPE yyvs;
599   };
600
601 /* The size of the maximum gap between one aligned stack and the next.  */
602 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
603
604 /* The size of an array large to enough to hold all stacks, each with
605    N elements.  */
606 # define YYSTACK_BYTES(N) \
607      ((N) * (sizeof (short) + sizeof (YYSTYPE))                         \
608       + YYSTACK_GAP_MAX)
609
610 /* Copy COUNT objects from FROM to TO.  The source and destination do
611    not overlap.  */
612 # ifndef YYCOPY
613 #  if 1 < __GNUC__
614 #   define YYCOPY(To, From, Count) \
615       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
616 #  else
617 #   define YYCOPY(To, From, Count)              \
618       do                                        \
619         {                                       \
620           register YYSIZE_T yyi;                \
621           for (yyi = 0; yyi < (Count); yyi++)   \
622             (To)[yyi] = (From)[yyi];    \
623         }                                       \
624       while (0)
625 #  endif
626 # endif
627
628 /* Relocate STACK from its old location to the new one.  The
629    local variables YYSIZE and YYSTACKSIZE give the old and new number of
630    elements in the stack, and YYPTR gives the new location of the
631    stack.  Advance YYPTR to a properly aligned location for the next
632    stack.  */
633 # define YYSTACK_RELOCATE(Stack)                                        \
634     do                                                                  \
635       {                                                                 \
636         YYSIZE_T yynewbytes;                                            \
637         YYCOPY (&yyptr->Stack, Stack, yysize);                          \
638         Stack = &yyptr->Stack;                                          \
639         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX;   \
640         yyptr += yynewbytes / sizeof (*yyptr);                          \
641       }                                                                 \
642     while (0)
643
644 #endif
645
646 #if defined (__STDC__) || defined (__cplusplus)
647    typedef signed char yysigned_char;
648 #else
649    typedef short yysigned_char;
650 #endif
651
652 /* YYFINAL -- State number of the termination state. */
653 #define YYFINAL  167
654 #define YYLAST   1149
655
656 /* YYNTOKENS -- Number of terminals. */
657 #define YYNTOKENS  155
658 /* YYNNTS -- Number of nonterminals. */
659 #define YYNNTS  273
660 /* YYNRULES -- Number of rules. */
661 #define YYNRULES  618
662 /* YYNRULES -- Number of states. */
663 #define YYNSTATES  914
664
665 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
666 #define YYUNDEFTOK  2
667 #define YYMAXUTOK   409
668
669 #define YYTRANSLATE(X) \
670   ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK)
671
672 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
673 static const unsigned char yytranslate[] =
674 {
675        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
676        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
677        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
678        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
679        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
680        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
681        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
682        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
683        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
684        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
685        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
686        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
687        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
688        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
689        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
690        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
691        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
692        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
693        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
694        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
695        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
696        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
697        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
698        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
699        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
700        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
701        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
702       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
703       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
704       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
705       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
706       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
707       65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
708       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
709       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
710       95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
711      105,   106,   107,   108,   109,   110,   111,   112,   113,   114,
712      115,   116,   117,   118,   119,   120,   121,   122,   123,   124,
713      125,   126,   127,   128,   129,   130,   131,   132,   133,   134,
714      135,   136,   137,   138,   139,   140,   141,   142,   143,   144,
715      145,   146,   147,   148,   149,   150,   151,   152,   153,   154
716 };
717
718 #if YYDEBUG
719 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
720    YYRHS.  */
721 static const unsigned short yyprhs[] =
722 {
723        0,     0,     3,     5,     8,    10,    12,    14,    16,    19,
724       22,    24,    28,    30,    33,    35,    37,    39,    41,    44,
725       47,    51,    56,    58,    59,    61,    63,    65,    69,    71,
726       73,    75,    77,    80,    82,    84,    89,    92,    96,   102,
727      107,   108,   113,   118,   123,   129,   134,   139,   143,   147,
728      151,   155,   159,   163,   167,   171,   175,   178,   179,   184,
729      188,   193,   198,   202,   206,   210,   216,   220,   224,   226,
730      228,   230,   231,   233,   235,   236,   237,   239,   241,   243,
731      247,   251,   252,   257,   262,   264,   265,   267,   268,   271,
732      274,   276,   278,   279,   280,   282,   286,   290,   291,   294,
733      295,   300,   301,   304,   306,   307,   308,   310,   314,   317,
734      319,   321,   325,   329,   331,   333,   335,   337,   339,   341,
735      343,   345,   347,   350,   352,   353,   357,   359,   360,   365,
736      367,   369,   373,   377,   379,   381,   385,   387,   388,   390,
737      391,   393,   397,   401,   404,   407,   409,   414,   416,   419,
738      424,   425,   427,   428,   430,   432,   434,   436,   437,   440,
739      443,   444,   448,   450,   453,   454,   456,   457,   460,   461,
740      463,   465,   467,   469,   471,   472,   474,   476,   479,   481,
741      483,   490,   493,   494,   496,   497,   499,   500,   504,   506,
742      509,   513,   521,   522,   524,   526,   528,   530,   532,   534,
743      536,   538,   540,   542,   544,   546,   548,   550,   552,   554,
744      556,   558,   560,   562,   564,   566,   568,   570,   572,   574,
745      576,   578,   580,   582,   586,   591,   595,   597,   598,   600,
746      602,   604,   607,   611,   613,   615,   617,   621,   623,   627,
747      629,   631,   634,   636,   638,   642,   645,   646,   649,   652,
748      657,   658,   661,   663,   666,   668,   674,   675,   677,   679,
749      682,   687,   689,   691,   693,   695,   699,   703,   707,   710,
750      712,   717,   724,   725,   729,   730,   735,   736,   737,   739,
751      741,   745,   749,   751,   753,   755,   757,   761,   764,   767,
752      770,   773,   775,   777,   780,   781,   783,   784,   786,   788,
753      792,   794,   798,   801,   804,   807,   808,   809,   811,   813,
754      817,   819,   821,   823,   825,   827,   829,   831,   833,   835,
755      837,   839,   841,   843,   846,   848,   850,   851,   853,   854,
756      858,   860,   862,   863,   866,   871,   872,   873,   875,   876,
757      879,   881,   885,   886,   888,   890,   892,   895,   898,   899,
758      901,   904,   907,   911,   914,   917,   919,   920,   923,   926,
759      927,   931,   933,   934,   938,   940,   942,   944,   947,   949,
760      951,   953,   955,   957,   959,   961,   965,   968,   974,   980,
761      984,   990,   998,  1003,  1008,  1015,  1020,  1026,  1031,  1032,
762     1034,  1036,  1037,  1039,  1040,  1042,  1044,  1046,  1048,  1050,
763     1052,  1054,  1056,  1058,  1060,  1063,  1065,  1068,  1073,  1075,
764     1076,  1078,  1080,  1082,  1085,  1088,  1091,  1093,  1095,  1097,
765     1099,  1101,  1103,  1105,  1107,  1109,  1118,  1119,  1121,  1123,
766     1125,  1127,  1129,  1130,  1132,  1133,  1136,  1141,  1145,  1147,
767     1148,  1150,  1152,  1154,  1158,  1161,  1162,  1165,  1168,  1169,
768     1170,  1176,  1178,  1180,  1182,  1186,  1189,  1190,  1193,  1194,
769     1197,  1198,  1200,  1202,  1205,  1208,  1212,  1214,  1220,  1221,
770     1223,  1225,  1228,  1231,  1237,  1240,  1242,  1244,  1245,  1249,
771     1251,  1252,  1255,  1259,  1260,  1262,  1263,  1265,  1267,  1269,
772     1273,  1274,  1278,  1279,  1282,  1284,  1287,  1289,  1291,  1295,
773     1299,  1303,  1311,  1314,  1316,  1317,  1319,  1321,  1323,  1325,
774     1332,  1333,  1336,  1338,  1342,  1344,  1346,  1348,  1350,  1351,
775     1354,  1357,  1359,  1361,  1363,  1366,  1369,  1371,  1375,  1377,
776     1379,  1381,  1382,  1385,  1388,  1390,  1392,  1396,  1399,  1400,
777     1402,  1404,  1406,  1414,  1415,  1416,  1418,  1419,  1424,  1432,
778     1433,  1436,  1439,  1441,  1445,  1447,  1451,  1454,  1456,  1460,
779     1467,  1474,  1477,  1479,  1481,  1483,  1485,  1488,  1490,  1492,
780     1494,  1496,  1498,  1499,  1503,  1504,  1506,  1507,  1510,  1513,
781     1517,  1518,  1520,  1522,  1525,  1531,  1534,  1535,  1540,  1541,
782     1546,  1547,  1549,  1551,  1552,  1555,  1558,  1559,  1562,  1563,
783     1566,  1572,  1573,  1575,  1577,  1580,  1582,  1585,  1586,  1589,
784     1593,  1596,  1600,  1604,  1608,  1610,  1612,  1613,  1615
785 };
786
787 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
788 static const short yyrhs[] =
789 {
790      156,     0,    -1,   157,    -1,   156,   157,    -1,   158,    -1,
791      170,    -1,   229,    -1,   235,    -1,   239,    11,    -1,   359,
792       11,    -1,   165,    -1,   353,   358,    11,    -1,    11,    -1,
793        1,    11,    -1,   159,    -1,   162,    -1,   164,    -1,   166,
794       -1,   163,   161,    -1,     3,   160,    -1,     4,   167,   160,
795       -1,     5,   167,   168,   160,    -1,   161,    -1,    -1,     7,
796       -1,    46,    -1,     6,    -1,   238,   238,    11,    -1,    47,
797       -1,   169,    -1,   169,    -1,     8,    -1,   172,   171,    -1,
798       10,    -1,    11,    -1,    69,     9,   296,   169,    -1,    69,
799        9,    -1,    70,     9,   382,    -1,    71,     9,   382,    13,
800      382,    -1,   152,     9,   220,   221,    -1,    -1,    99,     9,
801      173,   222,    -1,    42,     9,   296,   382,    -1,    78,     9,
802      169,   176,    -1,    72,     9,   177,   178,   184,    -1,    73,
803        9,   185,   186,    -1,    79,     9,   192,   193,    -1,   195,
804        9,   196,    -1,    83,     9,   209,    -1,    84,     9,   199,
805       -1,    65,     9,   210,    -1,    75,     9,    81,    -1,   107,
806        9,    66,    -1,    77,     9,    87,    -1,    89,     9,   215,
807       -1,    96,     9,   175,    -1,    98,   237,    -1,    -1,    74,
808        9,   174,   182,    -1,    49,     9,   183,    -1,    80,     9,
809      216,   217,    -1,   101,     9,   218,   219,    -1,   108,     9,
810      224,    -1,   147,     9,   148,    -1,   127,     9,   227,    -1,
811      117,     9,   225,   228,   169,    -1,   131,     9,   133,    -1,
812       76,     9,   238,    -1,    97,    -1,    40,    -1,    37,    -1,
813       -1,    34,    -1,    40,    -1,    -1,    -1,   179,    -1,   182,
814       -1,   180,    -1,   179,    13,   182,    -1,   179,    13,   180,
815       -1,    -1,    43,   181,   179,    44,    -1,   288,   293,   289,
816      292,    -1,    30,    -1,    -1,   182,    -1,    -1,    31,    32,
817       -1,    32,    31,    -1,    32,    -1,    31,    -1,    -1,    -1,
818      187,    -1,   186,    13,   187,    -1,   169,   188,   189,    -1,
819       -1,    19,   169,    -1,    -1,    43,   191,   190,    44,    -1,
820       -1,    13,   191,    -1,   238,    -1,    -1,    -1,   194,    -1,
821      193,    13,   194,    -1,   169,   188,    -1,   140,    -1,   197,
822       -1,   196,    13,   197,    -1,   196,    36,   197,    -1,   198,
823       -1,   121,    -1,    94,    -1,   139,    -1,   123,    -1,    41,
824       -1,   105,    -1,   113,    -1,   119,    -1,   200,   207,    -1,
825      202,    -1,    -1,   200,   201,   202,    -1,   204,    -1,    -1,
826      202,    20,   203,   204,    -1,    85,    -1,    86,    -1,   205,
827       82,   169,    -1,   205,    20,    29,    -1,    29,    -1,   206,
828       -1,   205,    20,   206,    -1,   169,    -1,    -1,   215,    -1,
829       -1,    37,    -1,   169,   313,   226,    -1,   310,   311,   226,
830       -1,   169,   208,    -1,   169,   143,    -1,   134,    -1,   134,
831       43,   211,    44,    -1,   212,    -1,   211,   212,    -1,   310,
832      213,   214,   312,    -1,    -1,   313,    -1,    -1,   135,    -1,
833       40,    -1,    37,    -1,   169,    -1,    -1,    13,   169,    -1,
834      296,   169,    -1,    -1,    13,   296,   169,    -1,   153,    -1,
835      310,   169,    -1,    -1,   154,    -1,    -1,   254,   223,    -1,
836       -1,   100,    -1,   109,    -1,     7,    -1,   103,    -1,   104,
837       -1,    -1,   118,    -1,    57,    -1,   111,   128,    -1,   128,
838       -1,   118,    -1,   112,   230,   233,   234,   358,    11,    -1,
839      232,   231,    -1,    -1,    81,    -1,    -1,    66,    -1,    -1,
840       43,   169,    44,    -1,   238,    -1,   238,   238,    -1,   238,
841      238,   238,    -1,   236,    67,   230,   233,   238,   358,    11,
842       -1,    -1,    68,    -1,    69,    -1,    89,    -1,    80,    -1,
843       65,    -1,    74,    -1,    49,    -1,    42,    -1,    79,    -1,
844       70,    -1,    71,    -1,   131,    -1,   108,    -1,   147,    -1,
845      127,    -1,    78,    -1,    99,    -1,   101,    -1,    73,    -1,
846      140,    -1,    83,    -1,    84,    -1,   117,    -1,    72,    -1,
847       96,    -1,    76,    -1,    75,    -1,   107,    -1,    77,    -1,
848      145,    -1,   238,    20,   145,    -1,   240,   241,   250,   256,
849       -1,    88,   169,   358,    -1,   330,    -1,    -1,   247,    -1,
850      242,    -1,   243,    -1,   242,   243,    -1,   244,   246,   245,
851       -1,    14,    -1,    15,    -1,   247,    -1,   246,    10,   247,
852       -1,   249,    -1,   247,   248,   249,    -1,    36,    -1,   251,
853       -1,   251,   254,    -1,    12,    -1,   252,    -1,   251,    13,
854      252,    -1,   167,   253,    -1,    -1,    19,   167,    -1,   168,
855      255,    -1,   168,    19,   168,   255,    -1,    -1,    13,   254,
856       -1,   257,    -1,   256,   257,    -1,   324,    -1,   258,   264,
857      297,   274,    10,    -1,    -1,   259,    -1,   260,    -1,   259,
858      260,    -1,   149,   261,   262,   150,    -1,     3,    -1,     4,
859       -1,     5,    -1,   263,    -1,   262,    10,   263,    -1,    77,
860        9,    87,    -1,    69,     9,   169,    -1,   265,   286,    -1,
861      268,    -1,    14,    19,    15,   268,    -1,    14,   268,   269,
862       15,   266,   267,    -1,    -1,    28,    28,    28,    -1,    -1,
863      267,    14,   269,    15,    -1,    -1,    -1,   270,    -1,   271,
864       -1,   269,    10,   271,    -1,    23,   277,   279,    -1,   322,
865       -1,   283,    -1,   294,    -1,   284,    -1,    69,   296,   169,
866       -1,   146,   272,    -1,    48,   238,    -1,   137,   382,    -1,
867      110,   169,    -1,    20,    -1,    19,    -1,   273,   382,    -1,
868       -1,   374,    -1,    -1,   275,    -1,   276,    -1,   275,    13,
869      276,    -1,   285,    -1,   151,   296,   382,    -1,   111,   169,
870       -1,   130,   278,    -1,    62,   278,    -1,    -1,    -1,   284,
871       -1,   280,    -1,   279,    13,   280,    -1,   281,    -1,   282,
872       -1,   238,    -1,    28,    -1,    19,    -1,   124,    -1,    53,
873       -1,    24,    -1,    25,    -1,    27,    -1,    26,    -1,   103,
874       -1,   104,    -1,    90,   287,    -1,    91,    -1,    92,    -1,
875       -1,   182,    -1,    -1,    23,     4,    21,    -1,    29,    -1,
876      169,    -1,    -1,   289,   290,    -1,   374,   291,   288,   293,
877       -1,    -1,    -1,    30,    -1,    -1,   293,    28,    -1,   295,
878       -1,    42,   296,   382,    -1,    -1,    19,    -1,   303,    -1,
879      298,    -1,   299,   302,    -1,   300,   301,    -1,    -1,    55,
880       -1,    54,   278,    -1,     9,   323,    -1,    53,   310,   312,
881       -1,    53,    82,    -1,    48,   238,    -1,   317,    -1,    -1,
882      302,   301,    -1,   306,   304,    -1,    -1,   305,   306,    21,
883       -1,    23,    -1,    -1,   306,   307,   302,    -1,   308,    -1,
884       31,    -1,    32,    -1,    33,    32,    -1,   144,    -1,    52,
885       -1,    25,    -1,   109,    -1,    68,    -1,    73,    -1,    87,
886       -1,    43,   308,    44,    -1,   310,   309,    -1,   310,    43,
887      313,    44,   312,    -1,   310,    43,   314,    44,   309,    -1,
888      310,    43,   310,    -1,   310,   313,   214,   312,   309,    -1,
889      310,   313,   214,    43,   314,    44,   309,    -1,   310,   313,
890       43,   310,    -1,   310,   135,   312,   309,    -1,   310,   135,
891       43,   314,    44,   309,    -1,   310,   314,   311,   309,    -1,
892      310,   314,    43,   313,    44,    -1,   310,   314,    43,   310,
893       -1,    -1,   238,    -1,    34,    -1,    -1,   313,    -1,    -1,
894      314,    -1,    35,    -1,    36,    -1,    37,    -1,    38,    -1,
895       39,    -1,   169,    -1,   315,    -1,   316,    -1,    19,    -1,
896      315,    19,    -1,    20,    -1,   316,    20,    -1,   318,   319,
897      124,   278,    -1,   122,    -1,    -1,   136,    -1,   320,    -1,
898      321,    -1,   320,   321,    -1,   310,   312,    -1,     9,   323,
899       -1,    40,    -1,    34,    -1,    30,    -1,    31,    -1,    32,
900       -1,    33,    -1,    37,    -1,    38,    -1,    45,    -1,   326,
901      256,   327,   328,   169,   325,   329,    10,    -1,    -1,    37,
902       -1,   114,    -1,    40,    -1,    16,    -1,    17,    -1,    -1,
903       21,    -1,    -1,    13,   182,    -1,    41,   331,    12,   344,
904       -1,   332,   334,   337,    -1,   333,    -1,    -1,    21,    -1,
905      335,    -1,    22,    -1,   334,    13,   335,    -1,   169,   336,
906       -1,    -1,    19,   169,    -1,    36,   169,    -1,    -1,    -1,
907      337,    10,    21,   338,   334,    -1,   340,    -1,    34,    -1,
908      341,    -1,   340,    13,   341,    -1,   169,   342,    -1,    -1,
909       19,   169,    -1,    -1,   345,   351,    -1,    -1,   346,    -1,
910      347,    -1,   346,   347,    -1,   348,    10,    -1,   343,   286,
911      350,    -1,   349,    -1,   326,   346,   327,   169,   329,    -1,
912       -1,    32,    -1,   352,    -1,   351,   352,    -1,   238,    10,
913       -1,    14,   339,    15,   238,    10,    -1,   360,   362,    -1,
914      386,    -1,   390,    -1,    -1,    51,   354,   355,    -1,   424,
915       -1,    -1,   355,   356,    -1,    70,   357,   382,    -1,    -1,
916        9,    -1,    -1,    10,    -1,   397,    -1,   418,    -1,   388,
917      361,    52,    -1,    -1,    43,    52,    44,    -1,    -1,   362,
918      363,    -1,   295,    -1,     9,   323,    -1,   364,    -1,   129,
919       -1,   116,     9,   169,    -1,   115,     9,   238,    -1,   114,
920        9,   169,    -1,   113,   365,   232,   231,   403,   366,   405,
921       -1,   105,   238,    -1,   106,    -1,    -1,   238,    -1,   116,
922       -1,   114,    -1,   115,    -1,    43,   368,   369,    13,   376,
923       44,    -1,    -1,   370,   372,    -1,   375,    -1,   385,    28,
924      371,    -1,   373,    -1,    40,    -1,    38,    -1,    34,    -1,
925       -1,   372,   373,    -1,   374,   375,    -1,    20,    -1,    19,
926       -1,   382,    -1,    84,   382,    -1,   377,   379,    -1,   381,
927       -1,   385,    28,   378,    -1,    37,    -1,    32,    -1,    40,
928       -1,    -1,   379,   380,    -1,   374,   381,    -1,   382,    -1,
929      169,    -1,   169,    28,   383,    -1,    28,   384,    -1,    -1,
930      384,    -1,     8,    -1,   323,    -1,   388,    57,   387,   367,
931       58,   367,   389,    -1,    -1,    -1,    56,    -1,    -1,    23,
932      230,   233,   238,    -1,   388,    61,   391,   396,    58,   396,
933      392,    -1,    -1,    58,   393,    -1,    60,   394,    -1,   396,
934       -1,   393,    58,   396,    -1,   395,    -1,   394,    13,   395,
935       -1,   296,   382,    -1,   367,    -1,   398,    12,   408,    -1,
936      401,   403,   404,   333,   334,   405,    -1,   388,   120,   403,
937      333,   334,   405,    -1,   399,   400,    -1,   126,    -1,   247,
938       -1,    22,    -1,   402,    -1,   232,    81,    -1,   122,    -1,
939      124,    -1,   119,    -1,   121,    -1,    94,    -1,    -1,    43,
940      169,    44,    -1,    -1,   123,    -1,    -1,    69,   406,    -1,
941      169,   407,    -1,    19,   169,   407,    -1,    -1,   138,    -1,
942      409,    -1,   408,   409,    -1,   410,   412,   413,   414,    10,
943       -1,   382,   411,    -1,    -1,    43,    19,   169,    44,    -1,
944       -1,    14,   374,   382,    15,    -1,    -1,    59,    -1,   238,
945       -1,    -1,   125,   415,    -1,   382,   416,    -1,    -1,    30,
946      417,    -1,    -1,    20,   382,    -1,    95,   419,   420,    12,
947      423,    -1,    -1,   103,    -1,   104,    -1,   421,   422,    -1,
948      167,    -1,   167,   168,    -1,    -1,    58,   167,    -1,    58,
949      167,   168,    -1,   382,    10,    -1,   423,   382,    10,    -1,
950      426,   427,   238,    -1,   425,   427,   238,    -1,    50,    -1,
951       63,    -1,    -1,    64,    -1,   367,    -1
952 };
953
954 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
955 static const unsigned short yyrline[] =
956 {
957        0,   245,   245,   247,   251,   253,   256,   259,   262,   275,
958      278,   281,   284,   290,   302,   308,   314,   318,   322,   338,
959      343,   351,   361,   367,   374,   533,   538,   545,   560,   569,
960      572,   578,   583,   586,   588,   592,   610,   625,   631,   637,
961      647,   646,   650,   657,   663,   673,   679,   685,   693,   696,
962      702,   707,   713,   719,   734,   740,   743,   773,   772,   785,
963      795,   800,   805,   815,   826,   836,   867,   873,   879,   889,
964      903,   912,   918,   931,   944,   950,   953,   957,   963,   966,
965      972,   977,   976,   982,  1037,  1054,  1060,  1064,  1070,  1076,
966     1082,  1088,  1094,  1101,  1104,  1107,  1111,  1119,  1125,  1137,
967     1143,  1150,  1156,  1163,  1166,  1172,  1175,  1178,  1182,  1190,
968     1209,  1217,  1225,  1233,  1244,  1250,  1256,  1262,  1281,  1287,
969     1293,  1299,  1305,  1327,  1331,  1330,  1336,  1342,  1341,  1347,
970     1353,  1359,  1382,  1394,  1402,  1405,  1409,  1426,  1432,  1438,
971     1443,  1452,  1462,  1501,  1507,  1513,  1523,  1530,  1536,  1543,
972     1551,  1556,  1564,  1570,  1582,  1591,  1597,  1609,  1627,  1638,
973     1651,  1669,  1681,  1684,  1709,  1715,  1722,  1728,  1736,  1742,
974     1749,  1755,  1765,  1770,  1776,  1781,  1798,  1803,  1809,  1815,
975     1818,  1822,  1841,  1846,  1852,  1857,  1862,  1867,  1873,  1881,
976     1901,  1920,  2010,  2018,  2025,  2028,  2031,  2034,  2037,  2040,
977     2043,  2046,  2049,  2052,  2055,  2058,  2061,  2064,  2067,  2070,
978     2073,  2076,  2079,  2082,  2085,  2088,  2091,  2094,  2097,  2100,
979     2103,  2106,  2110,  2120,  2134,  2152,  2187,  2193,  2198,  2203,
980     2210,  2212,  2216,  2219,  2224,  2229,  2234,  2241,  2247,  2251,
981     2258,  2265,  2274,  2282,  2284,  2291,  2299,  2305,  2315,  2328,
982     2350,  2353,  2359,  2361,  2365,  2368,  2412,  2415,  2419,  2422,
983     2426,  2435,  2441,  2447,  2454,  2457,  2461,  2471,  2488,  2491,
984     2506,  2512,  2517,  2522,  2528,  2532,  2540,  2547,  2554,  2558,
985     2560,  2564,  2570,  2573,  2576,  2579,  2595,  2611,  2622,  2649,
986     2660,  2683,  2689,  2695,  2709,  2715,  2721,  2723,  2727,  2730,
987     2734,  2737,  2750,  2771,  2786,  2799,  2809,  2814,  2821,  2823,
988     2827,  2841,  2849,  2853,  2860,  2867,  2874,  2881,  2891,  2904,
989     2914,  2925,  2931,  2937,  2965,  2971,  3001,  3010,  3021,  3026,
990     3043,  3069,  3108,  3114,  3118,  3132,  3154,  3159,  3172,  3177,
991     3184,  3204,  3209,  3215,  3222,  3234,  3239,  3243,  3247,  3266,
992     3282,  3300,  3332,  3350,  3363,  3382,  3386,  3388,  3392,  3398,
993     3404,  3429,  3435,  3443,  3450,  3452,  3459,  3471,  3483,  3498,
994     3518,  3525,  3537,  3548,  3560,  3572,  3578,  3588,  3597,  3606,
995     3622,  3628,  3637,  3653,  3659,  3665,  3674,  3680,  3694,  3699,
996     3717,  3723,  3729,  3734,  3740,  3745,  3751,  3757,  3764,  3771,
997     3777,  3783,  3795,  3806,  3811,  3818,  3823,  3830,  3837,  3844,
998     3853,  3860,  3864,  3867,  3871,  3883,  3893,  3898,  3906,  3913,
999     3920,  3927,  3934,  3941,  3948,  3954,  3960,  3966,  3973,  3980,
1000     3992,  3998,  4003,  4008,  4017,  4024,  4030,  4034,  4039,  4043,
1001     4050,  4056,  4058,  4068,  4072,  4079,  4086,  4096,  4103,  4107,
1002     4106,  4110,  4115,  4126,  4131,  4136,  4144,  4150,  4156,  4166,
1003     4177,  4183,  4187,  4189,  4193,  4196,  4217,  4222,  4228,  4234,
1004     4241,  4243,  4247,  4258,  4264,  4356,  4359,  4364,  4362,  4436,
1005     4440,  4443,  4447,  4474,  4476,  4480,  4482,  4486,  4489,  4493,
1006     4545,  4551,  4561,  4563,  4567,  4575,  4586,  4618,  4629,  4636,
1007     4642,  4647,  4657,  4665,  4677,  4687,  4694,  4703,  4712,  4721,
1008     4726,  4736,  4742,  4744,  4756,  4761,  4769,  4775,  4785,  4787,
1009     4790,  4793,  4798,  4804,  4809,  4824,  4827,  4829,  4842,  4847,
1010     4853,  4863,  4865,  4869,  4873,  4880,  4885,  4891,  4897,  4903,
1011     4907,  4912,  4915,  4936,  4943,  4948,  4952,  4958,  4964,  4975,
1012     4988,  4991,  4995,  4997,  5001,  5004,  5008,  5025,  5062,  5069,
1013     5076,  5090,  5099,  5106,  5109,  5116,  5125,  5149,  5161,  5167,
1014     5173,  5179,  5186,  5192,  5198,  5203,  5209,  5215,  5228,  5234,
1015     5247,  5252,  5258,  5261,  5265,  5272,  5280,  5285,  5291,  5296,
1016     5302,  5307,  5319,  5325,  5329,  5334,  5352,  5357,  5363,  5368,
1017     5374,  5377,  5382,  5389,  5396,  5400,  5407,  5414,  5416,  5423,
1018     5430,  5436,  5442,  5452,  5463,  5469,  5472,  5479,  5486
1019 };
1020 #endif
1021
1022 #if YYDEBUG || YYERROR_VERBOSE
1023 /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1024    First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1025 static const char *const yytname[] =
1026 {
1027   "$end", "error", "$undefined", "T_SCORE", "T_STAFF", "T_VOICE", "T_GRIDS", 
1028   "T_BLOCKHEAD", "T_NUMBER", "T_EQUAL", "T_SEMICOLON", "T_NEWLINE", 
1029   "T_COLON", "T_COMMA", "T_LBRACKET", "T_RBRACKET", "T_LBRACE", 
1030   "T_RBRACE", "T_VARIABLE", "T_DASH", "T_PLUS", "T_PLACE", "T_ALL", 
1031   "T_WITH", "T_CUE", "T_GRACE", "T_XNOTE", "T_DIAM", "T_DOT", 
1032   "T_MULTIWHOLE", "T_LET_M", "T_LET_R", "T_LET_S", "T_LET_U", "T_PITCH", 
1033   "T_SHARP", "T_AMPERSAND", "T_LET_N", "T_LET_X", "T_DBLFLAT", "T_LETTER", 
1034   "T_LYRICS", "T_PAD", "T_LPAREN", "T_RPAREN", "T_LVAR", "T_MUSIC", 
1035   "T_HEADSHAPES", "T_HS", "T_SWINGUNIT", "T_POSTSCRIPT", "T_SCOREFEED", 
1036   "T_BARTYPE", "T_HAT", "T_TILDE", "T_QUESTION", "T_LINETYPE", "T_LINE", 
1037   "T_TO", "T_STAR", "T_BULGE", "T_CURVE", "T_TIE", "T_PRINTTYPE", "T_NL", 
1038   "T_STAFFLINES", "T_FFAMILY", "T_PARAGRAPH", "T_PARATYPE", "T_NUMVAR", 
1039   "T_FNUMVAR", "T_2FNUMVAR", "T_RATNUMLISTVAR", "T_RANGELISTVAR", 
1040   "T_TIMEUNIT", "T_FONTVAR", "T_STRVAR", "T_CLEFVAR", "T_VVAR", 
1041   "T_BARSTLISTVAR", "T_SCORESEP", "T_FONT", "T_SLASH", "T_KEY", "T_TIME", 
1042   "T_CUT", "T_COMMON", "T_CLEF", "T_MULTIREST", "T_YESNOVAR", "T_BM", 
1043   "T_ESBM", "T_EBM", "T_INVISBAR", "T_OCTAVE", "T_ROLL", "T_VISVAR", 
1044   "T_WHEREUSED", "T_UNSET", "T_VCOMBINE", "T_VCOMBVAL", "T_SCOREPAD", 
1045   "T_WORD", "T_UP", "T_DOWN", "T_ENDING", "T_ENDENDING", "T_FAMILY", 
1046   "T_ENDSTYLE", "T_ENDTYPE", "T_SLASHMARK", "T_ALT", "T_TITLE", 
1047   "T_REHEARSAL", "T_NUM", "T_LET", "T_MNUM", "T_TRANSPOSE", "T_XPOS_INT", 
1048   "T_PEDAL", "T_PHRASE", "T_MUSSYM", "T_L_ANGLE", "T_MODIFIER", 
1049   "T_R_ANGLE", "T_TIL", "T_MIDI", "T_PEDSTYLE", "T_PEDSTAR", 
1050   "T_HIDECHANGES", "T_SLUR", "T_UNITS", "T_CENTIMETERS", "T_UNITTYPE", 
1051   "T_TAB", "T_TICKS", "T_NOWHERE_SLIDE", "T_LEN", "T_EXCLAM", 
1052   "T_OTHERTEXT", "T_ORDER", "T_GRIDPLACE", "T_GRPLVALUE", "T_DRUM", 
1053   "T_RPT", "T_STRING", "T_HO", "T_REH_STYLE", "T_REHTYPE", "T_L_DBLANGLE", 
1054   "T_R_DBLANGLE", "T_SLOPE", "T_PSVAR", "T_PAGESIZE", "T_ORIENTATION", 
1055   "$accept", "song", "item", "context", "ssv_context", "alloc_ssv", 
1056   "new_context", "blockhead_context", "music_context", "grid_context", 
1057   "stringpair", "headshape_context", "staffnum", "voicenum", "num", 
1058   "assignment", "terminator", "assign", "@1", "@2", "visval", 
1059   "vschemetype", "allocbeamlist", "ratnumlist", "nonempty_ratnumlist", 
1060   "subbeam", "@3", "time_item", "swing_time", "opt_rs", "alloc_rangelist", 
1061   "rangelist", "rangeitem", "rangetail", "grplabel", "optlabel2", 
1062   "glabel", "alloc_barstlist", "barstlist", "barst_item", "mark_order", 
1063   "orderlist", "orderitem", "marktype", "timesig", "tsiglist", "@4", 
1064   "meas_tsig", "@5", "fraction", "numerator", "numerator_value", 
1065   "opt_ts_visibility", "opt_n", "keyspec", "stafflinedef", 
1066   "tab_string_list", "tab_item", "opt_str_acc", "opt_ticks", "flagval", 
1067   "minscsep", "maxscsep", "minscpad", "maxscpad", "pagesize", 
1068   "orientation", "vcombine_value", "opt_vcombine_qualifier", "end_type", 
1069   "updown", "majmin", "pedstyle", "transpose_interval", "title", "tfont", 
1070   "title_font", "font_family", "title_size", "titleA", "paragraph", 
1071   "opt_paratype", "paramname", "string", "noteinfo", "init_staff", 
1072   "sv_spec", "sv_map_list", "sv_map_entry", "map_start", "map_finish", 
1073   "sv_map_item_list", "voice_id", "sv_and", "sv_item", "notecolon", 
1074   "grp_stafflist", "grp_staff_item", "grp_staff_range", "voice_spec", 
1075   "voice_tail", "groupinfo", "groupdata", "mid_meas_param", 
1076   "mid_meas_list", "mid_meas_item", "mm_context", "mm_params", 
1077   "mm_param_item", "grp_attributes", "styleinfo", "gtc", 
1078   "extra_styleinfo", "alloc_grpsyl", "marklist", "marklistA", "markitem", 
1079   "hor_offset", "opt_plus_or_minus", "other_attr", "attr_list", 
1080   "attr_item", "alloc_marklist", "opt_dir", "marks", "mark", "mark_item", 
1081   "shorthand_mark", "notetype", "dir", "beammark", "time_val", 
1082   "crossbeam", "basic_time_val", "opt_more_time", "more_time_item", 
1083   "alloc_timelist", "opt_m", "dots", "padding", "padspec", "opt_minus", 
1084   "group", "special_group", "extra_attr", "spec_grp_alloc", "extra_item", 
1085   "note_opts", "notelist", "opt_other_staff", "css_with", "some_notes", 
1086   "notedata", "notedata1", "opt_bend", "pitch", "opt_accidental", 
1087   "opt_octave", "acc_symbol", "octave", "minuslist", "pluslist", 
1088   "slur_item", "start_slur", "slurlist", "fullslurlist", "slurnote", 
1089   "grp_locsave", "loc_variable", "ntuplet", "printtup", "start_tuplet", 
1090   "rbrace", "opt_side", "opt_time", "lyricinfo", "lyric_id", 
1091   "lyr_opt_place", "opt_place", "staff_list", "staff_item", "staff_range", 
1092   "more_lyric_ids", "@6", "verse_spec", "verselist", "verse_item", 
1093   "verse_range", "alloc_lyr_grpsyl", "lyricdata", "lyr_tlist", 
1094   "lyrics_timelist", "lyr_time_item", "lyr_tm", "lyrtuplet", "opt_space", 
1095   "lyr_verse", "verse_string", "os_directive", "@7", "opt_temp_margin", 
1096   "temp_margin", "opt_equals", "opt_semi", "directive", "barinfo", 
1097   "precbartype", "bar_items", "bar_opt", "ending_info", "chk_dup_reh", 
1098   "rehearsal_mark", "location", "alloc_loc", "xcoord", "xterm", 
1099   "east_or_west", "xoffsetlist", "xoffset", "plus_or_minus", "xoffsetval", 
1100   "ycoord", "yterm", "north_or_south", "yoffsetlist", "yoffset", 
1101   "yoffsetval", "floatnum", "opt_decimal_part", "numstr", "variable", 
1102   "line", "line_alloc", "linetype", "opt_line_str", "curve", 
1103   "curve_alloc", "curve_tail", "loc_list", "bulgelist", "bulge_value", 
1104   "curve_loc", "stuff_info", "stuff_header", "midi", "midi_staff", 
1105   "stuff_id", "stuff_type", "opt_size", "opt_modifier", "opt_dist", 
1106   "stuff_dist", "opt_exclam", "stufflist", "stuff_item", "beat_offset", 
1107   "gracebackup", "steps_offset", "opt_string", "til_clause", "til_val", 
1108   "til_suffix", "til_offset", "roll_cmd", "opt_roll_dir", "roll_extent", 
1109   "roll_start", "roll_end", "roll_offsetlist", "printcmd", "postscript", 
1110   "printtype", "opt_loc", 0
1111 };
1112 #endif
1113
1114 # ifdef YYPRINT
1115 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
1116    token YYLEX-NUM.  */
1117 static const unsigned short yytoknum[] =
1118 {
1119        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
1120      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
1121      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
1122      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
1123      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
1124      305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
1125      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
1126      325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
1127      335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
1128      345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
1129      355,   356,   357,   358,   359,   360,   361,   362,   363,   364,
1130      365,   366,   367,   368,   369,   370,   371,   372,   373,   374,
1131      375,   376,   377,   378,   379,   380,   381,   382,   383,   384,
1132      385,   386,   387,   388,   389,   390,   391,   392,   393,   394,
1133      395,   396,   397,   398,   399,   400,   401,   402,   403,   404,
1134      405,   406,   407,   408,   409
1135 };
1136 # endif
1137
1138 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
1139 static const unsigned short yyr1[] =
1140 {
1141        0,   155,   156,   156,   157,   157,   157,   157,   157,   157,
1142      157,   157,   157,   157,   158,   158,   158,   158,   158,   159,
1143      159,   159,   160,   161,   162,   163,   164,   165,   166,   167,
1144      168,   169,   170,   171,   171,   172,   172,   172,   172,   172,
1145      173,   172,   172,   172,   172,   172,   172,   172,   172,   172,
1146      172,   172,   172,   172,   172,   172,   172,   174,   172,   172,
1147      172,   172,   172,   172,   172,   172,   172,   172,   175,   175,
1148      175,   176,   176,   176,   177,   178,   178,   179,   179,   179,
1149      179,   181,   180,   182,   182,   183,   183,   184,   184,   184,
1150      184,   184,   185,   186,   186,   186,   187,   188,   188,   189,
1151      189,   190,   190,   191,   192,   193,   193,   193,   194,   195,
1152      196,   196,   196,   197,   198,   198,   198,   198,   198,   198,
1153      198,   198,   199,   200,   201,   200,   202,   203,   202,   204,
1154      204,   204,   204,   204,   205,   205,   206,   207,   207,   208,
1155      208,   209,   209,   210,   210,   210,   210,   211,   211,   212,
1156      213,   213,   214,   214,   215,   215,   216,   217,   217,   218,
1157      219,   219,   220,   220,   221,   221,   222,   222,   223,   223,
1158      224,   224,   225,   225,   226,   226,   227,   227,   227,   228,
1159      229,   230,   231,   231,   232,   232,   233,   233,   234,   234,
1160      234,   235,   236,   236,   237,   237,   237,   237,   237,   237,
1161      237,   237,   237,   237,   237,   237,   237,   237,   237,   237,
1162      237,   237,   237,   237,   237,   237,   237,   237,   237,   237,
1163      237,   237,   238,   238,   239,   239,   239,   240,   241,   241,
1164      242,   242,   243,   244,   245,   246,   246,   247,   247,   248,
1165      249,   249,   250,   251,   251,   252,   253,   253,   254,   254,
1166      255,   255,   256,   256,   257,   257,   258,   258,   259,   259,
1167      260,   261,   261,   261,   262,   262,   263,   263,   264,   265,
1168      265,   265,   266,   266,   267,   267,   268,   269,   269,   270,
1169      270,   271,   271,   271,   271,   271,   271,   271,   271,   271,
1170      271,   272,   272,   272,   273,   273,   274,   274,   275,   275,
1171      276,   276,   276,   276,   276,   277,   278,   278,   279,   279,
1172      280,   281,   281,   282,   282,   282,   282,   283,   283,   283,
1173      283,   284,   284,   285,   285,   285,   286,   286,   287,   287,
1174      288,   288,   289,   289,   290,   291,   292,   292,   293,   293,
1175      294,   295,   296,   296,   297,   297,   298,   299,   300,   301,
1176      301,   301,   301,   301,   301,   301,   302,   302,   303,   304,
1177      304,   305,   306,   306,   307,   307,   307,   307,   307,   307,
1178      307,   307,   307,   307,   307,   307,   308,   308,   308,   308,
1179      308,   308,   308,   308,   308,   308,   308,   308,   309,   309,
1180      310,   311,   311,   312,   312,   313,   313,   313,   313,   313,
1181      314,   314,   314,   315,   315,   316,   316,   317,   318,   319,
1182      319,   319,   320,   320,   321,   322,   323,   323,   323,   323,
1183      323,   323,   323,   323,   323,   324,   325,   325,   325,   325,
1184      326,   327,   328,   328,   329,   329,   330,   331,   332,   333,
1185      333,   334,   334,   334,   335,   336,   336,   336,   337,   338,
1186      337,   339,   339,   340,   340,   341,   342,   342,   343,   344,
1187      345,   345,   346,   346,   347,   348,   348,   349,   350,   350,
1188      351,   351,   352,   352,   353,   353,   353,   354,   353,   353,
1189      355,   355,   356,   357,   357,   358,   358,   359,   359,   360,
1190      361,   361,   362,   362,   363,   363,   363,   363,   363,   363,
1191      363,   363,   364,   364,   365,   366,   366,   366,   366,   367,
1192      368,   369,   370,   370,   370,   371,   371,   371,   372,   372,
1193      373,   374,   374,   375,   375,   376,   377,   377,   378,   378,
1194      378,   379,   379,   380,   381,   382,   382,   382,   383,   383,
1195      384,   385,   386,   387,   388,   388,   389,   389,   390,   391,
1196      392,   392,   393,   393,   394,   394,   395,   396,   397,   398,
1197      398,   398,   399,   400,   400,   401,   402,   402,   402,   402,
1198      402,   402,   403,   403,   404,   404,   405,   405,   406,   406,
1199      407,   407,   408,   408,   409,   410,   411,   411,   412,   412,
1200      413,   413,   413,   414,   414,   415,   416,   416,   417,   417,
1201      418,   419,   419,   419,   420,   421,   421,   422,   422,   422,
1202      423,   423,   424,   424,   425,   426,   427,   427,   427
1203 };
1204
1205 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
1206 static const unsigned char yyr2[] =
1207 {
1208        0,     2,     1,     2,     1,     1,     1,     1,     2,     2,
1209        1,     3,     1,     2,     1,     1,     1,     1,     2,     2,
1210        3,     4,     1,     0,     1,     1,     1,     3,     1,     1,
1211        1,     1,     2,     1,     1,     4,     2,     3,     5,     4,
1212        0,     4,     4,     4,     5,     4,     4,     3,     3,     3,
1213        3,     3,     3,     3,     3,     3,     2,     0,     4,     3,
1214        4,     4,     3,     3,     3,     5,     3,     3,     1,     1,
1215        1,     0,     1,     1,     0,     0,     1,     1,     1,     3,
1216        3,     0,     4,     4,     1,     0,     1,     0,     2,     2,
1217        1,     1,     0,     0,     1,     3,     3,     0,     2,     0,
1218        4,     0,     2,     1,     0,     0,     1,     3,     2,     1,
1219        1,     3,     3,     1,     1,     1,     1,     1,     1,     1,
1220        1,     1,     2,     1,     0,     3,     1,     0,     4,     1,
1221        1,     3,     3,     1,     1,     3,     1,     0,     1,     0,
1222        1,     3,     3,     2,     2,     1,     4,     1,     2,     4,
1223        0,     1,     0,     1,     1,     1,     1,     0,     2,     2,
1224        0,     3,     1,     2,     0,     1,     0,     2,     0,     1,
1225        1,     1,     1,     1,     0,     1,     1,     2,     1,     1,
1226        6,     2,     0,     1,     0,     1,     0,     3,     1,     2,
1227        3,     7,     0,     1,     1,     1,     1,     1,     1,     1,
1228        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1229        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1230        1,     1,     1,     3,     4,     3,     1,     0,     1,     1,
1231        1,     2,     3,     1,     1,     1,     3,     1,     3,     1,
1232        1,     2,     1,     1,     3,     2,     0,     2,     2,     4,
1233        0,     2,     1,     2,     1,     5,     0,     1,     1,     2,
1234        4,     1,     1,     1,     1,     3,     3,     3,     2,     1,
1235        4,     6,     0,     3,     0,     4,     0,     0,     1,     1,
1236        3,     3,     1,     1,     1,     1,     3,     2,     2,     2,
1237        2,     1,     1,     2,     0,     1,     0,     1,     1,     3,
1238        1,     3,     2,     2,     2,     0,     0,     1,     1,     3,
1239        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
1240        1,     1,     1,     2,     1,     1,     0,     1,     0,     3,
1241        1,     1,     0,     2,     4,     0,     0,     1,     0,     2,
1242        1,     3,     0,     1,     1,     1,     2,     2,     0,     1,
1243        2,     2,     3,     2,     2,     1,     0,     2,     2,     0,
1244        3,     1,     0,     3,     1,     1,     1,     2,     1,     1,
1245        1,     1,     1,     1,     1,     3,     2,     5,     5,     3,
1246        5,     7,     4,     4,     6,     4,     5,     4,     0,     1,
1247        1,     0,     1,     0,     1,     1,     1,     1,     1,     1,
1248        1,     1,     1,     1,     2,     1,     2,     4,     1,     0,
1249        1,     1,     1,     2,     2,     2,     1,     1,     1,     1,
1250        1,     1,     1,     1,     1,     8,     0,     1,     1,     1,
1251        1,     1,     0,     1,     0,     2,     4,     3,     1,     0,
1252        1,     1,     1,     3,     2,     0,     2,     2,     0,     0,
1253        5,     1,     1,     1,     3,     2,     0,     2,     0,     2,
1254        0,     1,     1,     2,     2,     3,     1,     5,     0,     1,
1255        1,     2,     2,     5,     2,     1,     1,     0,     3,     1,
1256        0,     2,     3,     0,     1,     0,     1,     1,     1,     3,
1257        0,     3,     0,     2,     1,     2,     1,     1,     3,     3,
1258        3,     7,     2,     1,     0,     1,     1,     1,     1,     6,
1259        0,     2,     1,     3,     1,     1,     1,     1,     0,     2,
1260        2,     1,     1,     1,     2,     2,     1,     3,     1,     1,
1261        1,     0,     2,     2,     1,     1,     3,     2,     0,     1,
1262        1,     1,     7,     0,     0,     1,     0,     4,     7,     0,
1263        2,     2,     1,     3,     1,     3,     2,     1,     3,     6,
1264        6,     2,     1,     1,     1,     1,     2,     1,     1,     1,
1265        1,     1,     0,     3,     0,     1,     0,     2,     2,     3,
1266        0,     1,     1,     2,     5,     2,     0,     4,     0,     4,
1267        0,     1,     1,     0,     2,     2,     0,     2,     0,     2,
1268        5,     0,     1,     1,     2,     1,     2,     0,     2,     3,
1269        2,     3,     3,     3,     1,     1,     0,     1,     1
1270 };
1271
1272 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
1273    STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
1274    means the default is an error.  */
1275 static const unsigned short yydefact[] =
1276 {
1277        0,     0,    23,     0,     0,    26,    24,    12,   439,     0,
1278       25,    28,     0,   614,   477,   545,   615,     0,   185,   193,
1279        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1280        0,     0,     0,     0,     0,     0,   571,   601,     0,     0,
1281        0,     0,     0,     0,   184,     0,   569,   570,   567,   568,
1282      562,     0,     0,   109,   222,     0,     0,     0,     2,     4,
1283       14,    15,    23,    16,    10,    17,     5,     0,     0,     6,
1284        0,     7,     0,     0,     0,     0,   226,   485,     0,   492,
1285      475,   490,   476,   487,     0,     0,   572,   565,   488,   479,
1286      616,   616,    13,    19,    22,    31,    23,    29,     0,   440,
1287        0,     0,   438,   342,    85,   480,     0,    36,     0,     0,
1288       74,    92,    57,     0,     0,     0,     0,   104,     0,     0,
1289        0,   485,     0,   602,   603,     0,     0,   200,   199,   197,
1290      194,   202,   203,   216,   211,   198,   219,   218,   221,   208,
1291      201,   196,   213,   214,   195,   217,   209,   210,   220,   205,
1292      215,   207,   204,   212,   206,    56,    40,   342,     0,     0,
1293      186,   182,     0,     0,     0,     0,     0,     1,     3,    18,
1294       33,    34,    32,     0,   566,   184,     0,     0,     8,   233,
1295      246,     0,   229,   230,     0,   228,   237,   240,   243,   486,
1296        0,     9,   474,     0,   543,   549,   572,     0,     0,   564,
1297      563,   561,     0,   574,   510,   617,   618,     0,     0,    20,
1298       23,    30,   458,   442,   445,   448,   441,   343,     0,   330,
1299       84,   331,    86,    59,   338,   478,   145,   139,    50,     0,
1300        0,   535,    37,     0,    75,    93,     0,    51,    67,    53,
1301       71,   105,   156,   157,   390,     0,    48,   391,   133,   129,
1302      130,   136,    49,   124,   123,   126,     0,   134,   225,   155,
1303      154,    54,   605,     0,   607,    70,    69,    68,    55,   166,
1304      160,     0,    52,   171,   170,    62,     0,     0,   183,   181,
1305      172,   173,     0,   176,     0,   178,    64,    66,    63,   162,
1306      164,     0,   118,   115,   119,   120,   121,   114,   117,   116,
1307       47,   110,   113,   186,   223,    27,     0,   245,   242,   256,
1308      231,     0,   235,   239,     0,     0,   250,   241,    11,     0,
1309      342,     0,   503,   504,     0,     0,     0,   497,   494,   493,
1310      496,     0,     0,     0,   439,   489,   586,   558,   582,   588,
1311        0,   575,   439,     0,   613,   612,    21,   430,   458,   326,
1312      436,     0,   458,   462,     0,   466,     0,     0,   444,     0,
1313      437,    42,   332,   483,   481,     0,   140,   144,   143,    35,
1314      540,   537,   538,     0,    81,    87,    76,    78,    77,    97,
1315       45,    94,    58,    72,    73,    43,    97,    46,   106,     0,
1316       60,   395,   396,   397,   398,   399,   174,   174,   392,     0,
1317      122,   138,   127,     0,     0,   606,     0,     0,   604,    41,
1318      168,   342,    61,   159,     0,   485,   188,   179,     0,   177,
1319      165,    39,   163,     0,     0,     0,   247,     0,   256,   252,
1320      276,   257,   258,   254,   256,     0,   234,   232,   238,   244,
1321        0,     0,   248,   418,   419,   420,   421,   417,   422,   423,
1322      416,   424,   495,     0,   502,   184,     0,     0,     0,   491,
1323        0,   557,     0,     0,     0,   585,   583,     0,   590,   573,
1324        0,   522,   521,     0,   541,     0,   518,   514,     0,   512,
1325      523,     0,   458,   327,   468,     0,     0,   459,   470,   463,
1326      464,   446,   447,   443,     0,   339,   336,   484,     0,     0,
1327      147,   150,   536,   539,    38,     0,    91,    90,    44,     0,
1328        0,    99,     0,   108,     0,   158,   175,   141,   142,   125,
1329        0,   132,   135,   131,     0,   600,   608,   169,   167,     0,
1330      187,     0,   189,    65,   111,   112,   485,   261,   262,   263,
1331        0,   253,   276,   362,   326,   269,   259,   256,   236,   251,
1332      250,   341,   182,   500,   499,   498,     0,     0,   576,     0,
1333        0,   591,   592,   593,   576,   524,     0,   511,   520,     0,
1334      431,     0,   469,   465,   452,   456,     0,   451,   453,   472,
1335      471,   449,   337,   333,    83,   335,   482,   146,   148,   152,
1336      151,     0,    88,    89,    80,    79,    98,     0,    96,    95,
1337      107,   128,   610,     0,   609,   161,   180,   190,     0,     0,
1338        0,     0,   264,     0,   277,   296,   345,   356,     0,   344,
1339      359,   268,   432,   249,   572,   546,     0,     0,   560,     0,
1340        0,     0,     0,   559,     0,   531,   526,   534,     0,   519,
1341      517,   516,   515,   513,   434,     0,   455,     0,     0,     0,
1342        0,   153,   393,    82,   101,   103,   611,   191,     0,     0,
1343        0,   260,   276,     0,   305,   317,   318,   320,   319,     0,
1344      342,   321,   322,     0,     0,   294,     0,   278,   279,   283,
1345      285,   284,   340,   282,   306,   328,   324,   325,     0,   306,
1346      342,     0,   297,   298,   300,   346,     0,     0,     0,   306,
1347      349,   408,   347,   355,   409,   361,   370,   365,   366,     0,
1348        0,   369,   372,   373,   374,   371,   368,   358,   362,   356,
1349      364,   388,   433,     0,     0,   184,   542,     0,   342,   548,
1350        0,   580,   577,   587,   589,   596,   594,   584,   509,   525,
1351        0,     0,   467,   457,     0,   454,   450,   338,   403,   405,
1352      400,   149,   394,   401,   402,     0,     0,   267,   266,   265,
1353      270,   415,     0,   288,     0,   290,   289,   292,   291,   287,
1354        0,   295,     0,   272,   304,   307,     0,   323,   302,   303,
1355        0,   255,     0,   357,   351,   354,   353,   393,   350,   410,
1356      393,     0,   411,   412,   367,     0,     0,   363,     0,   393,
1357      389,   376,   152,   391,   426,   507,   508,   506,   505,   576,
1358      186,   550,   552,     0,   551,   554,   580,   581,   578,   598,
1359      595,     0,   532,   529,   528,   530,   527,   435,   473,   334,
1360      404,   406,   102,   100,   314,   313,   316,   315,   312,   281,
1361      308,   310,   311,   286,   293,   280,     0,   274,     0,   301,
1362      299,   352,   414,   306,   413,   375,   360,   379,     0,     0,
1363        0,   388,     0,   393,     0,   388,   427,   429,   428,   434,
1364      501,     0,     0,   556,   342,   579,     0,   597,   533,     0,
1365        0,   271,   329,   407,   393,   388,     0,   383,   382,     0,
1366      388,   387,     0,   385,     0,   547,   553,   555,   599,   309,
1367      273,   277,   377,   378,   388,     0,   380,   386,   425,     0,
1368      384,   388,   275,   381
1369 };
1370
1371 /* YYDEFGOTO[NTERM-NUM]. */
1372 static const short yydefgoto[] =
1373 {
1374       -1,    57,    58,    59,    60,    93,    94,    61,    62,    63,
1375       64,    65,   180,   316,   231,    66,   172,    67,   269,   236,
1376      268,   385,   234,   375,   376,   377,   505,   378,   223,   508,
1377      235,   380,   381,   511,   598,   756,   654,   241,   387,   388,
1378       68,   300,   301,   302,   252,   253,   399,   254,   520,   255,
1379      256,   257,   400,   368,   246,   228,   499,   500,   589,   652,
1380      261,   243,   390,   270,   412,   290,   421,   409,   528,   275,
1381      282,   517,   286,   418,    69,   160,   279,   161,   277,   415,
1382       71,    72,   155,   800,    74,    75,   181,   182,   183,   184,
1383      437,   311,   185,   314,   186,   309,   187,   188,   307,   317,
1384      442,   428,   429,   430,   431,   432,   540,   611,   612,   543,
1385      544,   847,   881,   545,   676,   677,   678,   769,   770,   691,
1386      692,   693,   762,   774,   839,   840,   841,   842,   679,   775,
1387      694,   484,   777,   224,   496,   583,   650,   584,   362,   681,
1388      682,   813,   615,   616,   617,   618,   783,   695,   619,   717,
1389      718,   620,   719,   720,   801,   721,   397,   751,   398,   752,
1390      753,   754,   703,   704,   791,   792,   793,   683,   474,   433,
1391      869,   348,   571,   723,   742,    76,   100,   101,   102,   215,
1392      216,   358,   360,   649,   576,   577,   578,   646,   349,   350,
1393      351,   352,   353,   354,   355,   573,   487,   488,    77,   105,
1394      225,   364,   498,   190,    78,    79,   197,   192,   329,   330,
1395      455,   809,   461,   343,   475,   476,   643,   567,   477,   478,
1396      479,   634,   635,   826,   739,   822,   636,   336,   502,   371,
1397      481,    80,   332,    81,   726,    82,   333,   729,   811,   814,
1398      815,   462,    83,    84,    85,   201,    86,    87,   203,   342,
1399      628,   732,   818,   337,   338,   339,   465,   468,   563,   632,
1400      736,   820,   877,    88,   125,   263,   264,   408,   525,    89,
1401       90,    91,   207
1402 };
1403
1404 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1405    STATE-NUM.  */
1406 #define YYPACT_NINF -693
1407 static const short yypact[] =
1408 {
1409      997,    49,  -693,   101,   101,  -693,  -693,  -693,    43,   116,
1410     -693,  -693,   143,  -693,  -693,  -693,  -693,   158,  -693,  -693,
1411      199,   215,   254,   284,   296,   315,   372,   401,   410,   419,
1412      421,   422,   424,   426,   101,   427,  -693,   244,   431,   732,
1413      432,   433,   435,   436,   236,   438,  -693,  -693,  -693,  -693,
1414     -693,   439,   440,  -693,  -693,   441,   443,   847,  -693,  -693,
1415     -693,  -693,  -693,  -693,  -693,  -693,  -693,   378,   445,  -693,
1416      123,  -693,   324,    26,   384,   309,  -693,   446,   447,  -693,
1417     -693,    69,  -693,  -693,   451,   245,   414,  -693,  -693,  -693,
1418       32,    32,  -693,  -693,  -693,  -693,  -693,  -693,   101,  -693,
1419      454,   278,  -693,   449,   210,  -693,    41,   190,   182,   182,
1420     -693,  -693,  -693,   381,   314,   383,   101,  -693,   101,    70,
1421       51,   446,   225,  -693,  -693,   101,    57,  -693,  -693,  -693,
1422     -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,
1423     -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,
1424     -693,  -693,  -693,  -693,  -693,  -693,  -693,   449,   405,    44,
1425      430,   393,   295,    94,   344,   333,    29,  -693,  -693,  -693,
1426     -693,  -693,  -693,   371,  -693,   236,   335,    68,  -693,  -693,
1427      464,   489,   490,  -693,   101,   467,  -693,   353,  -693,  -693,
1428      494,  -693,   114,   456,  -693,  -693,   414,   462,   182,  -693,
1429      467,  -693,   101,   390,  -693,  -693,  -693,   314,   314,  -693,
1430     -693,  -693,    28,  -693,   124,   502,  -693,  -693,   182,  -693,
1431     -693,  -693,  -693,  -693,  -693,   448,   473,    15,  -693,   101,
1432      511,   493,  -693,   507,   207,   101,   210,  -693,   504,  -693,
1433      293,   101,  -693,   512,  -693,   492,  -693,   492,  -693,  -693,
1434     -693,  -693,  -693,   332,   515,  -693,    50,  -693,  -693,  -693,
1435     -693,  -693,   101,   520,   479,  -693,  -693,  -693,  -693,   101,
1436      525,   101,  -693,  -693,  -693,  -693,   101,   314,  -693,  -693,
1437     -693,  -693,   425,  -693,   411,  -693,  -693,  -693,  -693,  -693,
1438      395,   101,  -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,
1439       56,  -693,  -693,   430,  -693,  -693,   101,  -693,  -693,    21,
1440     -693,   358,   467,  -693,   101,   101,   338,  -693,  -693,   575,
1441      449,   314,  -693,  -693,   544,   549,   551,  -693,  -693,  -693,
1442     -693,   519,   521,   521,    43,  -693,   522,   182,  -693,   552,
1443      526,  -693,    43,   514,   504,   504,  -693,  -693,   553,   210,
1444     -693,    24,    31,  -693,   561,  -693,   101,   101,  -693,   101,
1445      562,  -693,   545,   565,  -693,   550,  -693,  -693,  -693,  -693,
1446     -693,  -693,   511,   182,  -693,   377,   572,  -693,  -693,   567,
1447      581,  -693,  -693,  -693,  -693,  -693,   567,   587,  -693,   101,
1448     -693,  -693,  -693,  -693,  -693,  -693,   484,   484,  -693,    51,
1449     -693,  -693,  -693,    85,   101,  -693,   182,   101,  -693,  -693,
1450      503,   449,  -693,  -693,   566,   446,    26,  -693,   101,  -693,
1451     -693,  -693,  -693,   371,   371,   314,  -693,   374,    25,  -693,
1452      597,   465,  -693,  -693,    21,   101,  -693,  -693,  -693,  -693,
1453      101,   101,  -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,
1454     -693,  -693,  -693,   182,   504,   236,   101,   314,   101,  -693,
1455      558,  -693,   560,   278,   598,  -693,  -693,   386,    -5,  -693,
1456      278,  -693,  -693,   182,  -693,   606,  -693,  -693,   103,  -693,
1457     -693,   594,   397,  -693,   591,    73,   234,    24,  -693,  -693,
1458     -693,  -693,  -693,  -693,   604,  -693,   289,  -693,   182,   253,
1459     -693,   492,  -693,  -693,  -693,   207,   595,   599,  -693,   207,
1460      101,   583,   101,  -693,   101,  -693,  -693,  -693,  -693,   515,
1461       51,  -693,  -693,  -693,   618,   182,   101,  -693,  -693,   101,
1462     -693,   620,    26,  -693,  -693,  -693,   286,  -693,  -693,  -693,
1463       33,  -693,   610,    80,   210,  -693,  -693,    17,   467,  -693,
1464      619,  -693,   393,  -693,   504,  -693,   521,   521,    52,   101,
1465      182,  -693,   504,   508,    52,  -693,   559,   386,  -693,   336,
1466     -693,   101,  -693,  -693,  -693,   615,   621,   622,  -693,  -693,
1467     -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,   505,
1468     -693,    61,  -693,  -693,  -693,  -693,  -693,   314,  -693,  -693,
1469     -693,  -693,  -693,   627,  -693,  -693,  -693,   504,   628,   629,
1470      632,    22,  -693,   633,   138,   273,  -693,  -693,    91,  -693,
1471      307,  -693,   623,  -693,   414,   630,   276,   198,  -693,   608,
1472      635,   182,   644,  -693,   612,  -693,  -693,  -693,   631,  -693,
1473     -693,  -693,  -693,  -693,   645,   101,  -693,   314,   101,   278,
1474      100,  -693,   227,  -693,   647,   504,  -693,  -693,   101,   570,
1475       33,  -693,  -693,   575,  -693,  -693,  -693,  -693,  -693,   314,
1476      449,  -693,  -693,   101,   182,   398,   375,  -693,  -693,  -693,
1477     -693,  -693,  -693,  -693,   318,   638,  -693,  -693,   101,   318,
1478      449,   652,   650,  -693,  -693,    91,   575,   314,    37,   318,
1479     -693,  -693,  -693,  -693,    19,  -693,  -693,  -693,  -693,   634,
1480      550,  -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,
1481     -693,    48,  -693,   101,   162,   236,  -693,   521,   449,  -693,
1482      101,   527,  -693,  -693,  -693,   637,  -693,  -693,  -693,   386,
1483      312,   210,  -693,  -693,   308,  -693,   502,  -693,  -693,  -693,
1484     -693,  -693,  -693,   649,   651,   314,   625,  -693,  -693,  -693,
1485     -693,  -693,    71,   504,   101,  -693,  -693,   193,   195,  -693,
1486      182,  -693,   138,   636,  -693,  -693,   668,  -693,  -693,  -693,
1487      182,  -693,   273,  -693,  -693,   504,  -693,   227,  -693,  -693,
1488      227,   554,   550,  -693,  -693,   639,   258,    91,   542,   237,
1489      504,  -693,    14,   450,    36,  -693,  -693,  -693,   504,   605,
1490      430,   617,  -693,   182,   664,  -693,   527,  -693,  -693,   660,
1491     -693,   182,  -693,  -693,  -693,  -693,  -693,  -693,  -693,   545,
1492     -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,   504,   671,
1493     -693,  -693,  -693,  -693,  -693,  -693,   653,  -693,   665,  -693,
1494     -693,  -693,  -693,   318,  -693,  -693,  -693,  -693,   643,   646,
1495      227,   314,   550,   252,   461,   314,  -693,  -693,  -693,   645,
1496     -693,   314,   521,  -693,   449,  -693,   182,  -693,  -693,    71,
1497      663,   674,  -693,  -693,   227,   314,   648,  -693,  -693,   227,
1498      314,  -693,   654,  -693,   683,   504,  -693,  -693,  -693,  -693,
1499     -693,   138,  -693,  -693,   314,   655,  -693,  -693,  -693,   382,
1500     -693,   314,  -693,  -693
1501 };
1502
1503 /* YYPGOTO[NTERM-NUM].  */
1504 static const short yypgoto[] =
1505 {
1506     -693,  -693,   640,  -693,  -693,   -53,   641,  -693,  -693,  -693,
1507     -693,  -693,    16,   -83,    -3,  -693,  -693,  -693,  -693,  -693,
1508     -693,  -693,  -693,  -693,   189,   186,  -693,   -98,  -693,  -693,
1509     -693,  -693,   184,   316,  -693,  -693,   -55,  -693,  -693,   191,
1510     -693,  -693,     3,  -693,  -693,  -693,  -693,   305,  -693,   187,
1511     -693,   303,  -693,  -693,  -693,  -693,  -693,   209,  -693,   -93,
1512      457,  -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,
1513     -693,   317,  -693,  -693,  -693,  -168,   159,     9,  -298,  -693,
1514     -693,  -693,  -693,     4,  -693,  -693,  -693,  -693,   530,  -693,
1515     -693,  -693,   -64,  -693,   399,  -693,  -693,   400,  -693,  -244,
1516      166,   283,  -370,  -693,  -693,   288,  -693,  -693,    63,  -693,
1517     -693,  -693,  -693,  -503,  -180,  -693,   -48,  -693,  -693,  -693,
1518     -693,   -57,  -693,  -659,  -693,  -153,  -693,  -693,  -693,  -587,
1519     -693,   185,  -693,    81,  -693,  -693,  -693,  -693,   -15,  -693,
1520      541,   -95,  -693,  -693,  -693,  -693,   117,    18,  -693,  -693,
1521     -693,    23,  -693,    30,  -591,  -116,   -69,  -599,  -243,  -692,
1522     -693,  -693,  -693,  -693,  -693,  -693,   -56,  -693,  -303,  -693,
1523     -693,  -286,   192,  -693,  -127,  -693,  -693,  -693,   -13,  -435,
1524      385,  -693,  -693,  -693,  -693,  -693,    95,  -693,  -693,  -693,
1525     -693,   402,  -304,  -693,  -693,  -693,  -693,   260,  -693,  -693,
1526     -693,  -693,  -693,  -111,  -693,  -693,  -693,  -693,  -693,  -693,
1527     -693,  -693,   -77,  -693,  -693,  -693,  -693,  -693,   178,  -441,
1528      271,  -693,  -693,  -693,  -693,  -693,   -70,   -91,  -693,   380,
1529      188,  -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,
1530     -121,  -535,  -693,  -693,  -693,  -693,  -693,  -693,  -185,  -693,
1531     -540,  -693,   -61,  -693,   420,  -693,  -693,  -693,  -693,  -693,
1532     -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,  -693,
1533     -693,  -693,   667
1534 };
1535
1536 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
1537    positive, shift that token.  If negative, reduce the rule which
1538    number is the opposite.  If zero, do what YYDEFACT says.
1539    If YYTABLE_NINF, parse error.  */
1540 #define YYTABLE_NINF -545
1541 static const short yytable[] =
1542 {
1543       97,    97,   396,   247,    73,   425,   222,   303,   218,    70,
1544      258,   334,   229,   206,   206,   210,   452,   232,   233,    96,
1545       98,   200,   626,   434,   633,   410,   560,   680,   558,   803,
1546      779,   121,   660,   347,   570,   564,  -224,   347,   485,   614,
1547      788,   347,  -460,   209,   347,  -461,   176,   347,   489,    95,
1548      291,   273,   366,   244,   561,   585,    95,   862,   541,    95,
1549       92,    73,   271,   244,    99,   359,    70,   748,   749,   423,
1550      403,   244,    97,   866,   509,   204,   867,   177,    95,   305,
1551      248,    95,    97,   391,   392,   393,   394,   395,   176,  -348,
1552      834,   798,   424,    95,   265,   211,   205,   266,   214,   835,
1553      696,   221,   609,   227,   244,   653,   859,   574,    95,    95,
1554      610,    95,   193,   240,   521,   242,   245,   251,   238,   786,
1555      312,   627,    97,   319,   836,   103,   194,   361,  -348,   219,
1556      195,   230,   404,  -348,  -348,  -348,   249,   250,   382,   697,
1557       54,   262,   434,   356,   698,   699,   700,   663,   434,   651,
1558      868,   283,   104,   274,   267,   789,   320,   346,   367,   760,
1559      357,   664,   665,   666,   667,   668,   427,   106,   886,    54,
1560      427,    54,   661,  -460,   427,   226,  -461,   541,   489,   405,
1561      320,    97,   289,   799,   211,   680,   669,   473,   851,   196,
1562       95,   852,   812,    54,   883,   837,   549,   905,  -342,   340,
1563      861,  -522,  -348,  -521,   174,   284,    95,   670,   107,   217,
1564      230,   344,   345,   701,   746,    95,    54,   730,    95,   321,
1565      322,  -522,   285,  -521,   108,   453,   369,   323,   324,   325,
1566      326,   221,   379,   221,   771,    95,   219,   220,   386,   219,
1567      220,   671,   672,   327,   579,    95,   748,   749,   673,   501,
1568      374,   483,   480,    95,   176,   460,   748,   749,   590,   211,
1569       95,   434,   259,   109,   890,   260,   211,   199,   413,   870,
1570      887,   748,   749,   414,   893,   674,   805,   806,   807,   856,
1571      860,   416,   504,   706,   675,   902,    95,   244,   422,   707,
1572      708,   709,   244,   110,   903,   889,   189,   587,   821,   906,
1573      213,   710,    18,    97,   531,   111,   176,    54,   471,   472,
1574      711,    97,    97,   910,   680,   524,   529,    95,   828,   582,
1575      913,   463,   426,   179,   112,   454,   712,   383,   176,   470,
1576      705,   713,   706,   384,   727,   684,   728,   896,   707,   708,
1577      709,   244,  -137,  -137,   823,   714,   221,   123,   124,   824,
1578      710,   440,   825,   491,   492,   486,   214,   441,   550,   711,
1579      761,    95,   551,   685,   686,   687,   315,   715,   435,   259,
1580      640,   548,   260,   436,   641,   712,   642,   537,   538,   539,
1581      713,   113,   565,   501,   688,   772,   515,   480,   170,   171,
1582      773,   175,   772,   784,   714,   178,   251,   912,   280,   281,
1583      251,   523,   716,   689,    97,   471,   472,   586,   506,   507,
1584      114,   595,   292,   347,   570,   533,   715,   767,   768,   115,
1585      532,   671,   672,   526,   690,   608,   534,   535,   116,   536,
1586      117,   118,    97,   119,   603,   120,   122,   211,   211,   724,
1587      126,   156,   157,   604,   158,   159,   483,   162,   163,   164,
1588      165,   716,   166,   553,   173,   555,   189,   202,   191,    54,
1589      214,   554,   237,   198,   552,   293,   212,   214,   217,   630,
1590      239,   272,   562,   276,   278,   637,   294,   287,   802,   625,
1591      304,   288,   575,   306,   295,   391,   392,   393,   394,   395,
1592      296,   486,   297,   864,   298,   244,   391,   392,   393,   394,
1593      395,   308,   221,   313,   179,   318,   221,   596,   331,   379,
1594      299,   386,   871,   341,   335,   359,   365,   251,   363,   370,
1595      373,   372,    95,   211,   176,   389,   605,   391,   392,   393,
1596      394,   395,   406,   471,   472,   402,   607,   407,   411,   419,
1597      735,   221,   230,   417,   443,   444,   445,   446,   447,   420,
1598       95,   448,   449,   456,   450,   858,   629,   810,   457,   451,
1599      458,   748,   749,   459,   204,   464,   467,    95,   644,   347,
1600      469,   490,   494,   495,   497,   764,   244,   391,   392,   393,
1601      394,   395,   787,   766,   244,   509,   510,   230,   790,   443,
1602      444,   445,   446,   447,   512,   780,   448,   449,   473,   450,
1603      514,   655,   516,   527,   451,   443,   444,   445,   446,   447,
1604      530,   542,   448,   449,   427,   450,   556,   559,   557,   566,
1605      451,   892,   569,   572,   731,   581,   597,   592,   602,   613,
1606      593,   606,   440,   631,   645,   648,   647,   656,   658,   657,
1607      651,   659,   743,   827,   722,   575,   214,   221,   662,   750,
1608      734,   744,   733,   725,   737,   757,   738,   758,   741,   740,
1609      755,   776,   781,   782,   846,   817,   794,   819,   830,   833,
1610      765,   831,   848,   763,   627,   872,   790,   874,   853,   844,
1611      876,   880,   857,   855,   879,   778,   882,   884,   901,   849,
1612      885,   900,   904,   908,   591,   594,   599,   168,   907,   911,
1613      832,   785,   513,   169,   519,   600,   522,   601,   588,   863,
1614      401,   624,   310,   438,   518,   439,   623,   547,   750,   546,
1615      804,   909,   873,   759,   845,   850,   899,   816,   808,   621,
1616      637,   747,   829,   328,   865,   702,   854,   797,   221,   622,
1617      795,   796,   894,   745,   493,   639,   888,   580,   891,   568,
1618      482,   878,   503,   897,   638,   875,     0,   466,   208,   655,
1619        0,   843,     0,     0,     0,     0,   838,     0,     0,     0,
1620        0,     0,     0,     0,   127,     0,     0,     0,     0,     0,
1621        0,   128,     0,     0,   750,   898,     0,   750,     0,     0,
1622        0,     0,     0,     0,     0,   750,   750,   129,     0,     0,
1623        0,   130,   131,   132,   133,   134,   135,   136,   137,   138,
1624      139,   140,   141,     0,     0,   142,   143,     0,     0,     0,
1625        0,   144,     0,     0,     0,     0,     0,     0,   145,     0,
1626        0,   146,     0,   147,     0,     0,     0,     0,     0,   148,
1627      149,     0,     0,     0,     0,     0,     0,   167,     1,   150,
1628        2,     3,     4,     5,     6,  -227,     0,   750,     7,   151,
1629      750,  -227,     0,   152,     0,     0,     0,     0,     0,     0,
1630        0,     0,   153,     0,     0,   895,     0,     0,     0,   154,
1631        0,   750,     0,   838,     0,     0,   750,     0,     8,     9,
1632     -544,     0,     0,    10,    11,     0,    12,    13,    14,  -544,
1633        0,     0,     0,    15,  -544,     0,     0,     0,  -544,     0,
1634       16,     0,    17,    18,  -192,    19,    20,    21,    22,    23,
1635       24,    25,    26,    27,    28,    29,    30,    31,  -184,     0,
1636       32,    33,     0,     0,     0,    34,    35,     0,     0,     0,
1637        0,    36,    37,    38,     0,    39,    40,     0,    41,     0,
1638        0,     0,     0,     0,    42,    43,     0,     0,     0,    44,
1639        0,     0,     0,     0,    45,     0,    46,  -544,    47,    48,
1640        0,    49,     0,    50,    51,     0,     0,     0,    52,     0,
1641        0,     0,     0,     0,     0,     0,     0,    53,     0,     0,
1642        0,     0,    54,     0,    55,     0,     0,     0,     1,    56,
1643        2,     3,     4,     5,     6,  -227,     0,     0,     7,     0,
1644        0,  -227,     0,     0,     0,     0,     0,     0,     0,     0,
1645        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1646        0,     0,     0,     0,     0,     0,     0,     0,     8,     9,
1647     -544,     0,     0,    10,    11,     0,    12,    13,    14,  -544,
1648        0,     0,     0,    15,  -544,     0,     0,     0,  -544,     0,
1649       16,     0,    17,    18,  -192,    19,    20,    21,    22,    23,
1650       24,    25,    26,    27,    28,    29,    30,    31,  -184,     0,
1651       32,    33,     0,     0,     0,    34,    35,     0,     0,     0,
1652        0,    36,    37,    38,     0,    39,    40,     0,    41,     0,
1653        0,     0,     0,     0,    42,    43,     0,     0,     0,    44,
1654        0,     0,     0,     0,    45,     0,    46,  -544,    47,    48,
1655        0,    49,     0,    50,    51,     0,     0,     0,    52,     0,
1656        0,     0,     0,     0,     0,     0,     0,    53,     0,     0,
1657        0,     0,    54,     0,    55,     0,     0,     0,     0,    56
1658 };
1659
1660 static const short yycheck[] =
1661 {
1662        3,     4,   245,   119,     0,   303,   104,   175,   103,     0,
1663      121,   196,   107,    90,    91,    98,   319,   108,   109,     3,
1664        4,    85,   557,   309,   564,   269,   467,   614,   463,   721,
1665      689,    34,    10,    16,    17,   470,    11,    16,    14,   542,
1666      699,    16,    14,    96,    16,    14,    20,    16,   352,     8,
1667      166,     7,    37,    34,    59,   496,     8,    43,   428,     8,
1668       11,    57,   157,    34,    21,    13,    57,    19,    20,    13,
1669       20,    34,    75,    37,    13,    43,    40,    73,     8,    11,
1670       29,     8,    85,    35,    36,    37,    38,    39,    20,     9,
1671       19,    43,    36,     8,    37,    98,    64,    40,   101,    28,
1672        9,   104,    69,   106,    34,    44,   798,    34,     8,     8,
1673       77,     8,    43,   116,    29,   118,   119,   120,   114,    82,
1674      184,    69,   125,     9,    53,     9,    57,   218,    48,    29,
1675       61,    28,    82,    53,    54,    55,    85,    86,   236,    48,
1676      145,   125,   428,    19,    53,    54,    55,     9,   434,   135,
1677      114,    57,     9,   109,    97,   136,    42,   210,   143,   662,
1678       36,    23,    24,    25,    26,    27,   149,     9,   860,   145,
1679      149,   145,   150,   145,   149,   134,   145,   547,   482,   262,
1680       42,   184,   153,   135,   187,   772,    48,    84,   787,   120,
1681        8,   790,   727,   145,   853,   124,   440,   889,     8,   202,
1682      799,     8,   122,     8,    81,   111,     8,    69,     9,    19,
1683       28,   207,   208,   122,   649,     8,   145,    19,     8,   105,
1684      106,    28,   128,    28,     9,   320,   229,   113,   114,   115,
1685      116,   234,   235,   236,   675,     8,    29,    30,   241,    29,
1686       30,   103,   104,   129,    10,     8,    19,    20,   110,   365,
1687       43,   349,   343,     8,    20,   332,    19,    20,   501,   262,
1688        8,   547,    37,     9,   863,    40,   269,    22,   271,   809,
1689      861,    19,    20,   276,   865,   137,   114,   115,   116,    21,
1690       43,   277,   373,    25,   146,   884,     8,    34,   291,    31,
1691       32,    33,    34,     9,   885,    43,    10,    44,   739,   890,
1692       22,    43,    66,   306,   415,     9,    20,   145,    19,    20,
1693       52,   314,   315,   904,   901,   406,   411,     8,    10,    30,
1694      911,   334,   306,    14,     9,   321,    68,    34,    20,   342,
1695       23,    73,    25,    40,    58,    62,    60,   872,    31,    32,
1696       33,    34,    10,    11,    32,    87,   349,   103,   104,    37,
1697       43,    13,    40,   356,   357,   351,   359,    19,   441,    52,
1698      663,     8,   453,    90,    91,    92,    13,   109,    10,    37,
1699       34,   435,    40,    15,    38,    68,    40,     3,     4,     5,
1700       73,     9,   473,   499,   111,    10,   389,   478,    10,    11,
1701       15,    67,    10,   696,    87,    11,   399,    15,   103,   104,
1702      403,   404,   144,   130,   407,    19,    20,   498,    31,    32,
1703        9,   509,    41,    16,    17,   418,   109,    19,    20,     9,
1704      416,   103,   104,   407,   151,   536,   423,   424,     9,   425,
1705        9,     9,   435,     9,   525,     9,     9,   440,   441,   624,
1706        9,     9,     9,   526,     9,     9,   544,     9,     9,     9,
1707        9,   144,     9,   456,     9,   458,    10,    43,    11,   145,
1708      463,   457,    81,    12,   455,    94,    12,   470,    19,   560,
1709       87,    66,   468,    43,    81,   566,   105,   133,   721,   556,
1710      145,   148,   485,    19,   113,    35,    36,    37,    38,    39,
1711      119,   487,   121,    43,   123,    34,    35,    36,    37,    38,
1712       39,    12,   505,    36,    14,    11,   509,   510,    52,   512,
1713      139,   514,   810,   123,    52,    13,    43,   520,    70,     8,
1714       13,    28,     8,   526,    20,    13,   529,    35,    36,    37,
1715       38,    39,    12,    19,    20,    20,   532,    58,    13,   128,
1716      631,   544,    28,   118,    30,    31,    32,    33,    34,   154,
1717        8,    37,    38,     9,    40,   798,   559,   725,     9,    45,
1718        9,    19,    20,    44,    43,    43,    14,     8,   571,    16,
1719       44,    10,    10,    28,     9,   670,    34,    35,    36,    37,
1720       38,    39,   698,   674,    34,    13,    19,    28,   704,    30,
1721       31,    32,    33,    34,    13,   690,    37,    38,    84,    40,
1722       13,   597,   118,   100,    45,    30,    31,    32,    33,    34,
1723       44,    14,    37,    38,   149,    40,    58,    19,    58,    13,
1724       45,   864,    28,    32,   627,    21,    43,    32,    10,    19,
1725       31,    11,    13,   125,    19,    13,    15,    10,     9,    11,
1726      135,     9,   645,   741,    21,   648,   649,   650,    15,   652,
1727       15,   647,    44,    23,    10,   658,    44,    87,    13,    28,
1728       13,    23,    10,    13,    28,   138,    32,    30,    19,    44,
1729      673,    20,     4,   669,    69,    58,   792,    13,   124,   770,
1730       20,    28,   798,    44,    13,   688,    21,    44,    14,   780,
1731       44,    28,    44,    10,   505,   509,   512,    57,    44,    44,
1732      755,   697,   386,    62,   399,   514,   403,   520,   499,   802,
1733      253,   552,   182,   314,   397,   315,   550,   434,   721,   431,
1734      723,   901,   813,   660,   772,   782,   879,   730,   724,   544,
1735      821,   650,   747,   192,   803,   618,   792,   719,   741,   547,
1736      710,   718,   869,   648,   359,   567,   862,   487,   864,   478,
1737      348,   821,   372,   874,   566,   816,    -1,   337,    91,   755,
1738       -1,   764,    -1,    -1,    -1,    -1,   762,    -1,    -1,    -1,
1739       -1,    -1,    -1,    -1,    42,    -1,    -1,    -1,    -1,    -1,
1740       -1,    49,    -1,    -1,   787,   876,    -1,   790,    -1,    -1,
1741       -1,    -1,    -1,    -1,    -1,   798,   799,    65,    -1,    -1,
1742       -1,    69,    70,    71,    72,    73,    74,    75,    76,    77,
1743       78,    79,    80,    -1,    -1,    83,    84,    -1,    -1,    -1,
1744       -1,    89,    -1,    -1,    -1,    -1,    -1,    -1,    96,    -1,
1745       -1,    99,    -1,   101,    -1,    -1,    -1,    -1,    -1,   107,
1746      108,    -1,    -1,    -1,    -1,    -1,    -1,     0,     1,   117,
1747        3,     4,     5,     6,     7,     8,    -1,   860,    11,   127,
1748      863,    14,    -1,   131,    -1,    -1,    -1,    -1,    -1,    -1,
1749       -1,    -1,   140,    -1,    -1,   871,    -1,    -1,    -1,   147,
1750       -1,   884,    -1,   879,    -1,    -1,   889,    -1,    41,    42,
1751       43,    -1,    -1,    46,    47,    -1,    49,    50,    51,    52,
1752       -1,    -1,    -1,    56,    57,    -1,    -1,    -1,    61,    -1,
1753       63,    -1,    65,    66,    67,    68,    69,    70,    71,    72,
1754       73,    74,    75,    76,    77,    78,    79,    80,    81,    -1,
1755       83,    84,    -1,    -1,    -1,    88,    89,    -1,    -1,    -1,
1756       -1,    94,    95,    96,    -1,    98,    99,    -1,   101,    -1,
1757       -1,    -1,    -1,    -1,   107,   108,    -1,    -1,    -1,   112,
1758       -1,    -1,    -1,    -1,   117,    -1,   119,   120,   121,   122,
1759       -1,   124,    -1,   126,   127,    -1,    -1,    -1,   131,    -1,
1760       -1,    -1,    -1,    -1,    -1,    -1,    -1,   140,    -1,    -1,
1761       -1,    -1,   145,    -1,   147,    -1,    -1,    -1,     1,   152,
1762        3,     4,     5,     6,     7,     8,    -1,    -1,    11,    -1,
1763       -1,    14,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1764       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1765       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    41,    42,
1766       43,    -1,    -1,    46,    47,    -1,    49,    50,    51,    52,
1767       -1,    -1,    -1,    56,    57,    -1,    -1,    -1,    61,    -1,
1768       63,    -1,    65,    66,    67,    68,    69,    70,    71,    72,
1769       73,    74,    75,    76,    77,    78,    79,    80,    81,    -1,
1770       83,    84,    -1,    -1,    -1,    88,    89,    -1,    -1,    -1,
1771       -1,    94,    95,    96,    -1,    98,    99,    -1,   101,    -1,
1772       -1,    -1,    -1,    -1,   107,   108,    -1,    -1,    -1,   112,
1773       -1,    -1,    -1,    -1,   117,    -1,   119,   120,   121,   122,
1774       -1,   124,    -1,   126,   127,    -1,    -1,    -1,   131,    -1,
1775       -1,    -1,    -1,    -1,    -1,    -1,    -1,   140,    -1,    -1,
1776       -1,    -1,   145,    -1,   147,    -1,    -1,    -1,    -1,   152
1777 };
1778
1779 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1780    symbol of state STATE-NUM.  */
1781 static const unsigned short yystos[] =
1782 {
1783        0,     1,     3,     4,     5,     6,     7,    11,    41,    42,
1784       46,    47,    49,    50,    51,    56,    63,    65,    66,    68,
1785       69,    70,    71,    72,    73,    74,    75,    76,    77,    78,
1786       79,    80,    83,    84,    88,    89,    94,    95,    96,    98,
1787       99,   101,   107,   108,   112,   117,   119,   121,   122,   124,
1788      126,   127,   131,   140,   145,   147,   152,   156,   157,   158,
1789      159,   162,   163,   164,   165,   166,   170,   172,   195,   229,
1790      232,   235,   236,   238,   239,   240,   330,   353,   359,   360,
1791      386,   388,   390,   397,   398,   399,   401,   402,   418,   424,
1792      425,   426,    11,   160,   161,     8,   167,   169,   167,    21,
1793      331,   332,   333,     9,     9,   354,     9,     9,     9,     9,
1794        9,     9,     9,     9,     9,     9,     9,     9,     9,     9,
1795        9,   169,     9,   103,   104,   419,     9,    42,    49,    65,
1796       69,    70,    71,    72,    73,    74,    75,    76,    77,    78,
1797       79,    80,    83,    84,    89,    96,    99,   101,   107,   108,
1798      117,   127,   131,   140,   147,   237,     9,     9,     9,     9,
1799      230,   232,     9,     9,     9,     9,     9,     0,   157,   161,
1800       10,    11,   171,     9,    81,    67,    20,   238,    11,    14,
1801      167,   241,   242,   243,   244,   247,   249,   251,   252,    10,
1802      358,    11,   362,    43,    57,    61,   120,   361,    12,    22,
1803      247,   400,    43,   403,    43,    64,   367,   427,   427,   160,
1804      168,   169,    12,    22,   169,   334,   335,    19,   296,    29,
1805       30,   169,   182,   183,   288,   355,   134,   169,   210,   296,
1806       28,   169,   382,   382,   177,   185,   174,    81,   238,    87,
1807      169,   192,   169,   216,    34,   169,   209,   310,    29,    85,
1808       86,   169,   199,   200,   202,   204,   205,   206,   358,    37,
1809       40,   215,   167,   420,   421,    37,    40,    97,   175,   173,
1810      218,   296,    66,     7,   109,   224,    43,   233,    81,   231,
1811      103,   104,   225,    57,   111,   128,   227,   133,   148,   153,
1812      220,   310,    41,    94,   105,   113,   119,   121,   123,   139,
1813      196,   197,   198,   230,   145,    11,    19,   253,    12,   250,
1814      243,   246,   247,    36,   248,    13,   168,   254,    11,     9,
1815       42,   105,   106,   113,   114,   115,   116,   129,   295,   363,
1816      364,    52,   387,   391,   403,    52,   382,   408,   409,   410,
1817      169,   123,   404,   368,   238,   238,   160,    16,   326,   343,
1818      344,   345,   346,   347,   348,   349,    19,    36,   336,    13,
1819      337,   382,   293,    70,   356,    43,    37,   143,   208,   169,
1820        8,   384,    28,    13,    43,   178,   179,   180,   182,   169,
1821      186,   187,   182,    34,    40,   176,   169,   193,   194,    13,
1822      217,    35,    36,    37,    38,    39,   313,   311,   313,   201,
1823      207,   215,    20,    20,    82,   168,    12,    58,   422,   222,
1824      254,    13,   219,   169,   169,   234,   238,   118,   228,   128,
1825      154,   221,   169,    13,    36,   233,   167,   149,   256,   257,
1826      258,   259,   260,   324,   326,    10,    15,   245,   249,   252,
1827       13,    19,   255,    30,    31,    32,    33,    34,    37,    38,
1828       40,    45,   323,   296,   238,   365,     9,     9,     9,    44,
1829      367,   367,   396,   333,    43,   411,   409,    14,   412,    44,
1830      333,    19,    20,    84,   323,   369,   370,   373,   374,   375,
1831      382,   385,   346,   182,   286,    14,   238,   351,   352,   347,
1832       10,   169,   169,   335,    10,    28,   289,     9,   357,   211,
1833      212,   310,   383,   384,   382,   181,    31,    32,   184,    13,
1834       19,   188,    13,   188,    13,   169,   118,   226,   226,   202,
1835      203,    29,   206,   169,   382,   423,   167,   100,   223,   296,
1836       44,   358,   238,   169,   197,   197,   238,     3,     4,     5,
1837      261,   257,    14,   264,   265,   268,   260,   256,   247,   254,
1838      168,   382,   232,   169,   238,   169,    58,    58,   334,    19,
1839      374,    59,   238,   413,   334,   382,    13,   372,   375,    28,
1840       17,   327,    32,   350,    34,   169,   339,   340,   341,    10,
1841      352,    21,    30,   290,   292,   374,   382,    44,   212,   213,
1842      313,   179,    32,    31,   180,   182,   169,    43,   189,   187,
1843      194,   204,    10,   382,   168,   169,    11,   238,   358,    69,
1844       77,   262,   263,    19,   268,   297,   298,   299,   300,   303,
1845      306,   286,   327,   255,   231,   367,   396,    69,   405,   169,
1846      382,   125,   414,   405,   376,   377,   381,   382,   385,   373,
1847       34,    38,    40,   371,   169,    19,   342,    15,    13,   338,
1848      291,   135,   214,    44,   191,   238,    10,    11,     9,     9,
1849       10,   150,    15,     9,    23,    24,    25,    26,    27,    48,
1850       69,   103,   104,   110,   137,   146,   269,   270,   271,   283,
1851      284,   294,   295,   322,    62,    90,    91,    92,   111,   130,
1852      151,   274,   275,   276,   285,   302,     9,    48,    53,    54,
1853       55,   122,   301,   317,   318,    23,    25,    31,    32,    33,
1854       43,    52,    68,    73,    87,   109,   144,   304,   305,   307,
1855      308,   310,    21,   328,   403,    23,   389,    58,    60,   392,
1856       19,   169,   406,    44,    15,   382,   415,    10,    44,   379,
1857       28,    13,   329,   169,   238,   341,   334,   288,    19,    20,
1858      169,   312,   314,   315,   316,    13,   190,   169,    87,   263,
1859      268,   323,   277,   238,   296,   169,   382,    19,    20,   272,
1860      273,   374,    10,    15,   278,   284,    23,   287,   169,   278,
1861      296,    10,    13,   301,   323,   238,    82,   310,   278,   136,
1862      310,   319,   320,   321,    32,   308,   306,   302,    43,   135,
1863      238,   309,   313,   314,   169,   114,   115,   116,   238,   366,
1864      230,   393,   396,   296,   394,   395,   169,   138,   407,    30,
1865      416,   374,   380,    32,    37,    40,   378,   182,    10,   293,
1866       19,    20,   191,    44,    19,    28,    53,   124,   238,   279,
1867      280,   281,   282,   169,   382,   271,    28,   266,     4,   382,
1868      276,   312,   312,   124,   321,    44,    21,   310,   313,   314,
1869       43,   312,    43,   214,    43,   311,    37,    40,   114,   325,
1870      405,   233,    58,   382,    13,   407,    20,   417,   381,    13,
1871       28,   267,    21,   278,    44,    44,   314,   309,   310,    43,
1872      312,   310,   313,   309,   329,   238,   396,   395,   382,   280,
1873       28,    14,   312,   309,    44,   314,   309,    44,    10,   269,
1874      309,    44,    15,   309
1875 };
1876
1877 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
1878 # define YYSIZE_T __SIZE_TYPE__
1879 #endif
1880 #if ! defined (YYSIZE_T) && defined (size_t)
1881 # define YYSIZE_T size_t
1882 #endif
1883 #if ! defined (YYSIZE_T)
1884 # if defined (__STDC__) || defined (__cplusplus)
1885 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
1886 #  define YYSIZE_T size_t
1887 # endif
1888 #endif
1889 #if ! defined (YYSIZE_T)
1890 # define YYSIZE_T unsigned int
1891 #endif
1892
1893 #define yyerrok         (yyerrstatus = 0)
1894 #define yyclearin       (yychar = YYEMPTY)
1895 #define YYEMPTY         -2
1896 #define YYEOF           0
1897
1898 #define YYACCEPT        goto yyacceptlab
1899 #define YYABORT         goto yyabortlab
1900 #define YYERROR         goto yyerrlab1
1901
1902 /* Like YYERROR except do call yyerror.  This remains here temporarily
1903    to ease the transition to the new meaning of YYERROR, for GCC.
1904    Once GCC version 2 has supplanted version 1, this can go.  */
1905
1906 #define YYFAIL          goto yyerrlab
1907
1908 #define YYRECOVERING()  (!!yyerrstatus)
1909
1910 #define YYBACKUP(Token, Value)                                  \
1911 do                                                              \
1912   if (yychar == YYEMPTY && yylen == 1)                          \
1913     {                                                           \
1914       yychar = (Token);                                         \
1915       yylval = (Value);                                         \
1916       yychar1 = YYTRANSLATE (yychar);                           \
1917       YYPOPSTACK;                                               \
1918       goto yybackup;                                            \
1919     }                                                           \
1920   else                                                          \
1921     {                                                           \
1922       yyerror ("syntax error: cannot back up");                 \
1923       YYERROR;                                                  \
1924     }                                                           \
1925 while (0)
1926
1927 #define YYTERROR        1
1928 #define YYERRCODE       256
1929
1930 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
1931    are run).  */
1932
1933 #ifndef YYLLOC_DEFAULT
1934 # define YYLLOC_DEFAULT(Current, Rhs, N)           \
1935   Current.first_line   = Rhs[1].first_line;      \
1936   Current.first_column = Rhs[1].first_column;    \
1937   Current.last_line    = Rhs[N].last_line;       \
1938   Current.last_column  = Rhs[N].last_column;
1939 #endif
1940
1941 /* YYLEX -- calling `yylex' with the right arguments.  */
1942
1943 #define YYLEX   yylex ()
1944
1945 /* Enable debugging if requested.  */
1946 #if YYDEBUG
1947
1948 # ifndef YYFPRINTF
1949 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1950 #  define YYFPRINTF fprintf
1951 # endif
1952
1953 # define YYDPRINTF(Args)                        \
1954 do {                                            \
1955   if (yydebug)                                  \
1956     YYFPRINTF Args;                             \
1957 } while (0)
1958 # define YYDSYMPRINT(Args)                      \
1959 do {                                            \
1960   if (yydebug)                                  \
1961     yysymprint Args;                            \
1962 } while (0)
1963 /* Nonzero means print parse trace.  It is left uninitialized so that
1964    multiple parsers can coexist.  */
1965 int yydebug;
1966 #else /* !YYDEBUG */
1967 # define YYDPRINTF(Args)
1968 # define YYDSYMPRINT(Args)
1969 #endif /* !YYDEBUG */
1970
1971 /* YYINITDEPTH -- initial size of the parser's stacks.  */
1972 #ifndef YYINITDEPTH
1973 # define YYINITDEPTH 200
1974 #endif
1975
1976 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1977    if the built-in stack extension method is used).
1978
1979    Do not make this value too large; the results are undefined if
1980    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
1981    evaluated with infinite-precision integer arithmetic.  */
1982
1983 #if YYMAXDEPTH == 0
1984 # undef YYMAXDEPTH
1985 #endif
1986
1987 #ifndef YYMAXDEPTH
1988 # define YYMAXDEPTH 10000
1989 #endif
1990
1991 \f
1992
1993 #if YYERROR_VERBOSE
1994
1995 # ifndef yystrlen
1996 #  if defined (__GLIBC__) && defined (_STRING_H)
1997 #   define yystrlen strlen
1998 #  else
1999 /* Return the length of YYSTR.  */
2000 static YYSIZE_T
2001 #   if defined (__STDC__) || defined (__cplusplus)
2002 yystrlen (const char *yystr)
2003 #   else
2004 yystrlen (yystr)
2005      const char *yystr;
2006 #   endif
2007 {
2008   register const char *yys = yystr;
2009
2010   while (*yys++ != '\0')
2011     continue;
2012
2013   return yys - yystr - 1;
2014 }
2015 #  endif
2016 # endif
2017
2018 # ifndef yystpcpy
2019 #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
2020 #   define yystpcpy stpcpy
2021 #  else
2022 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2023    YYDEST.  */
2024 static char *
2025 #   if defined (__STDC__) || defined (__cplusplus)
2026 yystpcpy (char *yydest, const char *yysrc)
2027 #   else
2028 yystpcpy (yydest, yysrc)
2029      char *yydest;
2030      const char *yysrc;
2031 #   endif
2032 {
2033   register char *yyd = yydest;
2034   register const char *yys = yysrc;
2035
2036   while ((*yyd++ = *yys++) != '\0')
2037     continue;
2038
2039   return yyd - 1;
2040 }
2041 #  endif
2042 # endif
2043
2044 #endif /* !YYERROR_VERBOSE */
2045
2046 \f
2047
2048 #if YYDEBUG
2049 /*-----------------------------.
2050 | Print this symbol on YYOUT.  |
2051 `-----------------------------*/
2052
2053 static void
2054 #if defined (__STDC__) || defined (__cplusplus)
2055 yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue)
2056 #else
2057 yysymprint (yyout, yytype, yyvalue)
2058     FILE* yyout;
2059     int yytype;
2060     YYSTYPE yyvalue;
2061 #endif
2062 {
2063   /* Pacify ``unused variable'' warnings.  */
2064   (void) yyvalue;
2065
2066   if (yytype < YYNTOKENS)
2067     {
2068       YYFPRINTF (yyout, "token %s (", yytname[yytype]);
2069 # ifdef YYPRINT
2070       YYPRINT (yyout, yytoknum[yytype], yyvalue);
2071 # endif
2072     }
2073   else
2074     YYFPRINTF (yyout, "nterm %s (", yytname[yytype]);
2075
2076   switch (yytype)
2077     {
2078       default:
2079         break;
2080     }
2081   YYFPRINTF (yyout, ")");
2082 }
2083 #endif /* YYDEBUG. */
2084
2085
2086 /*-----------------------------------------------.
2087 | Release the memory associated to this symbol.  |
2088 `-----------------------------------------------*/
2089
2090 static void
2091 #if defined (__STDC__) || defined (__cplusplus)
2092 yydestruct (int yytype, YYSTYPE yyvalue)
2093 #else
2094 yydestruct (yytype, yyvalue)
2095     int yytype;
2096     YYSTYPE yyvalue;
2097 #endif
2098 {
2099   /* Pacify ``unused variable'' warnings.  */
2100   (void) yyvalue;
2101
2102   switch (yytype)
2103     {
2104       default:
2105         break;
2106     }
2107 }
2108
2109 \f
2110
2111 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
2112    into yyparse.  The argument should have type void *.
2113    It should actually point to an object.
2114    Grammar actions can access the variable by casting it
2115    to the proper pointer type.  */
2116
2117 #ifdef YYPARSE_PARAM
2118 # if defined (__STDC__) || defined (__cplusplus)
2119 #  define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
2120 #  define YYPARSE_PARAM_DECL
2121 # else
2122 #  define YYPARSE_PARAM_ARG YYPARSE_PARAM
2123 #  define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
2124 # endif
2125 #else /* !YYPARSE_PARAM */
2126 # define YYPARSE_PARAM_ARG
2127 # define YYPARSE_PARAM_DECL
2128 #endif /* !YYPARSE_PARAM */
2129
2130 /* Prevent warning if -Wstrict-prototypes.  */
2131 #ifdef __GNUC__
2132 # ifdef YYPARSE_PARAM
2133 int yyparse (void *);
2134 # else
2135 int yyparse (void);
2136 # endif
2137 #endif
2138
2139
2140 /* The lookahead symbol.  */
2141 int yychar;
2142
2143 /* The semantic value of the lookahead symbol.  */
2144 YYSTYPE yylval;
2145
2146 /* Number of parse errors so far.  */
2147 int yynerrs;
2148
2149
2150 int
2151 yyparse (YYPARSE_PARAM_ARG)
2152      YYPARSE_PARAM_DECL
2153 {
2154   
2155   register int yystate;
2156   register int yyn;
2157   int yyresult;
2158   /* Number of tokens to shift before error messages enabled.  */
2159   int yyerrstatus;
2160   /* Lookahead token as an internal (translated) token number.  */
2161   int yychar1 = 0;
2162
2163   /* Three stacks and their tools:
2164      `yyss': related to states,
2165      `yyvs': related to semantic values,
2166      `yyls': related to locations.
2167
2168      Refer to the stacks thru separate pointers, to allow yyoverflow
2169      to reallocate them elsewhere.  */
2170
2171   /* The state stack.  */
2172   short yyssa[YYINITDEPTH];
2173   short *yyss = yyssa;
2174   register short *yyssp;
2175
2176   /* The semantic value stack.  */
2177   YYSTYPE yyvsa[YYINITDEPTH];
2178   YYSTYPE *yyvs = yyvsa;
2179   register YYSTYPE *yyvsp;
2180
2181
2182
2183 #define YYPOPSTACK   (yyvsp--, yyssp--)
2184
2185   YYSIZE_T yystacksize = YYINITDEPTH;
2186
2187   /* The variables used to return semantic value and location from the
2188      action routines.  */
2189   YYSTYPE yyval;
2190
2191
2192   /* When reducing, the number of symbols on the RHS of the reduced
2193      rule.  */
2194   int yylen;
2195
2196   YYDPRINTF ((stderr, "Starting parse\n"));
2197
2198   yystate = 0;
2199   yyerrstatus = 0;
2200   yynerrs = 0;
2201   yychar = YYEMPTY;             /* Cause a token to be read.  */
2202
2203   /* Initialize stack pointers.
2204      Waste one element of value and location stack
2205      so that they stay on the same level as the state stack.
2206      The wasted elements are never initialized.  */
2207
2208   yyssp = yyss;
2209   yyvsp = yyvs;
2210
2211   goto yysetstate;
2212
2213 /*------------------------------------------------------------.
2214 | yynewstate -- Push a new state, which is found in yystate.  |
2215 `------------------------------------------------------------*/
2216  yynewstate:
2217   /* In all cases, when you get here, the value and location stacks
2218      have just been pushed. so pushing a state here evens the stacks.
2219      */
2220   yyssp++;
2221
2222  yysetstate:
2223   *yyssp = yystate;
2224
2225   if (yyssp >= yyss + yystacksize - 1)
2226     {
2227       /* Get the current used size of the three stacks, in elements.  */
2228       YYSIZE_T yysize = yyssp - yyss + 1;
2229
2230 #ifdef yyoverflow
2231       {
2232         /* Give user a chance to reallocate the stack. Use copies of
2233            these so that the &'s don't force the real ones into
2234            memory.  */
2235         YYSTYPE *yyvs1 = yyvs;
2236         short *yyss1 = yyss;
2237
2238
2239         /* Each stack pointer address is followed by the size of the
2240            data in use in that stack, in bytes.  This used to be a
2241            conditional around just the two extra args, but that might
2242            be undefined if yyoverflow is a macro.  */
2243         yyoverflow ("parser stack overflow",
2244                     &yyss1, yysize * sizeof (*yyssp),
2245                     &yyvs1, yysize * sizeof (*yyvsp),
2246
2247                     &yystacksize);
2248
2249         yyss = yyss1;
2250         yyvs = yyvs1;
2251       }
2252 #else /* no yyoverflow */
2253 # ifndef YYSTACK_RELOCATE
2254       goto yyoverflowlab;
2255 # else
2256       /* Extend the stack our own way.  */
2257       if (yystacksize >= YYMAXDEPTH)
2258         goto yyoverflowlab;
2259       yystacksize *= 2;
2260       if (yystacksize > YYMAXDEPTH)
2261         yystacksize = YYMAXDEPTH;
2262
2263       {
2264         short *yyss1 = yyss;
2265         union yyalloc *yyptr =
2266           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
2267         if (! yyptr)
2268           goto yyoverflowlab;
2269         YYSTACK_RELOCATE (yyss);
2270         YYSTACK_RELOCATE (yyvs);
2271
2272 #  undef YYSTACK_RELOCATE
2273         if (yyss1 != yyssa)
2274           YYSTACK_FREE (yyss1);
2275       }
2276 # endif
2277 #endif /* no yyoverflow */
2278
2279       yyssp = yyss + yysize - 1;
2280       yyvsp = yyvs + yysize - 1;
2281
2282
2283       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
2284                   (unsigned long int) yystacksize));
2285
2286       if (yyssp >= yyss + yystacksize - 1)
2287         YYABORT;
2288     }
2289
2290   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2291
2292   goto yybackup;
2293
2294 /*-----------.
2295 | yybackup.  |
2296 `-----------*/
2297 yybackup:
2298
2299 /* Do appropriate processing given the current state.  */
2300 /* Read a lookahead token if we need one and don't already have one.  */
2301 /* yyresume: */
2302
2303   /* First try to decide what to do without reference to lookahead token.  */
2304
2305   yyn = yypact[yystate];
2306   if (yyn == YYPACT_NINF)
2307     goto yydefault;
2308
2309   /* Not known => get a lookahead token if don't already have one.  */
2310
2311   /* yychar is either YYEMPTY or YYEOF
2312      or a valid token in external form.  */
2313
2314   if (yychar == YYEMPTY)
2315     {
2316       YYDPRINTF ((stderr, "Reading a token: "));
2317       yychar = YYLEX;
2318     }
2319
2320   /* Convert token to internal form (in yychar1) for indexing tables with.  */
2321
2322   if (yychar <= 0)              /* This means end of input.  */
2323     {
2324       yychar1 = 0;
2325       yychar = YYEOF;           /* Don't call YYLEX any more.  */
2326
2327       YYDPRINTF ((stderr, "Now at end of input.\n"));
2328     }
2329   else
2330     {
2331       yychar1 = YYTRANSLATE (yychar);
2332
2333       /* We have to keep this `#if YYDEBUG', since we use variables
2334          which are defined only if `YYDEBUG' is set.  */
2335       YYDPRINTF ((stderr, "Next token is "));
2336       YYDSYMPRINT ((stderr, yychar1, yylval));
2337       YYDPRINTF ((stderr, "\n"));
2338     }
2339
2340   /* If the proper action on seeing token YYCHAR1 is to reduce or to
2341      detect an error, take that action.  */
2342   yyn += yychar1;
2343   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1)
2344     goto yydefault;
2345   yyn = yytable[yyn];
2346   if (yyn <= 0)
2347     {
2348       if (yyn == 0 || yyn == YYTABLE_NINF)
2349         goto yyerrlab;
2350       yyn = -yyn;
2351       goto yyreduce;
2352     }
2353
2354   if (yyn == YYFINAL)
2355     YYACCEPT;
2356
2357   /* Shift the lookahead token.  */
2358   YYDPRINTF ((stderr, "Shifting token %d (%s), ",
2359               yychar, yytname[yychar1]));
2360
2361   /* Discard the token being shifted unless it is eof.  */
2362   if (yychar != YYEOF)
2363     yychar = YYEMPTY;
2364
2365   *++yyvsp = yylval;
2366
2367
2368   /* Count tokens shifted since error; after three, turn off error
2369      status.  */
2370   if (yyerrstatus)
2371     yyerrstatus--;
2372
2373   yystate = yyn;
2374   goto yynewstate;
2375
2376
2377 /*-----------------------------------------------------------.
2378 | yydefault -- do the default action for the current state.  |
2379 `-----------------------------------------------------------*/
2380 yydefault:
2381   yyn = yydefact[yystate];
2382   if (yyn == 0)
2383     goto yyerrlab;
2384   goto yyreduce;
2385
2386
2387 /*-----------------------------.
2388 | yyreduce -- Do a reduction.  |
2389 `-----------------------------*/
2390 yyreduce:
2391   /* yyn is the number of a rule to reduce with.  */
2392   yylen = yyr2[yyn];
2393
2394   /* If YYLEN is nonzero, implement the default value of the action:
2395      `$$ = $1'.
2396
2397      Otherwise, the following line sets YYVAL to garbage.
2398      This behavior is undocumented and Bison
2399      users should not rely upon it.  Assigning to YYVAL
2400      unconditionally makes the parser a bit smaller, and it avoids a
2401      GCC warning that YYVAL may be used uninitialized.  */
2402   yyval = yyvsp[1-yylen];
2403
2404
2405
2406 #if YYDEBUG
2407   /* We have to keep this `#if YYDEBUG', since we use variables which
2408      are defined only if `YYDEBUG' is set.  */
2409   if (yydebug)
2410     {
2411       int yyi;
2412
2413       YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
2414                  yyn - 1, yyrline[yyn]);
2415
2416       /* Print the symbols being reduced, and their result.  */
2417       for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++)
2418         YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
2419       YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
2420     }
2421 #endif
2422   switch (yyn)
2423     {
2424         case 8:
2425 #line 264 "gram.y"
2426     {
2427                 (void) contextcheck(C_MUSIC, "music information");
2428                 tssv_line();
2429                 /* reset flags for next voice */
2430                 Defining_multiple = NO;
2431                 Curr_grpsyl_p = (struct GRPSYL *) 0;
2432                 Good_till_canceled = NO;
2433                 free_extra_time();
2434                 Prev_grpsyl_p = 0;
2435         }
2436     break;
2437
2438   case 12:
2439 #line 286 "gram.y"
2440     {
2441                 /* for blank lines -- nothing to do */
2442         }
2443     break;
2444
2445   case 13:
2446 #line 292 "gram.y"
2447     {
2448                 /* to keep going after stumbling on an input error */
2449                 Getting_tup_dur = NO;
2450                 Good_till_canceled = NO;
2451                 Defining_multiple = NO;
2452                 Curr_grpsyl_p = (struct GRPSYL *) 0;
2453                 Last_grpsyl_p = (struct GRPSYL *) 0;
2454                 Prev_grpsyl_p = (struct GRPSYL *) 0;
2455         }
2456     break;
2457
2458   case 14:
2459 #line 303 "gram.y"
2460     {
2461                 /* fill in context field of the SSV struct */
2462                 Currstruct_p->u.ssv_p->context = (short) Context;
2463         }
2464     break;
2465
2466   case 15:
2467 #line 310 "gram.y"
2468     {
2469                 Curr_family = Score.fontfamily;
2470         }
2471     break;
2472
2473   case 16:
2474 #line 316 "gram.y"
2475     {}
2476     break;
2477
2478   case 17:
2479 #line 320 "gram.y"
2480     {}
2481     break;
2482
2483   case 18:
2484 #line 324 "gram.y"
2485     {
2486                 /* have lots of separate structs in music context, so
2487                  * mark that we have no current struct */
2488                 Currstruct_p = (struct MAINLL *) 0;
2489
2490                 /* make sure at least 1 staff is visible. Not good to
2491                  * check when user sets visible, because it would be
2492                  * nice to first set everything invisible and later
2493                  * turn one on. So if we wait till now to check,
2494                  * user doesn't have to switch back and forth from
2495                  * score to staff to get 1 voice visible. */
2496                 check_at_least1visible();
2497         }
2498     break;
2499
2500   case 19:
2501 #line 339 "gram.y"
2502     {
2503                 Context = C_SCORE;
2504         }
2505     break;
2506
2507   case 20:
2508 #line 345 "gram.y"
2509     {
2510                 (void) rangecheck(yyvsp[-1].intval, MINSTAFFS, Score.staffs, "staff number");
2511                 Context = C_STAFF;
2512                 Currstruct_p->u.ssv_p->staffno = yyvsp[-1].intval;
2513         }
2514     break;
2515
2516   case 21:
2517 #line 353 "gram.y"
2518     {
2519                 (void) rangecheck(yyvsp[-2].intval, MINSTAFFS, Score.staffs, "staff number");
2520                 (void) rangecheck(yyvsp[-1].intval, MINVOICES, MAXVOICES, "voice number");
2521                 Context = C_VOICE;
2522                 Currstruct_p->u.ssv_p->staffno = yyvsp[-2].intval;
2523                 Currstruct_p->u.ssv_p->voiceno = yyvsp[-1].intval;
2524         }
2525     break;
2526
2527   case 22:
2528 #line 362 "gram.y"
2529     {
2530                 /* allocate an SSV struct */
2531                 Currstruct_p = newMAINLLstruct(S_SSV, yylineno);
2532         }
2533     break;
2534
2535   case 23:
2536 #line 368 "gram.y"
2537     {
2538                 /* entering new context, if we have a current struct,
2539                  * we were in a different context, so add its info to the list */
2540                 end_prev_context();
2541         }
2542     break;
2543
2544   case 24:
2545 #line 375 "gram.y"
2546     {
2547                 struct FEED *feed_p;            /* where to attach blocks */
2548                 int calloced;                   /* YES if dynamically alloced */
2549
2550                 end_prev_context();
2551                 Currstruct_p = (struct MAINLL *) 0;
2552                 Context = yyvsp[0].intval;
2553                 calloced = NO;
2554
2555                 switch (yyvsp[0].intval) {
2556                 case C_HEADER:
2557                         /* We only allow one of these */
2558                         chkdup_headfoot(Gotheader++, "header");
2559                         Currblock_p = &Header;
2560                         break;
2561                 case C_HEAD2:
2562                         chkdup_headfoot(Gothead2++, "header2");
2563                         Currblock_p = &Header2;
2564                         break;
2565                 case C_FOOTER:
2566                         chkdup_headfoot(Gotfooter++, "footer");
2567                         Currblock_p = &Footer;
2568                         break;
2569                 case C_FOOT2:
2570                         chkdup_headfoot(Gotfoot2++, "foot2");
2571                         Currblock_p = &Footer2;
2572                         break;
2573                         break;
2574                 case C_TOP:
2575                 case C_TOP2:
2576                 case C_BOT:
2577                 case C_BOT2:
2578                 case C_BLOCK:
2579                         CALLOC(BLOCKHEAD, Currblock_p, 1);
2580                         calloced = YES;
2581                         break;
2582                 default:
2583                         pfatal("Unknown block-type context");
2584                         /*NOTREACHED*/
2585                         break;
2586                 }
2587                 set_win_coord(Currblock_p->c);
2588                 /* Remember where to start attaching "print" commands */
2589                 Next_print_link_p_p = &(Currblock_p->printdata_p);
2590
2591                 /* The dynamically allocated blocks
2592                  * (not the static head/foot blocks)
2593                  * need extra processing to populate
2594                  * the main list properly with FEEDs.
2595                  */
2596                 if (calloced == YES) {
2597                         if (Mainlltc_p == 0 || Mainlltc_p->str != S_FEED) {
2598                                 /* User had not specified a feed
2599                                  * right before this block, so we need
2600                                  * to add one for them implicitly.
2601                                  * Create a new FEED and add it
2602                                  * to the end of the main list.
2603                                  */
2604                                 insertMAINLL(newMAINLLstruct(S_FEED, yylineno),
2605                                                         Mainlltc_p);
2606                         }
2607                         feed_p = Mainlltc_p->u.feed_p;
2608
2609                         /* Normally, top/top2/bot/bot2 result in a pagefeed.
2610                          * But we have a special case for backward
2611                          * compatiblity and for flexibility.
2612                          * User can get a separate
2613                          * "title" page if they really want to,
2614                          * by using an explicit newpage at the beginning.
2615                          * But in the normal case, they'd want to declare
2616                          * top/bot that will go on the first page without
2617                          * that causing a newpage. So if there hasn't been
2618                          * any music or block yet, we won't set newpage=YES
2619                          * for top/top2/bot/bot2, but otherwise we will.
2620                          */
2621                         if (Context & (C_TOP|C_TOP2|C_BOT|C_BOT2)) {
2622                                 struct MAINLL *m_p;
2623                                 for (m_p = Mainlltc_p->prev; m_p != 0;
2624                                                         m_p = m_p->prev) {
2625                                         if (m_p->str == S_BAR ||
2626                                                         m_p->str == S_BLOCKHEAD) {
2627                                                 /* There was music or block,
2628                                                  * so this is not
2629                                                  * at very beginning,
2630                                                  * so no special case:
2631                                                  * there will be new page.
2632                                                  */
2633                                                 feed_p->pagefeed = YES;
2634                                                 break;
2635                                         }
2636                                 }
2637                         }
2638
2639                         /* Now check for redefined blocks and
2640                          * attach the BLOCKHEAD onto the FEED or the
2641                          * main list, as appropriate.
2642                          */
2643                         switch (Context) {
2644                         case C_TOP:
2645                                 if (feed_p->top_p != 0) {
2646                                         warning("top redefined before being used");
2647                                 }
2648                                 feed_p->top_p = Currblock_p;
2649                                 break;
2650                         case C_TOP2:
2651                                 if (feed_p->top2_p != 0) {
2652                                         warning("top2 redefined before being used");
2653                                 }
2654                                 feed_p->top2_p = Currblock_p;
2655                                 break;
2656                         case C_BOT:
2657                                 if (feed_p->bot_p != 0) {
2658                                         warning("bot redefined before being used");
2659                                 }
2660                                 feed_p->bot_p = Currblock_p;
2661                                 break;
2662                         case C_BOT2:
2663                                 if (feed_p->bot2_p != 0) {
2664                                         warning("bot2 redefined before being used");
2665                                 }
2666                                 feed_p->bot2_p = Currblock_p;
2667                                 break;
2668                         case C_BLOCK:
2669                                 insertMAINLL(newMAINLLstruct(S_BLOCKHEAD, yylineno),
2670                                                 Mainlltc_p);
2671                                 Mainlltc_p->u.blockhead_p = Currblock_p;
2672                                 /* These blocks count like "music" for purposes
2673                                  * of things that can only be set
2674                                  * before any "music"
2675                                  */
2676                                 Got_some_data = YES;
2677                                 break;
2678                         case C_HEADER:
2679                         case C_HEAD2:
2680                         case C_FOOTER:
2681                         case C_FOOT2:
2682                                 /* These are static, not in main list,
2683                                  * so nothing needs to be done with them.
2684                                  */
2685                                 break;
2686                         default:
2687                                 pfatal("unexpected context (0x%x) for block", Context);
2688                                 /*NOTREACHED*/
2689                                 break;
2690                         }
2691
2692                         /* We need a feed after a block.
2693                          * Use -1 as lineno to mark it as internally generated.
2694                          * That way if user puts their own explicit feed
2695                          * next in the input, we can know we can
2696                          * discard this internally generated one.
2697                          */
2698                         if (Context & C_BLOCK) {
2699                                 insertMAINLL(newMAINLLstruct(S_FEED, -1), Mainlltc_p);
2700                         }
2701                 }
2702         }
2703     break;
2704
2705   case 25:
2706 #line 534 "gram.y"
2707     {
2708                 Context = C_MUSIC;
2709         }
2710     break;
2711
2712   case 26:
2713 #line 539 "gram.y"
2714     {
2715                 end_prev_context();
2716                 Currstruct_p = (struct MAINLL *) 0;
2717                 Context = C_GRIDS;
2718         }
2719     break;
2720
2721   case 27:
2722 #line 547 "gram.y"
2723     {
2724                 if (Context == C_GRIDS) {
2725                         add_grid(yyvsp[-2].stringval, yyvsp[-1].stringval);
2726                 }
2727                 else if (Context == C_HEADSHAPES) {
2728                         /* skip past the font/size bytes */
2729                         add_shape(yyvsp[-2].stringval + 2, yyvsp[-1].stringval + 2);
2730                 }
2731                 else {
2732                         yyerror("unexpected strings");
2733                 }
2734         }
2735     break;
2736
2737   case 28:
2738 #line 562 "gram.y"
2739     {
2740                 end_prev_context();
2741                 Currstruct_p = (struct MAINLL *) 0;
2742                 Context = C_HEADSHAPES;
2743         }
2744     break;
2745
2746   case 30:
2747 #line 573 "gram.y"
2748     {
2749                 yyval.intval = yyvsp[0].intval;
2750                 /* later on we check for being within current range */
2751         }
2752     break;
2753
2754   case 31:
2755 #line 579 "gram.y"
2756     {
2757                 yyval.intval = atoi(yytext);
2758         }
2759     break;
2760
2761   case 35:
2762 #line 593 "gram.y"
2763     {
2764                 /* Only a few things are allowed to have a negative number.
2765                  * Other code assumes that that restriction is enforced here,
2766                  * so we only honor the minus if it is legal. */
2767                 if (yyvsp[-1].intval == -1) {
2768                         if (yyvsp[-3].intval != STAFFPAD && yyvsp[-3].intval != SYLPOSITION) {
2769                                 yyerror("negative value not allowed");
2770                         }
2771                         else {
2772                                 assign_int(yyvsp[-3].intval, -(yyvsp[0].intval), Currstruct_p);
2773                         }
2774                 }
2775                 else {
2776                         assign_int(yyvsp[-3].intval, yyvsp[0].intval, Currstruct_p);
2777                 }
2778         }
2779     break;
2780
2781   case 36:
2782 #line 612 "gram.y"
2783     {
2784                 /* only restcombine and gridfret can be set to empty */
2785                 if (yyvsp[-1].intval == RESTCOMBINE) {
2786                         assign_int(yyvsp[-1].intval, NORESTCOMBINE, Currstruct_p);
2787                 }
2788                 else if (yyvsp[-1].intval == GRIDFRET) {
2789                         assign_int(yyvsp[-1].intval, NOGRIDFRET, Currstruct_p);
2790                 }
2791                 else {
2792                         yyerror("parameter value required");
2793                 }
2794         }
2795     break;
2796
2797   case 37:
2798 #line 627 "gram.y"
2799     {
2800                 assign_float(yyvsp[-2].intval, yyvsp[0].floatval, Currstruct_p);
2801         }
2802     break;
2803
2804   case 38:
2805 #line 633 "gram.y"
2806     {
2807                 assign_2floats(yyvsp[-4].intval, yyvsp[-2].floatval, yyvsp[0].floatval, Currstruct_p);
2808         }
2809     break;
2810
2811   case 39:
2812 #line 639 "gram.y"
2813     {
2814                 double multiplier;
2815                 multiplier = (Score.units == INCHES ? 1.0 : CMPERINCH);
2816                 assign_float(PAGEWIDTH, pagesztbl[yyvsp[-1].intval][yyvsp[0].intval] * multiplier, Currstruct_p);
2817                 assign_float(PAGEHEIGHT, pagesztbl[yyvsp[-1].intval][yyvsp[0].intval ^ 1] * multiplier, Currstruct_p);
2818         }
2819     break;
2820
2821   case 40:
2822 #line 647 "gram.y"
2823     { begin_range(PL_UNKNOWN);  }
2824     break;
2825
2826   case 41:
2827 #line 648 "gram.y"
2828     { }
2829     break;
2830
2831   case 42:
2832 #line 652 "gram.y"
2833     {
2834                 /* specified in stepsizes, stored in inches */
2835                 assign_float(PAD, yyvsp[-1].intval * yyvsp[0].floatval * STEPSIZE, Currstruct_p);
2836         }
2837     break;
2838
2839   case 43:
2840 #line 659 "gram.y"
2841     {
2842                 assign_vscheme (yyvsp[-1].intval, yyvsp[0].intval, Currstruct_p);
2843         }
2844     break;
2845
2846   case 44:
2847 #line 665 "gram.y"
2848     {
2849                 set_beamlist(Currstruct_p);
2850                 if (Currstruct_p != 0 && Currstruct_p->u.ssv_p != 0) {
2851                         Currstruct_p->u.ssv_p->beamrests = (yyvsp[0].intval & 0x1);
2852                         Currstruct_p->u.ssv_p->beamspaces = ((yyvsp[0].intval >> 1) & 0x1);
2853                 }
2854         }
2855     break;
2856
2857   case 45:
2858 #line 675 "gram.y"
2859     {
2860                 set_staffset(yyvsp[-3].intval, Currstruct_p);
2861         }
2862     break;
2863
2864   case 46:
2865 #line 681 "gram.y"
2866     {
2867                 set_barstlist(Currstruct_p);
2868         }
2869     break;
2870
2871   case 47:
2872 #line 687 "gram.y"
2873     {
2874                 if (Currstruct_p != 0) {
2875                         chk_order(Currstruct_p->u.ssv_p, Order_place);
2876                 }
2877         }
2878     break;
2879
2880   case 49:
2881 #line 698 "gram.y"
2882     {
2883                 /* all the work for this is done in timesig */
2884         }
2885     break;
2886
2887   case 50:
2888 #line 704 "gram.y"
2889     {
2890         }
2891     break;
2892
2893   case 51:
2894 #line 709 "gram.y"
2895     {
2896                 set_font(yyvsp[-2].intval, yyvsp[0].intval, Currstruct_p);
2897         }
2898     break;
2899
2900   case 52:
2901 #line 715 "gram.y"
2902     {
2903                 set_font(yyvsp[-2].intval, yyvsp[0].intval, Currstruct_p);
2904         }
2905     break;
2906
2907   case 53:
2908 #line 721 "gram.y"
2909     {
2910                 if (contextcheck(C_SCORE|C_STAFF,"clef parameter") == YES) {
2911                         used_check(Currstruct_p, CLEF, "clef");
2912                         if (Context == C_STAFF &&
2913                                         is_tab_staff(Currstruct_p->u.ssv_p->staffno)) {
2914                                 yyerror("can't set clef on tab staff");
2915                         }
2916                         Currstruct_p->u.ssv_p->clef = yyvsp[0].intval;
2917                         Currstruct_p->u.ssv_p->used[CLEF] = YES;
2918                         asgnssv(Currstruct_p->u.ssv_p);
2919                 }
2920         }
2921     break;
2922
2923   case 54:
2924 #line 736 "gram.y"
2925     {
2926                 assign_int(yyvsp[-2].intval, yyvsp[0].intval, Currstruct_p);
2927         }
2928     break;
2929
2930   case 56:
2931 #line 745 "gram.y"
2932     {
2933                 if (contextcheck(C_STAFF|C_VOICE, "unset") == YES) {
2934                         if (yyvsp[0].intval < 0 || yyvsp[0].intval >= NUMFLDS) {
2935                                 pfatal("invalid parameter index %d", yyvsp[0].intval);
2936                         }
2937                         if (Currstruct_p->u.ssv_p->used[yyvsp[0].intval] == YES) {
2938                                 warning("unsetting parameter overrides previous setting");
2939                         }
2940                         /* Note that if user tries to unset something that
2941                          * can't be set in the current context, we silently
2942                          * ignore that. We figure that since it's already unset,
2943                          * it doesn't hurt anything to unset it again,
2944                          * and it's easier to not bother to check.
2945                          */
2946
2947                         Currstruct_p->u.ssv_p->used[yyvsp[0].intval] = UNSET;
2948
2949                         /* special case: scoresep controls two fields */
2950                         if (yyvsp[0].intval == MINSCSEP) {
2951                                 Currstruct_p->u.ssv_p->used[MAXSCSEP] = UNSET;
2952                         }
2953
2954                         /* Assign, just in case there are new interactions */
2955                         asgnssv(Currstruct_p->u.ssv_p);
2956                 }
2957         }
2958     break;
2959
2960   case 57:
2961 #line 773 "gram.y"
2962     { Doing_timeunit = YES; }
2963     break;
2964
2965   case 58:
2966 #line 774 "gram.y"
2967     {
2968                 if ( contextcheck(C_SSV, "timeunit parameter") == YES ) {
2969                         used_check(Currstruct_p, TIMEUNIT, "timeunit");
2970                         Currstruct_p->u.ssv_p->timeunit = yyvsp[0].ratval;
2971                         Currstruct_p->u.ssv_p->timelist_p = Extra_time_p;
2972                         Extra_time_p = 0;
2973                         Doing_timeunit = NO;
2974                         Currstruct_p->u.ssv_p->used[TIMEUNIT] = YES;
2975                 }
2976         }
2977     break;
2978
2979   case 59:
2980 #line 787 "gram.y"
2981     {
2982                 if ( contextcheck(C_SSV, "swingunit parameter") == YES ) {
2983                         used_check(Currstruct_p, SWINGUNIT, "swingunit");
2984                         Currstruct_p->u.ssv_p->swingunit = yyvsp[0].ratval;
2985                         Currstruct_p->u.ssv_p->used[SWINGUNIT] = YES;
2986                 }
2987         }
2988     break;
2989
2990   case 60:
2991 #line 797 "gram.y"
2992     {
2993         }
2994     break;
2995
2996   case 61:
2997 #line 802 "gram.y"
2998     {
2999         }
3000     break;
3001
3002   case 62:
3003 #line 807 "gram.y"
3004     {
3005                 if ( contextcheck(C_SCORE, "endingstyle parameter") == YES ) {
3006                         used_check(Currstruct_p, ENDINGSTYLE, "endingstyle");
3007                         Currstruct_p->u.ssv_p->endingstyle = yyvsp[0].intval;
3008                         Currstruct_p->u.ssv_p->used[ENDINGSTYLE] = YES;
3009                 }
3010         }
3011     break;
3012
3013   case 63:
3014 #line 817 "gram.y"
3015     {
3016                 if (contextcheck(C_SCORE | C_STAFF, "rehstyle parameter") == YES ) {
3017                         used_check(Currstruct_p, REHSTYLE, "rehstyle");
3018                         Currstruct_p->u.ssv_p->rehstyle = yyvsp[0].intval;
3019                         Currstruct_p->u.ssv_p->used[REHSTYLE] = YES;
3020                 }
3021                 
3022         }
3023     break;
3024
3025   case 64:
3026 #line 828 "gram.y"
3027     {
3028                 if ( contextcheck(C_SCORE | C_STAFF, "pedstyle parameter") == YES ) {
3029                         used_check(Currstruct_p, PEDSTYLE, "pedstyle");
3030                         Currstruct_p->u.ssv_p->pedstyle = yyvsp[0].intval;
3031                         Currstruct_p->u.ssv_p->used[PEDSTYLE] = YES;
3032                 }
3033         }
3034     break;
3035
3036   case 65:
3037 #line 838 "gram.y"
3038     {
3039                 char *trans_name;
3040                 trans_name = (yyvsp[-4].intval == TRANSPOSITION ?
3041                         "transpose" : "addtranspose");
3042                 if (contextcheck(C_SCORE|C_STAFF, trans_name) == YES) {
3043                         used_check(Currstruct_p, yyvsp[-4].intval, trans_name);
3044                         chk_interval(yyvsp[-1].intval, yyvsp[0].intval);
3045                         if (yyvsp[-4].intval == TRANSPOSITION) {
3046                                 Currstruct_p->u.ssv_p->inttype = yyvsp[-1].intval;
3047                                 Currstruct_p->u.ssv_p->intnum = yyvsp[-2].intval * yyvsp[0].intval;
3048                         }
3049                         else {
3050                                 Currstruct_p->u.ssv_p->addinttype = yyvsp[-1].intval;
3051                                 Currstruct_p->u.ssv_p->addintnum = yyvsp[-2].intval * yyvsp[0].intval;
3052                         }
3053                         Currstruct_p->u.ssv_p->used[yyvsp[-4].intval] = YES;
3054                         if (Context == C_STAFF &&
3055                                         is_tab_staff(Currstruct_p->u.ssv_p->staffno)
3056                                         == YES) {
3057                                 l_yyerror(Curr_filename, yylineno,
3058                                         "%s not allowed on tablature staff",
3059                                         trans_name);
3060                         }
3061                         else {
3062                                 asgnssv(Currstruct_p->u.ssv_p);
3063                         }
3064                 }
3065         }
3066     break;
3067
3068   case 66:
3069 #line 869 "gram.y"
3070     {
3071                 assign_unit(yyvsp[0].intval, Currstruct_p);
3072         }
3073     break;
3074
3075   case 67:
3076 #line 875 "gram.y"
3077     {
3078                 assign_string(yyvsp[-2].intval, yyvsp[0].stringval, Currstruct_p);
3079         }
3080     break;
3081
3082   case 68:
3083 #line 881 "gram.y"
3084     {
3085                 /* whereused is not allowed on voice, just score and staff */
3086                 if (contextcheck(C_SCORE|C_STAFF, "visible=whereused") == YES) {
3087                         assign_int(VISIBLE, YES, Currstruct_p);
3088                         Currstruct_p->u.ssv_p->hidesilent = YES;
3089                 }
3090         }
3091     break;
3092
3093   case 69:
3094 #line 891 "gram.y"
3095     {
3096                 /* only valid letter is y */
3097                 if (*yytext != 'y') {
3098                         yyerror("visible value must be y, n, or whereused");
3099                 }
3100                 else if (contextcheck(C_SSV, "visible parameter")
3101                                                                 == YES) {
3102                         assign_int(VISIBLE, YES, Currstruct_p);
3103                         Currstruct_p->u.ssv_p->hidesilent = NO;
3104                 }
3105         }
3106     break;
3107
3108   case 70:
3109 #line 905 "gram.y"
3110     {
3111                 if (contextcheck(C_SSV, "visible parameter") == YES) {
3112                         assign_int(VISIBLE, NO, Currstruct_p);
3113                         Currstruct_p->u.ssv_p->hidesilent = NO;
3114                 }
3115         }
3116     break;
3117
3118   case 71:
3119 #line 913 "gram.y"
3120     {
3121                 /* none specified */
3122                 yyval.intval = V_1;
3123         }
3124     break;
3125
3126   case 72:
3127 #line 920 "gram.y"
3128     {
3129                 /* only valid value here is 'f'  */
3130                 if (*yytext == 'f') {
3131                         yyval.intval = V_2FREESTEM;
3132                 }
3133                 else {
3134                         yyerror("invalid voice qualifier: must be f or o");
3135                         yyval.intval = V_1;
3136                 }
3137         }
3138     break;
3139
3140   case 73:
3141 #line 933 "gram.y"
3142     {
3143                 /* only valid value here is 'o' */
3144                 if (*yytext == 'o') {
3145                         yyval.intval = V_2OPSTEM;
3146                 }
3147                 else {
3148                         yyerror("invalid voice qualifier: must be f or o");
3149                         yyval.intval = (int) V_1;
3150                 }
3151         }
3152     break;
3153
3154   case 74:
3155 #line 945 "gram.y"
3156     {
3157                 /* NULL token for allocating a new beamlist */
3158                 new_beamlist();
3159         }
3160     break;
3161
3162   case 77:
3163 #line 959 "gram.y"
3164     {
3165                 add_beamlist(yyvsp[0].ratval);
3166         }
3167     break;
3168
3169   case 79:
3170 #line 968 "gram.y"
3171     {
3172                 add_beamlist(yyvsp[0].ratval);
3173         }
3174     break;
3175
3176   case 81:
3177 #line 977 "gram.y"
3178     { begin_subbeam(); }
3179     break;
3180
3181   case 82:
3182 #line 978 "gram.y"
3183     {
3184                 end_subbeam();
3185         }
3186     break;
3187
3188   case 83:
3189 #line 983 "gram.y"
3190     {
3191                 yyval.ratval = calcfulltime(yyvsp[-3].ratval, yyvsp[-2].intval);
3192
3193                 /* if filling in a GRPSYL struct, need to fill in dots.
3194                  * Could also be here due to beamstyle
3195                  * or timeunit or location time offset,
3196                  * in which case the Curr_grpsyl_p will be NULL,
3197                  * or while getting tuplet duration. */
3198                 if (Curr_grpsyl_p != (struct GRPSYL *) 0
3199                                                 && Getting_tup_dur == NO) {
3200                         Curr_grpsyl_p->dots = yyvsp[-2].intval;
3201                 }
3202                 else {
3203                         struct TIMELIST *timelist_p;    /* walk thru list */
3204                         struct TIMELIST *next_p;/* save next to delete curr */
3205                         RATIONAL totaltime;     /* sum of extra times */
3206
3207                         /* Start with first time value (which was calculated
3208                          * above and is now in $$), then add on the added
3209                          * times, if any. */
3210                         totaltime = yyval.ratval;
3211                         for (timelist_p = Extra_time_p; timelist_p != 0;
3212                                                 timelist_p = next_p) {
3213                                 next_p = timelist_p->next;
3214                                 totaltime = radd(totaltime, timelist_p->fulltime);
3215                                 if (Doing_timeunit == NO) {
3216                                         /* For things like swingunit
3217                                          * or tuplet time, we just need the
3218                                          * resulting time, not the individual
3219                                          * time units and arithmetic. */
3220                                         FREE(timelist_p);
3221                                 }
3222                         }
3223                         if (Extra_time_p != 0 && LE(totaltime, Zero)) {
3224                                 yyerror("Time values must add up to more than zero");
3225                         }
3226                         /* Current timelist is finished; can't append any
3227                          * more items to it. */
3228                         Curr_timelist_p = 0;
3229                         if (Doing_timeunit == YES) {
3230                                 /* For timeunit, we return the initial
3231                                  * timeunit, but also preserve
3232                                  * Extra_time_p for putting in SSV.
3233                                  */
3234                                 yyval.ratval = calcfulltime(yyvsp[-3].ratval, yyvsp[-2].intval);
3235                         }
3236                         else {
3237                                 /* the list has been freed above */
3238                                 Extra_time_p = 0;
3239                                 yyval.ratval = totaltime;
3240                         }
3241                 }
3242         }
3243     break;
3244
3245   case 84:
3246 #line 1039 "gram.y"
3247     {
3248                 yyval.ratval.n = (svpath(1, TIME))->time.n;
3249                 yyval.ratval.d = (svpath(1, TIME))->time.d;
3250                 if (Curr_grpsyl_p != (struct GRPSYL *) 0
3251                                         && Getting_tup_dur == NO) {
3252                         /* use whole note symbol as default */
3253                         Curr_grpsyl_p->basictime = 1;
3254                         Curr_grpsyl_p->is_meas = YES;
3255                         User_meas_time = NO;
3256                 }
3257                 else {
3258                         yyerror("'m' is not valid here");
3259                 }
3260         }
3261     break;
3262
3263   case 85:
3264 #line 1056 "gram.y"
3265     {
3266                 yyval.ratval = Zero;
3267         }
3268     break;
3269
3270   case 87:
3271 #line 1066 "gram.y"
3272     {
3273                 yyval.intval = NO;
3274         }
3275     break;
3276
3277   case 88:
3278 #line 1072 "gram.y"
3279     {
3280                 yyval.intval = (YES | (YES << 1));
3281         }
3282     break;
3283
3284   case 89:
3285 #line 1078 "gram.y"
3286     {
3287                 yyval.intval = ((YES << 1) | YES);
3288         }
3289     break;
3290
3291   case 90:
3292 #line 1084 "gram.y"
3293     {
3294                 yyval.intval = (YES << 1);
3295         }
3296     break;
3297
3298   case 91:
3299 #line 1090 "gram.y"
3300     {
3301                 yyval.intval = YES;
3302         }
3303     break;
3304
3305   case 92:
3306 #line 1095 "gram.y"
3307     {
3308                 /* null token for the purpose of allocating a new rangelist
3309                  * to be filled in with user data */
3310                 new_staffset();
3311         }
3312     break;
3313
3314   case 96:
3315 #line 1112 "gram.y"
3316     {
3317                 /* save information about this range in the list */
3318                 /* if only a single number, not a range, rangetail will be
3319                  * 0, so use num as both beginning and end of range */
3320                 add_staffset( yyvsp[-2].intval, (yyvsp[-1].intval > 0 ? yyvsp[-1].intval : yyvsp[-2].intval), String1, String2);
3321         }
3322     break;
3323
3324   case 97:
3325 #line 1120 "gram.y"
3326     {
3327                 /* no end of range, so return 0 as flag that there was only 1 number */
3328                 yyval.intval = 0;
3329         }
3330     break;
3331
3332   case 98:
3333 #line 1127 "gram.y"
3334     {
3335                 /* make sure isn't 0, because that it illegal and would be used
3336                  * later as though there were no range. Other error checking
3337                  * on this number will be done later. */
3338                 if (yyvsp[0].intval == 0) {
3339                         yyerror("second number of range may not be zero");
3340                 }
3341                 yyval.intval = yyvsp[0].intval;
3342         }
3343     break;
3344
3345   case 99:
3346 #line 1138 "gram.y"
3347     {
3348                 /* no labels */
3349                 String1 = String2 = (char *) 0;
3350         }
3351     break;
3352
3353   case 100:
3354 #line 1145 "gram.y"
3355     {
3356                 /* save label */
3357                 String1 = yyvsp[-2].stringval;
3358         }
3359     break;
3360
3361   case 101:
3362 #line 1151 "gram.y"
3363     {
3364                 /* no second label */
3365                 String2 = (char *) 0;
3366         }
3367     break;
3368
3369   case 102:
3370 #line 1158 "gram.y"
3371     {
3372                 /* save label2 for later use */
3373                 String2 = yyvsp[0].stringval;
3374         }
3375     break;
3376
3377   case 104:
3378 #line 1167 "gram.y"
3379     {
3380                 /* NULL token for allocating space for a bar style list */
3381                 new_barstlist();
3382         }
3383     break;
3384
3385   case 108:
3386 #line 1184 "gram.y"
3387     {
3388                 /* if only 1 number, not range, rangetail will be 0, so use
3389                  * same number for beginning and end */
3390                 add_barst(yyvsp[-1].intval, (yyvsp[0].intval == 0 ? yyvsp[-1].intval : yyvsp[0].intval) );
3391         }
3392     break;
3393
3394   case 109:
3395 #line 1191 "gram.y"
3396     {
3397                 Order_place = yyvsp[0].intval;
3398                 Order_prio = 1;
3399                 if (Currstruct_p != 0) {
3400                         switch (yyvsp[0].intval) {
3401                         case PL_ABOVE:
3402                                 Currstruct_p->u.ssv_p->used[ABOVEORDER] = YES;
3403                                 break;
3404                         case PL_BELOW:
3405                                 Currstruct_p->u.ssv_p->used[BELOWORDER] = YES;
3406                                 break;
3407                         case PL_BETWEEN:
3408                                 Currstruct_p->u.ssv_p->used[BETWEENORDER] = YES;
3409                                 break;
3410                         }
3411                 }
3412         }
3413     break;
3414
3415   case 110:
3416 #line 1211 "gram.y"
3417     {
3418                 if (Currstruct_p != 0) {
3419                         Currstruct_p->u.ssv_p->markorder[Order_place][yyvsp[0].intval] = Order_prio;
3420                 }
3421         }
3422     break;
3423
3424   case 111:
3425 #line 1219 "gram.y"
3426     {
3427                 if (Currstruct_p != 0) {
3428                         Currstruct_p->u.ssv_p->markorder[Order_place][yyvsp[0].intval] = ++Order_prio;
3429                 }
3430         }
3431     break;
3432
3433   case 112:
3434 #line 1227 "gram.y"
3435     {
3436                 if (Currstruct_p != 0) {
3437                         Currstruct_p->u.ssv_p->markorder[Order_place][yyvsp[0].intval] = Order_prio;
3438                 }
3439         }
3440     break;
3441
3442   case 113:
3443 #line 1234 "gram.y"
3444     {
3445                 if (Currstruct_p != 0) {
3446                         if (Currstruct_p->u.ssv_p->markorder[Order_place][yyvsp[0].intval] != 0) {
3447                                 l_yyerror(Curr_filename, yylineno,
3448                                         "order item %s specified more than once", yyvsp[0].intval);
3449                         }
3450                 }
3451                 yyval.intval = yyvsp[0].intval;
3452         }
3453     break;
3454
3455   case 114:
3456 #line 1246 "gram.y"
3457     {
3458                 yyval.intval = MK_MUSSYM;
3459         }
3460     break;
3461
3462   case 115:
3463 #line 1252 "gram.y"
3464     {
3465                 yyval.intval = MK_OCTAVE;
3466         }
3467     break;
3468
3469   case 116:
3470 #line 1258 "gram.y"
3471     {
3472                 yyval.intval = MK_OTHERTEXT;
3473         }
3474     break;
3475
3476   case 117:
3477 #line 1264 "gram.y"
3478     {
3479                 switch (yyvsp[0].intval) {
3480                 case TM_CHORD:
3481                         yyval.intval = MK_CHORD;
3482                         break;
3483                 case TM_DYN:
3484                         yyval.intval = MK_DYN;
3485                         break;
3486                 default:
3487                         yyerror("invalid text modifier in order list");
3488                         /* set to something valid, since $$ will be used
3489                          * as an array subscript. */
3490                         yyval.intval = MK_CHORD;
3491                         break;
3492                 }
3493         }
3494     break;
3495
3496   case 118:
3497 #line 1283 "gram.y"
3498     {
3499                 yyval.intval = MK_LYRICS;
3500         }
3501     break;
3502
3503   case 119:
3504 #line 1289 "gram.y"
3505     {
3506                 yyval.intval = MK_ENDING;
3507         }
3508     break;
3509
3510   case 120:
3511 #line 1295 "gram.y"
3512     {
3513                 yyval.intval = MK_REHEARSAL;
3514         }
3515     break;
3516
3517   case 121:
3518 #line 1301 "gram.y"
3519     {
3520                 yyval.intval = MK_PEDAL;
3521         }
3522     break;
3523
3524   case 122:
3525 #line 1307 "gram.y"
3526     {
3527                 tsig_item(TSR_END);
3528                 if (Currstruct_p != 0 && Currstruct_p->u.ssv_p != 0) {
3529                         MALLOCA(char, Currstruct_p->u.ssv_p->timerep, Tsig_offset);
3530                         strcpy(Currstruct_p->u.ssv_p->timerep, Timerep);
3531                         assign_timesig(Currstruct_p, yyvsp[0].intval, &Next_alt_timesig);
3532                         Tsig_visibility = yyvsp[0].intval;
3533                         /* If there are alternating time signatures,
3534                          * need to save pointer to this list */
3535                         if (Next_alt_timesig != 0) {
3536                                 Alt_timesig_list = Timerep;
3537                         }
3538                         else {
3539                                 Alt_timesig_list = 0;
3540                         }
3541                 }
3542                 /* Reset for next time signature usage, if any */
3543                 Tsig_offset = 0;
3544         }
3545     break;
3546
3547   case 124:
3548 #line 1331 "gram.y"
3549     { tsig_item(TSR_ALTERNATING); }
3550     break;
3551
3552   case 125:
3553 #line 1332 "gram.y"
3554     {
3555                 /* this is for alternating time signature */
3556         }
3557     break;
3558
3559   case 126:
3560 #line 1338 "gram.y"
3561     {
3562         }
3563     break;
3564
3565   case 127:
3566 #line 1342 "gram.y"
3567     { tsig_item(TSR_ADD); }
3568     break;
3569
3570   case 128:
3571 #line 1343 "gram.y"
3572     {
3573                 /* This would be for things like 2/4 + 3/8 */
3574         }
3575     break;
3576
3577   case 129:
3578 #line 1349 "gram.y"
3579     {
3580                 tsig_item(TSR_CUT);
3581         }
3582     break;
3583
3584   case 130:
3585 #line 1355 "gram.y"
3586     {
3587                 tsig_item(TSR_COMMON);
3588         }
3589     break;
3590
3591   case 131:
3592 #line 1361 "gram.y"
3593     {
3594                 tsig_item(TSR_SLASH);
3595                 if (yyvsp[0].intval < MINDENOMINATOR) {
3596                         l_yyerror(Curr_filename, yylineno,
3597                                 "time signature denominator cannot be less than %d",
3598                                 MINDENOMINATOR);
3599                         yyvsp[0].intval = MINDENOMINATOR;
3600                 }
3601                 else if (yyvsp[0].intval > MAXDENOMINATOR) {
3602                         l_yyerror(Curr_filename, yylineno,
3603                                 "time signature denominator cannot be greater than %d",
3604                                 MAXDENOMINATOR);
3605                         yyvsp[0].intval = MAXDENOMINATOR;
3606                 }
3607                 else if (power_of2check(yyvsp[0].intval, "time signature denominator") == NO) {
3608                         yyvsp[0].intval = 1 << drmo(yyvsp[0].intval);
3609                 }
3610
3611                 tsig_item(yyvsp[0].intval);
3612         }
3613     break;
3614
3615   case 132:
3616 #line 1384 "gram.y"
3617     {
3618                 /* this is something like 3+1/4 where the 1/4 get interpreted
3619                  * by lexer as quadwhole, but it's really 1 for numerator
3620                  * and 4 for denominator. 
3621                  */
3622                 tsig_item(1);
3623                 tsig_item(TSR_SLASH);
3624                 tsig_item(yyvsp[0].intval);
3625         }
3626     break;
3627
3628   case 133:
3629 #line 1396 "gram.y"
3630     {
3631                 tsig_item(1);
3632                 tsig_item(TSR_SLASH);
3633                 tsig_item(yyvsp[0].intval);
3634         }
3635     break;
3636
3637   case 136:
3638 #line 1410 "gram.y"
3639     {
3640                 if (yyvsp[0].intval < MINNUMERATOR) {
3641                         l_yyerror(Curr_filename, yylineno,
3642                                 "time signature numerator cannot be less than %d",
3643                                 MINNUMERATOR);
3644                         yyvsp[0].intval = MINNUMERATOR;
3645                 }
3646                 else if (yyvsp[0].intval > MAXNUMERATOR) {
3647                         l_yyerror(Curr_filename, yylineno,
3648                                 "time signature numerator cannot be greater than %d",
3649                                 MAXNUMERATOR);
3650                         yyvsp[0].intval = MAXNUMERATOR;
3651                 }
3652                 tsig_item(yyvsp[0].intval);
3653         }
3654     break;
3655
3656   case 137:
3657 #line 1428 "gram.y"
3658     {
3659                 yyval.intval = PTS_ONCE;
3660         }
3661     break;
3662
3663   case 138:
3664 #line 1434 "gram.y"
3665     {
3666                 yyval.intval = (yyvsp[0].intval == YES ? PTS_ALWAYS : PTS_NEVER);
3667         }
3668     break;
3669
3670   case 139:
3671 #line 1439 "gram.y"
3672     {
3673                 yyval.intval = NO;
3674         }
3675     break;
3676
3677   case 140:
3678 #line 1445 "gram.y"
3679     {
3680                 /* 'n' is used in various places to mean do NOT
3681                  * print something that would normally be printed,
3682                  * so YES means we do want to inhibit the normal printing. */
3683                 yyval.intval = YES;
3684         }
3685     break;
3686
3687   case 141:
3688 #line 1453 "gram.y"
3689     {
3690                 if ( (yyvsp[-1].intval != '#') && (yyvsp[-1].intval != '&') ) {
3691                         yyerror("key signature must include # or &");
3692                 }
3693                 else {
3694                         assign_key(yyvsp[-2].intval, yyvsp[-1].intval, yyvsp[0].intval, Currstruct_p);
3695                 }
3696         }
3697     break;
3698
3699   case 142:
3700 #line 1464 "gram.y"
3701     {
3702                 int sharps;
3703
3704                 /* Get number of sharps for the pitch letter */
3705                 sharps = strchr(Circle, yyvsp[-2].intval) - Circle - 1;
3706
3707                 /* adjust for sharp/flat */
3708                 if (yyvsp[-1].intval == '#') {
3709                         sharps += 7;
3710                 }
3711                 else if (yyvsp[-1].intval == '&') {
3712                         sharps -= 7;
3713                 }
3714                 else if (yyvsp[-1].intval != 0) {
3715                         yyerror("key letter can only be followed by # or &");
3716                         /* set to some ridiculous value, so will fail below */
3717                         sharps = 999;
3718                 }
3719
3720                 /* Adjust if needed for minor */
3721                 if (yyvsp[0].intval == YES) {
3722                         sharps -= 3;
3723                 }
3724
3725                 /* disallow illegal keys, like f& */
3726                 if (abs(sharps) > 7) {
3727                         /* print error unless already printed one above */
3728                         if (sharps < 100) {
3729                                 yyerror("invalid key--too many sharps or flats");
3730                         }
3731                 }
3732                 else {
3733                         assign_key(abs(sharps), (sharps >= 0 ? '#' : '&'),
3734                                                         yyvsp[0].intval, Currstruct_p);
3735                 }
3736         }
3737     break;
3738
3739   case 143:
3740 #line 1503 "gram.y"
3741     {
3742                 asgn_stafflines(yyvsp[-1].intval, yyvsp[0].intval == YES ? SS_NOTHING : SS_NORMAL, Currstruct_p);
3743         }
3744     break;
3745
3746   case 144:
3747 #line 1509 "gram.y"
3748     {
3749                 asgn_stafflines(yyvsp[-1].intval, SS_DRUM, Currstruct_p);
3750         }
3751     break;
3752
3753   case 145:
3754 #line 1515 "gram.y"
3755     {
3756                 /* use default tablature */
3757                 if (Currstruct_p != 0) {
3758                         Currstruct_p->u.ssv_p->strinfo = Guitar;
3759                         asgn_stafflines(DEFTABLINES, NO, Currstruct_p);
3760                 }
3761         }
3762     break;
3763
3764   case 146:
3765 #line 1525 "gram.y"
3766     {
3767                 /* user-specified tablature */
3768                 asgn_stafflines(yyvsp[-1].intval, NO, Currstruct_p);
3769         }
3770     break;
3771
3772   case 147:
3773 #line 1532 "gram.y"
3774     {
3775                 yyval.intval = 1;
3776         }
3777     break;
3778
3779   case 148:
3780 #line 1538 "gram.y"
3781     {
3782                 /* count up the number of strings */
3783                 yyval.intval = yyvsp[-1].intval + 1;
3784         }
3785     break;
3786
3787   case 149:
3788 #line 1544 "gram.y"
3789     {
3790                 /* save info about this tablature string */
3791                 if (Currstruct_p != 0) {
3792                         add_tab_string_info(yyvsp[-3].intval, yyvsp[-2].intval, yyvsp[-1].intval, yyvsp[0].intval, Currstruct_p->u.ssv_p);
3793                 }
3794         }
3795     break;
3796
3797   case 150:
3798 #line 1552 "gram.y"
3799     {
3800                 yyval.intval = 0;
3801         }
3802     break;
3803
3804   case 151:
3805 #line 1558 "gram.y"
3806     {
3807                 if (yyvsp[0].intval != '&' && yyvsp[0].intval != '#') {
3808                         yyerror("accidental on string can only be & or #");
3809                 }
3810         }
3811     break;
3812
3813   case 152:
3814 #line 1565 "gram.y"
3815     {
3816                 /* no ticks */
3817                 yyval.intval = 0;
3818         }
3819     break;
3820
3821   case 153:
3822 #line 1572 "gram.y"
3823     {
3824                 /* limit number of ticks. Has to match the number of bits
3825                  * used by TMP_NTICKS in grpsyl.c */
3826                 if (yyvsp[0].intval > MAXTICKS) {
3827                         l_yyerror(Curr_filename, yylineno,
3828                                 "too many ' marks (%d max)", MAXTICKS);
3829                         yyvsp[0].intval = MAXTICKS;
3830                 }
3831         }
3832     break;
3833
3834   case 154:
3835 #line 1583 "gram.y"
3836     {
3837                 /* only valid letter is y */
3838                 if (*yytext != 'y') {
3839                         yyerror("flag value must be y or n");
3840                 }
3841                 yyval.intval = YES;
3842         }
3843     break;
3844
3845   case 155:
3846 #line 1593 "gram.y"
3847     {
3848                 yyval.intval = NO;
3849         }
3850     break;
3851
3852   case 156:
3853 #line 1598 "gram.y"
3854     {
3855                 if (Currstruct_p == 0) {
3856                         yyerror("wrong context for setting scoresep");
3857                 }
3858                 else {
3859                         /* Assign the value of minimum vertical space
3860                          * between scores. */
3861                         assign_int(MINSCSEP, yyvsp[0].intval, Currstruct_p);
3862                 }
3863         }
3864     break;
3865
3866   case 157:
3867 #line 1610 "gram.y"
3868     {
3869                 if (Currstruct_p != 0) {
3870                         /* if user set minimum greater than default maximum,
3871                          * adjust maximum to equal the minimum
3872                          * they specified. */
3873                         if (Currstruct_p->u.ssv_p->minscsep
3874                                         > Currstruct_p->u.ssv_p->maxscsep) {
3875                                 Currstruct_p->u.ssv_p->maxscsep
3876                                         = Currstruct_p->u.ssv_p->minscsep;
3877                         }
3878                         else {
3879                                 /* fill in default */
3880                                 assign_int(MAXSCSEP, DEFMAXSCSEP, Currstruct_p);
3881                         }
3882                 }
3883         }
3884     break;
3885
3886   case 158:
3887 #line 1629 "gram.y"
3888     {
3889                 if (Currstruct_p != 0) {
3890                         if (Currstruct_p->u.ssv_p->minscsep > yyvsp[0].intval) {
3891                                 yyerror("scoresep maximum smaller than minimum");
3892                         }
3893                         assign_int(MAXSCSEP, yyvsp[0].intval, Currstruct_p);
3894                 }
3895         }
3896     break;
3897
3898   case 159:
3899 #line 1639 "gram.y"
3900     {
3901                 if (Currstruct_p == 0) {
3902                         yyerror("wrong context for setting scorepad");
3903                 }
3904                 else {
3905                         /* Assign the value of minimum vertical space
3906                          * between scores. */
3907                         assign_int(MINSCPAD, yyvsp[-1].intval * yyvsp[0].intval, Currstruct_p);
3908                 }
3909         }
3910     break;
3911
3912   case 160:
3913 #line 1652 "gram.y"
3914     {
3915                 if (Currstruct_p != 0) {
3916                         /* If user set minimum greater than default maximum,
3917                          * adjust maximum to equal the minimum
3918                          * they specified. */
3919                         if (Currstruct_p->u.ssv_p->minscpad
3920                                         > Currstruct_p->u.ssv_p->maxscpad) {
3921                                 Currstruct_p->u.ssv_p->maxscpad
3922                                         = Currstruct_p->u.ssv_p->minscpad;
3923                         }
3924                         else {
3925                                 /* fill in default */
3926                                 assign_int(MAXSCPAD, DEFMAXSCPAD, Currstruct_p);
3927                         }
3928                 }
3929         }
3930     break;
3931
3932   case 161:
3933 #line 1671 "gram.y"
3934     {
3935                 if (Currstruct_p != 0) {
3936                         if (Currstruct_p->u.ssv_p->minscpad > yyvsp[-1].intval * yyvsp[0].intval) {
3937                                 yyerror("scorepad maximum smaller than minimum");
3938                         }
3939                         assign_int(MAXSCPAD, yyvsp[-1].intval * yyvsp[0].intval, Currstruct_p);
3940                 }
3941         }
3942     break;
3943
3944   case 163:
3945 #line 1686 "gram.y"
3946     {
3947                 if (yyvsp[-1].intval == (int) 'a' && yyvsp[0].intval >= 4 && yyvsp[0].intval <= 6) {
3948                         switch (yyvsp[0].intval) {
3949                         case 4:
3950                                 yyval.intval = PS_A4;
3951                                 break;
3952                         case 5:
3953                                 yyval.intval = PS_A5;
3954                                 break;
3955                         case 6:
3956                                 yyval.intval = PS_A6;
3957                                 break;
3958                         default:
3959                                 pfatal("impossible pagesize");
3960                                 break;
3961                         }
3962                 }
3963                 else {
3964                         yyerror("unsupported pagesize");
3965                 }
3966         }
3967     break;
3968
3969   case 164:
3970 #line 1711 "gram.y"
3971     {
3972                 yyval.intval = 0;
3973         }
3974     break;
3975
3976   case 165:
3977 #line 1717 "gram.y"
3978     {
3979                 yyval.intval = (yyvsp[0].intval == O_PORTRAIT ? 0 : 1);
3980         }
3981     break;
3982
3983   case 166:
3984 #line 1724 "gram.y"
3985     {
3986                 assign_vcombine(VC_NOOVERLAP, Currstruct_p);
3987         }
3988     break;
3989
3990   case 167:
3991 #line 1730 "gram.y"
3992     {
3993                 assign_vcombine(yyvsp[0].intval, Currstruct_p);
3994                 Defining_multiple = NO;
3995         }
3996     break;
3997
3998   case 168:
3999 #line 1738 "gram.y"
4000     {
4001                 yyval.intval = VC_NOOVERLAP;
4002         }
4003     break;
4004
4005   case 169:
4006 #line 1744 "gram.y"
4007     {
4008                 yyval.intval = yyvsp[0].intval;
4009         }
4010     break;
4011
4012   case 170:
4013 #line 1751 "gram.y"
4014     {
4015                 yyval.intval = yyvsp[0].intval;
4016         }
4017     break;
4018
4019   case 171:
4020 #line 1757 "gram.y"
4021     {
4022                 if (yyvsp[0].intval != C_TOP) {
4023                         l_yyerror(Curr_filename, yylineno,
4024                                         "%s not valid here", yytext);
4025                 }
4026                 yyval.intval = ENDING_TOP;
4027         }
4028     break;
4029
4030   case 172:
4031 #line 1766 "gram.y"
4032     {
4033                 yyval.intval = 1;
4034         }
4035     break;
4036
4037   case 173:
4038 #line 1772 "gram.y"
4039     {
4040                 yyval.intval = -1;
4041         }
4042     break;
4043
4044   case 174:
4045 #line 1777 "gram.y"
4046     {
4047                 yyval.intval = NO;
4048         }
4049     break;
4050
4051   case 175:
4052 #line 1783 "gram.y"
4053     {
4054                 switch (yyvsp[0].intval) {
4055                 case MINOR:
4056                         yyval.intval = YES;
4057                         break;
4058                 case MAJOR:
4059                         yyval.intval = NO;
4060                         break;
4061                 default:
4062                         yyval.intval = NO;
4063                         yyerror("must be major or minor");
4064                         break;
4065                 }
4066         }
4067     break;
4068
4069   case 176:
4070 #line 1799 "gram.y"
4071     {
4072                 yyval.intval = P_LINE;
4073         }
4074     break;
4075
4076   case 177:
4077 #line 1805 "gram.y"
4078     {
4079                 yyval.intval = P_ALTPEDSTAR;
4080         }
4081     break;
4082
4083   case 178:
4084 #line 1811 "gram.y"
4085     {
4086                 yyval.intval = P_PEDSTAR;
4087         }
4088     break;
4089
4090   case 180:
4091 #line 1819 "gram.y"
4092     {
4093         }
4094     break;
4095
4096   case 181:
4097 #line 1823 "gram.y"
4098     {
4099                 if (yyvsp[0].intval == FONT_UNKNOWN) {
4100                         yyvsp[0].intval = Curr_font;
4101                 }
4102                 if (yyvsp[-1].intval == FAMILY_DFLT) {
4103                         /* user didn't specify a family. Use the current
4104                          * family, unless we don't have one yet, in which
4105                          * case look it up */
4106                         if (Curr_family == FAMILY_DFLT) {
4107                                 Curr_family = Score.fontfamily;
4108                         }
4109                         Titlefont =  Curr_family + yyvsp[0].intval;
4110                 }
4111                 else {
4112                         Titlefont = yyvsp[-1].intval + yyvsp[0].intval;
4113                 }
4114         }
4115     break;
4116
4117   case 182:
4118 #line 1842 "gram.y"
4119     {
4120                 yyval.intval = FONT_UNKNOWN;
4121         }
4122     break;
4123
4124   case 183:
4125 #line 1848 "gram.y"
4126     {
4127                 yyval.intval = yyvsp[0].intval;
4128         }
4129     break;
4130
4131   case 184:
4132 #line 1853 "gram.y"
4133     {
4134                 yyval.intval = FAMILY_DFLT;
4135         }
4136     break;
4137
4138   case 185:
4139 #line 1858 "gram.y"
4140     {
4141                 yyval.intval = yyvsp[0].intval;
4142         }
4143     break;
4144
4145   case 186:
4146 #line 1863 "gram.y"
4147     {
4148                 Titlesize = Curr_size;
4149         }
4150     break;
4151
4152   case 187:
4153 #line 1869 "gram.y"
4154     {
4155                 Titlesize = yyvsp[-1].intval;
4156         }
4157     break;
4158
4159   case 188:
4160 #line 1875 "gram.y"
4161     {
4162                 Extra = extra_needed(Titlefont, Titlesize, yyvsp[0].stringval);
4163                 proc_printcmd(J_CENTER, (struct INPCOORD *) 0, yyvsp[0].stringval,
4164                                 Titlefont, Titlesize, YES, NO, Extra);
4165         }
4166     break;
4167
4168   case 189:
4169 #line 1883 "gram.y"
4170     {
4171                 double tmp_extra;
4172
4173                 /* if one is taller than the default for the font/size,
4174                  * figure out how much more to add on */
4175                 /* can't use MAX passing extra_needed() as arguments because
4176                  * it would get executed multiple times, which is a problem */
4177                 Extra = extra_needed(Titlefont, Titlesize, yyvsp[-1].stringval);
4178                 tmp_extra = extra_needed(Titlefont, Titlesize, yyvsp[0].stringval);
4179                 Extra = MAX(Extra, tmp_extra);
4180
4181
4182                 proc_printcmd(J_LEFT, (struct INPCOORD *) 0, yyvsp[-1].stringval,
4183                                 Titlefont, Titlesize, YES, NO, Extra);
4184                 proc_printcmd(J_RIGHT, (struct INPCOORD *) 0, yyvsp[0].stringval,
4185                                 Titlefont, Titlesize, NO, NO, (double) 0.0);
4186         }
4187     break;
4188
4189   case 190:
4190 #line 1903 "gram.y"
4191     {
4192                 double tmp_extra;
4193
4194                 Extra = extra_needed(Titlefont, Titlesize, yyvsp[-2].stringval);
4195                 tmp_extra = extra_needed(Titlefont, Titlesize, yyvsp[-1].stringval);
4196                 Extra = MAX(Extra, tmp_extra);
4197                 tmp_extra = extra_needed(Titlefont, Titlesize, yyvsp[0].stringval);
4198                 Extra = MAX(Extra, tmp_extra);
4199
4200                 proc_printcmd(J_LEFT, (struct INPCOORD *) 0, yyvsp[-2].stringval,
4201                                 Titlefont, Titlesize, YES, NO, Extra);
4202                 proc_printcmd(J_CENTER, (struct INPCOORD *) 0, yyvsp[-1].stringval,
4203                                 Titlefont, Titlesize, NO, NO, (double) 0.0);
4204                 proc_printcmd(J_RIGHT, (struct INPCOORD *) 0, yyvsp[0].stringval,
4205                                 Titlefont, Titlesize, NO, NO, (double) 0.0);
4206         }
4207     break;
4208
4209   case 191:
4210 #line 1921 "gram.y"
4211     {
4212                 char *p;                /* pointer through the string */
4213                 int backslash_count;    /* how many backslashes in a row */
4214                 int font, size;         /* at end of \n-delimited segment */
4215                 char *string_start;     /* where current segment begins */
4216
4217                 /* Convert unescaped input newlines to spaces.
4218                  * The +2 in the 'for' initialization is to skip font/size.
4219                  */
4220                 backslash_count = 0;
4221                 string_start = yyvsp[-2].stringval;
4222                 /* If we are running on a file using \r or \r\n for
4223                  * line separator, normalize to \n instead */
4224                 for (p = string_start + 2; *p != 0; p++) {
4225                         if (*p == '\r') {
4226                                 if ( *(p+1) != '\n') {
4227                                         /* \r by itself. Use \n instead */
4228                                         *p = '\n';
4229                                 }
4230                                 else {
4231                                         /* delete the \r */
4232                                         char *src, *dest;
4233                                         for (src = p + 1, dest = p;  ; src++, dest++) { 
4234                                                 *dest = *src;
4235                                                 if (*src == '\0') {
4236                                                         break;
4237                                                 }
4238                                         }
4239                                 }
4240                         }
4241                 }
4242
4243                 font = Titlefont;
4244                 size = Titlesize;
4245                 for (p = string_start + 2; *p != 0; p++) {
4246                         /* Real newlines not preceeded by an odd number
4247                          * of backslashes are converted to spaces. */
4248                         if (*p == '\n' && (backslash_count & 0x1) == 0) {
4249                                 *p = ' ';
4250                         }
4251
4252                         /* Count up number of consecutive backslashes.
4253                          * Also, if user explicitly uses \n, split into
4254                          * a new paragraph
4255                          */
4256                         if (*p == '\\') {
4257                                 backslash_count++;
4258                                 if (((backslash_count & 0x1) == 1)
4259                                                 && ( *(p+1) == 'n') ) {
4260                                         /* Need to split.
4261                                          * Terminate the current string
4262                                          * where we are in it, and process it,
4263                                          * then arrange to continue processing
4264                                          * on the rest of the string.
4265                                          */
4266                                         *p = '\0';
4267                                         (void) fix_string(string_start,
4268                                                 font, size,
4269                                                 Curr_filename, yylineno);
4270                                         proc_printcmd(yyvsp[-6].intval, (struct INPCOORD*) 0,
4271                                                 string_start, font, size,
4272                                                 YES, NO, 0.0);
4273
4274                                         /* The user could change font/size
4275                                          * in mid-string with \f() and/or \s().
4276                                          * so we have to determine what they
4277                                          * are at the end of the current segment
4278                                          * and use that for making the copy
4279                                          * of the remainder of the string.
4280                                          * The original copy of the remainder
4281                                          * of the string gets "memory leaked,"
4282                                          * but this is a rare case, so not
4283                                          * worth worrying about.
4284                                          */
4285                                         end_fontsize(string_start, &font, &size);
4286                                         string_start = copy_string(p+2, font, size);
4287                                         p = string_start + 2;
4288                                 }
4289                         }
4290                         else {
4291                                 backslash_count = 0;
4292                         }
4293                 }
4294                 (void) fix_string(string_start, font, size,
4295                                         Curr_filename, yylineno);
4296                 proc_printcmd(yyvsp[-6].intval, (struct INPCOORD*) 0, string_start,
4297                                         font, size, YES, NO, 0.0);
4298         }
4299     break;
4300
4301   case 192:
4302 #line 2012 "gram.y"
4303     {
4304                 /* Use same paragraph time as last time (or default if
4305                  * this is the first paragraph ever in this song.) */
4306                 yyval.intval = Curr_paratype;
4307         }
4308     break;
4309
4310   case 193:
4311 #line 2020 "gram.y"
4312     {
4313                 Curr_paratype = yyvsp[0].intval;
4314                 yyval.intval = yyvsp[0].intval;
4315         }
4316     break;
4317
4318   case 222:
4319 #line 2111 "gram.y"
4320     {
4321                 /* strip the quotes from the string and make a copy for later use */
4322                 if (Curr_family == FAMILY_DFLT) {
4323                         Curr_family = Score.fontfamily;
4324                 }
4325                 yyval.stringval = copy_string(stripquotes(yytext), Curr_family + Curr_font,
4326                                                                 Curr_size);
4327         }
4328     break;
4329
4330   case 223:
4331 #line 2122 "gram.y"
4332     {
4333                 char *old_string;
4334
4335                 /* append new string part to existing part */
4336                 old_string = yyvsp[-2].stringval;
4337                 /* new string part has quotes, so subtract 2 from needed length,
4338                  * but need space for null, so overall need 1 less. */
4339                 MALLOCA(char, yyval.stringval, strlen(old_string) + strlen(yytext) - 1);
4340                 sprintf(yyval.stringval, "%s%s", old_string, stripquotes(yytext));
4341                 FREE(old_string);
4342         }
4343     break;
4344
4345   case 224:
4346 #line 2135 "gram.y"
4347     {
4348                 /* Here's the deal: the staff/voice specification
4349                  * could be lists of staff ranges and/or voices.
4350                  * We need a separate copy of the groupinfo
4351                  * for each staff/voice. So as we parse the sv_spec,
4352                  * we remember which staffs and voices are specified,
4353                  * and keep a pointer to the first STAFF in the measure.
4354                  * Then after collecting the groupinfo,
4355                  * we make copies of the group info for each staff/voice given.
4356                  * It has to be copies rather than just a pointer to the
4357                  * same stuff, because the coordinates will be different
4358                  * for each staff/voice. */
4359
4360                 /* attach the groupinfo to each of the STAFF structs */
4361                 link_groups();
4362         }
4363     break;
4364
4365   case 225:
4366 #line 2154 "gram.y"
4367     {
4368                 add_multirest(yyvsp[-1].intval);
4369                 /* If there are alternating time signatures, figure out
4370                  * which one should be in effect at the end of the multirest */
4371                 if (Alt_timesig_list != 0) {
4372                         int m;
4373
4374                         /* The Next_alt_timesig is already pointing to
4375                          * the value for after the first measure in the
4376                          * multirest, so have to subtract 1 here */
4377                         for (m = 0; m < yyvsp[-1].intval - 1; m++) {
4378                                 if (Next_alt_timesig == 0) {
4379                                         /* Shouldn't really ever get here,
4380                                          * since other code should do the
4381                                          * wrap-around, but just in case... */
4382                                         Next_alt_timesig = Alt_timesig_list;
4383                                         continue;
4384                                 }
4385                                 do {
4386                                         Next_alt_timesig++;
4387                                         if (*Next_alt_timesig == TSR_END) {
4388                                                 Next_alt_timesig = Alt_timesig_list;
4389                                                 break;
4390                                         }
4391                                 } while (*Next_alt_timesig != TSR_ALTERNATING);
4392                         }
4393                         if (*Next_alt_timesig == TSR_ALTERNATING) {
4394                                 Next_alt_timesig++;
4395                         }
4396                 }
4397                 Currstruct_p = (struct MAINLL *) 0;
4398         }
4399     break;
4400
4401   case 226:
4402 #line 2189 "gram.y"
4403     {
4404                 free_staffrange();
4405         }
4406     break;
4407
4408   case 227:
4409 #line 2194 "gram.y"
4410     {
4411                 begin_range(PL_UNKNOWN);
4412         }
4413     break;
4414
4415   case 228:
4416 #line 2199 "gram.y"
4417     {
4418                 Chord_at_a_time = NO;
4419         }
4420     break;
4421
4422   case 229:
4423 #line 2205 "gram.y"
4424     {
4425                 Chord_at_a_time = YES;
4426         }
4427     break;
4428
4429   case 233:
4430 #line 2220 "gram.y"
4431     {
4432                 begin_map();
4433         }
4434     break;
4435
4436   case 234:
4437 #line 2225 "gram.y"
4438     {
4439                 end_map();
4440         }
4441     break;
4442
4443   case 235:
4444 #line 2230 "gram.y"
4445     {
4446                 map_item();
4447         }
4448     break;
4449
4450   case 236:
4451 #line 2236 "gram.y"
4452     {
4453                 map_item();
4454                 Defining_multiple = YES;
4455         }
4456     break;
4457
4458   case 237:
4459 #line 2242 "gram.y"
4460     {
4461                 /* initialize grpsyl info */
4462                 Curr_grpsyl_p = Last_grpsyl_p = (struct GRPSYL *) 0;
4463         }
4464     break;
4465
4466   case 239:
4467 #line 2252 "gram.y"
4468     {
4469                 /* prepare for a new set of ranges */
4470                 begin_range(Place);
4471                 Defining_multiple = YES;
4472         }
4473     break;
4474
4475   case 240:
4476 #line 2259 "gram.y"
4477     {
4478                 /* data is for staff with only one voice */
4479                 save_vno_range(1, 1);
4480                 add_to_sv_list();
4481         }
4482     break;
4483
4484   case 241:
4485 #line 2267 "gram.y"
4486     {
4487                 if (yyvsp[0].intval == YES) {
4488                         add_to_sv_list();
4489                 }
4490         }
4491     break;
4492
4493   case 242:
4494 #line 2276 "gram.y"
4495     {
4496                 /* set flag as to whether we are processing tab staff
4497                  * information or normal staff info */
4498                 Doing_tab_staff = is_tab_range();
4499         }
4500     break;
4501
4502   case 244:
4503 #line 2286 "gram.y"
4504     {
4505                 /* several staffs have the same note data */
4506                 Defining_multiple = YES;
4507         }
4508     break;
4509
4510   case 245:
4511 #line 2292 "gram.y"
4512     {
4513                 /* remember which staffs we are currently getting data for */
4514                 /* if only a single number, not a range, staff_range will be
4515                  * 0, so use staffnum as high and low of range */
4516                 save_staff_range(yyvsp[-1].intval, (yyvsp[0].intval == 0 ? yyvsp[-1].intval : yyvsp[0].intval));
4517         }
4518     break;
4519
4520   case 246:
4521 #line 2300 "gram.y"
4522     {
4523                 /* empty - no range, just a single number */
4524                 yyval.intval = 0;
4525         }
4526     break;
4527
4528   case 247:
4529 #line 2307 "gram.y"
4530     {
4531                 Defining_multiple = YES;
4532                 yyval.intval = yyvsp[0].intval;
4533                 if (yyvsp[0].intval == 0) {
4534                         yyerror("staff of 0 is illegal");
4535                 }
4536         }
4537     break;
4538
4539   case 248:
4540 #line 2317 "gram.y"
4541     {
4542                 /* note data applies to a single voice */
4543                 if (rangecheck(yyvsp[-1].intval, MINVOICES, MAXVOICES, "voice") == YES) {
4544                         save_vno_range(yyvsp[-1].intval, yyvsp[-1].intval);
4545                         yyval.intval = YES;
4546                 }
4547                 else {
4548                         yyval.intval = NO;
4549                 }
4550         }
4551     break;
4552
4553   case 249:
4554 #line 2330 "gram.y"
4555     {
4556                 /* note data applies to range of voices */
4557                 if (rangecheck(yyvsp[-3].intval, MINVOICES, MAXVOICES, "voice") == YES &&
4558                                 rangecheck(yyvsp[-1].intval, MINVOICES, MAXVOICES, "voice") == YES) {
4559                         if (yyvsp[-1].intval < yyvsp[-3].intval) {
4560                                 l_yyerror(Curr_filename, yylineno,
4561                                         "end of voice range is smaller than beginning");
4562                                 yyval.intval = NO;
4563                         }
4564                         else {
4565                                 save_vno_range(yyvsp[-3].intval, yyvsp[-1].intval);
4566                                 Defining_multiple = YES;
4567                                 yyval.intval = YES;
4568                         }
4569                 }
4570                 else {
4571                         yyval.intval = NO;
4572                 }
4573         }
4574     break;
4575
4576   case 251:
4577 #line 2355 "gram.y"
4578     {
4579                 Defining_multiple = YES;
4580         }
4581     break;
4582
4583   case 255:
4584 #line 2370 "gram.y"
4585     {
4586                 /* Associate any TIMEDSSVs with this group */
4587                 if (Curr_tssv_p != 0) {
4588                         tssv_setgrpsyl(Curr_grpsyl_p);
4589                         Curr_tssv_p = 0;
4590                 }
4591
4592                 /* if no custom beaming indicated, fill in based on previous. */
4593                 if ( Curr_grpsyl_p->beamloc == NOITEM) {
4594                         setbeamloc(Curr_grpsyl_p, Last_grpsyl_p);
4595                 }
4596
4597                 /* later we check that if there is an 'm', it is
4598                  * the only thing in the measure */
4599
4600                 link_notegroup(Curr_grpsyl_p, Last_grpsyl_p);
4601                 Curr_marklist = 0;
4602                 /* Save pointer to this group, in case there are additive
4603                  * times, and the next group gets its time value from this
4604                  * group. In that case, we need this group, not the last one
4605                  * of the added groups. */
4606                 Prev_grpsyl_p = Curr_grpsyl_p;
4607                 /* Add groups if there were additive time values. */
4608                 if (Extra_time_p != 0) {
4609                         Curr_grpsyl_p = expandgrp(Curr_grpsyl_p, Extra_time_p);
4610                         /* If there was a custom beam ebm on something with
4611                          * additive time, we need make sure ENDITEM is on only
4612                          * the last of the expanded groups. */
4613                         if (Curr_grpsyl_p != Prev_grpsyl_p
4614                                         && Prev_grpsyl_p->beamloc == ENDITEM) {
4615                                 struct GRPSYL *g_p;
4616                                 for (g_p = Prev_grpsyl_p; g_p != Curr_grpsyl_p;
4617                                                         g_p = g_p->next) {
4618                                         g_p->beamloc = INITEM;
4619                                 }
4620                                 Curr_grpsyl_p->beamloc = ENDITEM;
4621                         }
4622                         Last_grpsyl_p = Curr_grpsyl_p->prev;
4623                 }
4624                 Curr_timelist_p = 0;
4625         }
4626     break;
4627
4628   case 260:
4629 #line 2428 "gram.y"
4630     {
4631                 if (Chord_at_a_time == YES) {
4632                         yyerror("mid-measure changes not allowed on chord-at-a-time input");
4633                 }
4634         }
4635     break;
4636
4637   case 261:
4638 #line 2437 "gram.y"
4639     {
4640                 Curr_tssv_p = tssv_create(C_SCORE);
4641         }
4642     break;
4643
4644   case 262:
4645 #line 2443 "gram.y"
4646     {
4647                 Curr_tssv_p = tssv_create(C_STAFF);
4648         }
4649     break;
4650
4651   case 263:
4652 #line 2449 "gram.y"
4653     {
4654                 Curr_tssv_p = tssv_create(C_VOICE);
4655         }
4656     break;
4657
4658   case 266:
4659 #line 2463 "gram.y"
4660     {
4661                 if (Curr_grpsyl_p != 0 && Curr_grpsyl_p->grpsyl == GS_GROUP
4662                                 && Curr_grpsyl_p->grpvalue == GV_ZERO) {
4663                         yyerror("mid-measure clef change not allowed after grace note\n");
4664                 }
4665                 tssv_update(Curr_tssv_p, yyvsp[-2].intval, yyvsp[0].intval);
4666         }
4667     break;
4668
4669   case 267:
4670 #line 2473 "gram.y"
4671     {
4672                 switch (yyvsp[-2].intval) {
4673
4674                 case DEFOCT:
4675                 case RELEASE:
4676                         tssv_update(Curr_tssv_p, yyvsp[-2].intval, yyvsp[0].intval);
4677                         break;
4678
4679                 default:
4680                         yyerror("parameter type cannot be changed mid-measure");
4681                         break;
4682                 }
4683         }
4684     break;
4685
4686   case 269:
4687 #line 2493 "gram.y"
4688     {
4689                 if (Good_till_canceled == NO) {
4690                         /* use default attributes */
4691                         Curr_grpsyl_p->grpvalue = GV_NORMAL;
4692                         Curr_grpsyl_p->grpsize = GS_NORMAL;
4693                         Curr_grpsyl_p->headshape = HS_UNKNOWN;
4694                 }
4695                 else {
4696                         /* re-use previous style */
4697                         copy_attributes(Curr_grpsyl_p, Last_grpsyl_p);
4698                 }
4699         }
4700     break;
4701
4702   case 270:
4703 #line 2508 "gram.y"
4704     {
4705                 Good_till_canceled = NO;
4706         }
4707     break;
4708
4709   case 271:
4710 #line 2514 "gram.y"
4711     {
4712         }
4713     break;
4714
4715   case 272:
4716 #line 2518 "gram.y"
4717     {
4718                 Good_till_canceled = NO;
4719         }
4720     break;
4721
4722   case 273:
4723 #line 2524 "gram.y"
4724     {
4725                 Good_till_canceled = YES;
4726         }
4727     break;
4728
4729   case 274:
4730 #line 2529 "gram.y"
4731     {
4732         }
4733     break;
4734
4735   case 275:
4736 #line 2534 "gram.y"
4737     {
4738                 if (Good_till_canceled == YES) {
4739                         yyerror("can't use ... and more than one [] on same chord");
4740                 }
4741         }
4742     break;
4743
4744   case 276:
4745 #line 2541 "gram.y"
4746     {
4747                 /* NULL token to cause allocation of a GRPSYL struct */
4748                 Last_grpsyl_p = Curr_grpsyl_p;
4749                 Curr_grpsyl_p = newGRPSYL(GS_GROUP);
4750         }
4751     break;
4752
4753   case 277:
4754 #line 2548 "gram.y"
4755     {
4756                 /* an empty marklist means we should use
4757                  * the same attributes as the last time */
4758                 copy_attributes(Curr_grpsyl_p, Last_grpsyl_p);
4759         }
4760     break;
4761
4762   case 281:
4763 #line 2565 "gram.y"
4764     {
4765                 Curr_grpsyl_p->nwith = (short) Item_count;
4766                 Curr_grpsyl_p->withlist = Curr_marklist;
4767         }
4768     break;
4769
4770   case 285:
4771 #line 2581 "gram.y"
4772     {
4773                 if (Curr_grpsyl_p->stemdir != UNKNOWN &&
4774                                         Curr_grpsyl_p->stemdir != yyvsp[0].intval) {
4775                         l_warning(Curr_filename, yylineno,
4776                                 "both stem directions specified; using last instance");
4777                 }
4778                 if (Doing_tab_staff == YES) {
4779                         yyerror("stem direction specification not allowed on tab staff");
4780                 }
4781                 else {
4782                         Curr_grpsyl_p->stemdir = yyvsp[0].intval;
4783                 }
4784         }
4785     break;
4786
4787   case 286:
4788 #line 2597 "gram.y"
4789     {
4790                 if (yyvsp[-2].intval != DIST) {
4791                         yyerror("unexpected parameter name");
4792                 }
4793                 else {
4794                         if (Curr_grpsyl_p->restdist != NORESTDIST &&
4795                                         Curr_grpsyl_p->restdist != yyvsp[-1].intval * yyvsp[0].intval) {
4796                                 l_warning(Curr_filename, yylineno,
4797                                                 "more than one dist value specified; using last instance");
4798                         }
4799                         Curr_grpsyl_p->restdist = yyvsp[-1].intval * yyvsp[0].intval;
4800                 }
4801         }
4802     break;
4803
4804   case 287:
4805 #line 2613 "gram.y"
4806     {
4807                 if (Curr_grpsyl_p->ho_usage != HO_NONE &&
4808                                 Curr_grpsyl_p->ho_usage != yyvsp[0].intval) {
4809                         l_warning(Curr_filename, yylineno,
4810                                 "More than one ho type specified; last instance used");
4811                 }
4812                 Curr_grpsyl_p->ho_usage = yyvsp[0].intval;
4813         }
4814     break;
4815
4816   case 288:
4817 #line 2624 "gram.y"
4818     {
4819                 if (Curr_grpsyl_p != 0) {
4820                         if (Curr_grpsyl_p->headshape != HS_UNKNOWN) {
4821                                 l_warning(Curr_filename, yylineno,
4822                                         "multiple head shapes specified, using last");
4823                         }
4824                         /* +2 to skip past extraneous font/size */
4825                         if (Doing_tab_staff == YES && strcmp(yyvsp[0].stringval + 2, "allx") != 0) {
4826                                 yyerror("allx is the only headshape allowed on tab staffs");
4827                         }
4828                         if ((Curr_grpsyl_p->headshape = get_shape_num(yyvsp[0].stringval + 2))
4829                                         == HS_UNKNOWN) {
4830                                 l_yyerror(Curr_filename, yylineno,
4831                                         "'%s' is not a valid head shape name",
4832                                         ascii_str(yyvsp[0].stringval, YES, NO, TM_NONE));
4833                         }
4834                 }
4835                 else {
4836                         pfatal("Curr_grpsyl_p was null for setting hs");
4837                 }
4838                 /* We don't need the name anymore; we have its corresponding
4839                  * number that we use internally. */
4840                 FREE(yyvsp[0].stringval);
4841         }
4842     break;
4843
4844   case 289:
4845 #line 2651 "gram.y"
4846     {
4847                 if (Curr_grpsyl_p->stemlen != STEMLEN_UNKNOWN &&
4848                                 fabs(Curr_grpsyl_p->stemlen - yyvsp[0].floatval * STEPSIZE) > 0.0001) {
4849                         l_warning(Curr_filename, yylineno,
4850                                 "more than one len specified; using last instance");
4851                 }
4852                 Curr_grpsyl_p->stemlen = yyvsp[0].floatval * STEPSIZE;
4853         }
4854     break;
4855
4856   case 290:
4857 #line 2662 "gram.y"
4858     {
4859                 if (yyvsp[0].intval <= 0) {
4860                         yyerror("slash number must be > 0");
4861                 }
4862                 else if (yyvsp[0].intval > 8) {
4863                         /* we decided 8 slashes would be at least 256th note
4864                          * or shorter, and 256th is the shortest note we
4865                          * support, 8 slashes is plenty */
4866                         yyerror("slash number must be <= 8");
4867                 }
4868                 if (Curr_grpsyl_p->slash_alt > 0 &&
4869                                         Curr_grpsyl_p->slash_alt != yyvsp[0].intval) {
4870                         l_warning(Curr_filename, yylineno,
4871                                 "more than one slash value specified; using last instance");
4872                 }
4873                 if (Curr_grpsyl_p->slash_alt < 0) {
4874                         yyerror("only one slash/alt allowed per group");
4875                 }
4876                 Curr_grpsyl_p->slash_alt = yyvsp[0].intval;
4877         }
4878     break;
4879
4880   case 291:
4881 #line 2685 "gram.y"
4882     {
4883                 yyval.intval = HO_RIGHT;
4884         }
4885     break;
4886
4887   case 292:
4888 #line 2691 "gram.y"
4889     {
4890                 yyval.intval = HO_LEFT;
4891         }
4892     break;
4893
4894   case 293:
4895 #line 2697 "gram.y"
4896     {
4897                 /* We want to silently accept identical values specified
4898                  * more than once, so use fuzzy compare to deal with roundoff */
4899                 if (Curr_grpsyl_p->ho_usage == HO_VALUE &&
4900                                 fabs(Curr_grpsyl_p->ho_value - yyvsp[-1].intval * yyvsp[0].floatval) > 0.0001) {
4901                         l_warning(Curr_filename, yylineno,
4902                                 "More than one ho value specified; last instance used");
4903                 }
4904                 Curr_grpsyl_p->ho_value = yyvsp[-1].intval * yyvsp[0].floatval;
4905                 yyval.intval = HO_VALUE;
4906         }
4907     break;
4908
4909   case 294:
4910 #line 2711 "gram.y"
4911     {
4912                 yyval.intval = 1;
4913         }
4914     break;
4915
4916   case 295:
4917 #line 2717 "gram.y"
4918     {
4919                 yyval.intval = yyvsp[0].intval;
4920         }
4921     break;
4922
4923   case 301:
4924 #line 2739 "gram.y"
4925     {
4926                 yyvsp[0].floatval *= yyvsp[-1].intval;
4927                 if (fabs(Curr_grpsyl_p->beamslope - NOBEAMANGLE) > 0.01) {
4928                         l_warning(Curr_filename, yylineno,
4929                                 "multiple slope values specified; using last one");
4930                 }
4931                 if (frangecheck(yyvsp[0].floatval, MINBEAMANGLE, MAXBEAMANGLE, "slope") == YES) {
4932                         Curr_grpsyl_p->beamslope = yyvsp[0].floatval;
4933                 }
4934         }
4935     break;
4936
4937   case 302:
4938 #line 2752 "gram.y"
4939     {
4940                 if (yyvsp[0].intval <= 0) {
4941                         yyerror("alt number must be > 0");
4942                 }
4943                 if (Curr_grpsyl_p->slash_alt != 0) {
4944                         yyerror("only one slash/alt allowed per group");
4945                 }
4946                 if (Doing_tab_staff == YES) {
4947                         yyerror("alt not allowed on tablature staff");
4948                 }
4949                 /* Keep small enough that 1 shifted left by this still
4950                  * fits in a 16-bit int. Should be more than enough! */
4951                 if (yyvsp[0].intval > 15) {
4952                         warning("alt value too large");
4953                         yyvsp[0].intval = 15;
4954                 }
4955                 Curr_grpsyl_p->slash_alt = -yyvsp[0].intval;
4956         }
4957     break;
4958
4959   case 303:
4960 #line 2773 "gram.y"
4961     {
4962                 int n;
4963
4964                 /* add a slur to each note in the chord. Don't know
4965                  * which pitch to slur to yet, just that it will be to
4966                  * the "matching" note in the next chord, so use
4967                  * special magic pitch of 'M' to convey this */
4968                 for (n = 0; n < Curr_grpsyl_p->nnotes; n++) {
4969                         add_slurto(Curr_grpsyl_p, 'M', USE_DFLT_OCTAVE, n, yyvsp[-1].intval);
4970                         set_slurdir(Curr_grpsyl_p, -1, yyvsp[0].intval);
4971                 }
4972         }
4973     break;
4974
4975   case 304:
4976 #line 2788 "gram.y"
4977     {
4978                 int n;
4979
4980                 Curr_grpsyl_p->tie = YES;
4981                 for (n = 0; n < Curr_grpsyl_p->nnotes; n++) {
4982                         Curr_grpsyl_p->notelist[n].tie = YES;
4983                         Curr_grpsyl_p->notelist[n].tiestyle = yyvsp[-1].intval;
4984                         Curr_grpsyl_p->notelist[n].tiedir = yyvsp[0].intval;
4985                 }
4986         }
4987     break;
4988
4989   case 305:
4990 #line 2800 "gram.y"
4991     {
4992                 if (Curr_marklist == 0) {
4993                         /* allocate space for a list of marks */
4994                         MALLOCA(char *, Curr_marklist, ITEMS);
4995                         Item_count = 0;
4996                         Max_items = ITEMS;
4997                 }
4998         }
4999     break;
5000
5001   case 306:
5002 #line 2810 "gram.y"
5003     {
5004                 yyval.intval = UNKNOWN;
5005         }
5006     break;
5007
5008   case 307:
5009 #line 2816 "gram.y"
5010     {
5011                 yyval.intval = yyvsp[0].intval;
5012         }
5013     break;
5014
5015   case 310:
5016 #line 2828 "gram.y"
5017     {
5018                 /* if too many items, get some more space */
5019                 if (Item_count >= Max_items) {
5020                         Max_items += ITEMS;
5021                         if ((Curr_marklist = (char **) realloc(Curr_marklist,
5022                                                 Max_items * sizeof(char **)))
5023                                                 == (char **) 0) {
5024                                 l_no_mem(__FILE__, __LINE__);
5025                         }
5026                 }
5027                 Curr_marklist[Item_count++] = yyvsp[0].stringval;
5028         }
5029     break;
5030
5031   case 311:
5032 #line 2842 "gram.y"
5033     {
5034                 MALLOCA(char, yyval.stringval, strlen(yyvsp[0].stringval) + 3);
5035                 yyval.stringval[0] = FONT_TR;
5036                 yyval.stringval[1] = DFLT_SIZE;
5037                 sprintf(yyval.stringval + 2, yyvsp[0].stringval);
5038         }
5039     break;
5040
5041   case 313:
5042 #line 2855 "gram.y"
5043     {
5044                 yyval.stringval = (Curr_grpsyl_p->grpsize == GS_NORMAL
5045                                         ? "\\(dot)" : "\\(smdot)");
5046         }
5047     break;
5048
5049   case 314:
5050 #line 2862 "gram.y"
5051     {
5052                 yyval.stringval = (Curr_grpsyl_p->grpsize == GS_NORMAL
5053                                         ? "\\(leg)" : "\\(smleg)");
5054         }
5055     break;
5056
5057   case 315:
5058 #line 2869 "gram.y"
5059     {
5060                 yyval.stringval = (Curr_grpsyl_p->grpsize == GS_NORMAL
5061                                         ? "\\(acc_gt)" : "\\(smacc_gt)");
5062         }
5063     break;
5064
5065   case 316:
5066 #line 2876 "gram.y"
5067     {
5068                 yyval.stringval = (Curr_grpsyl_p->grpsize == GS_NORMAL
5069                                         ? "\\(acc_hat)" : "\\(smacc_hat)");
5070         }
5071     break;
5072
5073   case 317:
5074 #line 2882 "gram.y"
5075     {
5076                 if (Curr_grpsyl_p->grpvalue == GV_ZERO) {
5077                         l_warning(Curr_filename, yylineno,
5078                                 "both grace and cue specified; using last instance");
5079                 }
5080                 Curr_grpsyl_p->grpvalue = GV_NORMAL;
5081                 Curr_grpsyl_p->grpsize = GS_SMALL;
5082         }
5083     break;
5084
5085   case 318:
5086 #line 2893 "gram.y"
5087     {
5088                 if (Curr_grpsyl_p->grpsize == GS_SMALL
5089                                         && Curr_grpsyl_p->grpvalue != GV_ZERO) {
5090                         l_warning(Curr_filename, yylineno,
5091                                 "both cue and grace specified; using last instance");
5092                 }
5093
5094                 Curr_grpsyl_p->grpsize = GS_SMALL;
5095                 Curr_grpsyl_p->grpvalue = GV_ZERO;
5096         }
5097     break;
5098
5099   case 319:
5100 #line 2906 "gram.y"
5101     {
5102                 if (Curr_grpsyl_p->headshape != HS_UNKNOWN) {
5103                         l_warning(Curr_filename, yylineno,
5104                                 "diam is overriding previous headshapes specification");
5105                 }
5106                 Curr_grpsyl_p->headshape = get_shape_num("diam");
5107         }
5108     break;
5109
5110   case 320:
5111 #line 2916 "gram.y"
5112     {
5113                 if (Curr_grpsyl_p->headshape != HS_UNKNOWN) {
5114                         l_warning(Curr_filename, yylineno,
5115                                 "xnote is overriding previous headshapes specification");
5116                 }
5117                 Curr_grpsyl_p->headshape = get_shape_num(
5118                                         Doing_tab_staff == YES ? "allx" : "x");
5119         }
5120     break;
5121
5122   case 321:
5123 #line 2927 "gram.y"
5124     {
5125                 yyval.intval = UP;
5126         }
5127     break;
5128
5129   case 322:
5130 #line 2933 "gram.y"
5131     {
5132                 yyval.intval = DOWN;
5133         }
5134     break;
5135
5136   case 323:
5137 #line 2939 "gram.y"
5138     {
5139                 /* custom beaming cannot be nested */
5140                 struct GRPSYL *prev_like_gs_p;
5141                 /* Find previous group with same grace-ness. Can't use
5142                  * prevsimilar() here, since it looks at grpcont too. */
5143                 for (prev_like_gs_p = Last_grpsyl_p; prev_like_gs_p != 0 &&
5144                         prev_like_gs_p->grpvalue != Curr_grpsyl_p->grpvalue;
5145                         prev_like_gs_p = prev_like_gs_p->prev) {
5146                         ;
5147                 }
5148                 if (prev_like_gs_p != 0 &&
5149                                 ((prev_like_gs_p->beamloc == STARTITEM)
5150                                 || (prev_like_gs_p->beamloc == INITEM)) ) {
5151                         yyerror("custom beaming may not be nested");
5152                 }
5153                 /* Non-custom beaming, if any, is done later, in do_bar() */
5154                 else {
5155                         /* begin custom beaming */
5156                         Curr_grpsyl_p->beamloc = STARTITEM;
5157                         if (Curr_grpsyl_p->basictime < 8 && yyvsp[0].intval == CS_SAME) {
5158                                 yyerror("beamed notes must be 8th or shorter");
5159                         }
5160                 }
5161                 Curr_grpsyl_p->beamto = yyvsp[0].intval;
5162         }
5163     break;
5164
5165   case 324:
5166 #line 2967 "gram.y"
5167     {
5168                 Curr_grpsyl_p->breakbeam = YES;
5169         }
5170     break;
5171
5172   case 325:
5173 #line 2973 "gram.y"
5174     {
5175                 struct GRPSYL *last_nongrace_p;
5176
5177                 /* find the previous group, skipping grace groups */
5178                 for (last_nongrace_p = Last_grpsyl_p;
5179                                 last_nongrace_p != (struct GRPSYL *) 0
5180                                 && last_nongrace_p->grpvalue == GV_ZERO;
5181                                 last_nongrace_p = last_nongrace_p->prev) {
5182                         ;
5183                 }
5184
5185                 /* check that a custom beam is in progress */
5186                 if ((last_nongrace_p == (struct GRPSYL *) 0)
5187                                 || ((last_nongrace_p != (struct GRPSYL *) 0)
5188                                 && (last_nongrace_p->beamloc != STARTITEM)
5189                                 && (last_nongrace_p->beamloc != INITEM) )) {
5190                         yyerror("'ebm' unexpected: no custom beaming in progress");
5191                 }
5192                 else {
5193                         Curr_grpsyl_p->beamloc = ENDITEM;
5194                         Curr_grpsyl_p->beamto = last_nongrace_p->beamto;
5195                         if (Curr_grpsyl_p->basictime < 8
5196                                         && Last_grpsyl_p->beamto == CS_SAME) {
5197                                 yyerror("beamed notes must be 8th or shorter");
5198                         }
5199                 }
5200         }
5201     break;
5202
5203   case 326:
5204 #line 3002 "gram.y"
5205     {
5206                 /* Use the same as last time or default timeunit.
5207                  * If that involves additive time values,
5208                  * save pointer to that info in Extra_time_p for later use. */
5209                 Extra_time_p = copy_timeunit(Curr_grpsyl_p, Prev_grpsyl_p,
5210                                                 Extra_time_p);
5211         }
5212     break;
5213
5214   case 327:
5215 #line 3012 "gram.y"
5216     {
5217                 if (Curr_grpsyl_p->is_meas == YES) {
5218                         Curr_grpsyl_p->fulltime = Score.time;
5219                 }
5220                 else {
5221                         Curr_grpsyl_p->fulltime = yyvsp[0].ratval;
5222                 }
5223         }
5224     break;
5225
5226   case 328:
5227 #line 3022 "gram.y"
5228     {
5229                 yyval.intval = CS_SAME;
5230         }
5231     break;
5232
5233   case 329:
5234 #line 3028 "gram.y"
5235     {
5236                 CSBused = YES;
5237                 switch (yyvsp[0].intval) {
5238                 case PL_ABOVE:
5239                         yyval.intval = CS_ABOVE;
5240                         break;
5241                 case PL_BELOW:
5242                         yyval.intval = CS_BELOW;
5243                         break;
5244                 default:
5245                         yyerror("bm with staff must be 'above' or 'below'");
5246                         yyval.intval = CS_SAME;
5247                 }
5248         }
5249     break;
5250
5251   case 330:
5252 #line 3044 "gram.y"
5253     {
5254                 yyval.ratval.n = yyvsp[0].intval;
5255                 yyval.ratval.d = 1;
5256
5257                 /* if filling in a GRPSYL struct, need to fill in basic time,
5258                  * could also be here due to beamstyle, in which case the
5259                  * Curr_grpsyl_p will be NULL, or when getting tuplet duration,
5260                  * in which case flag will be set */
5261                 if (Curr_grpsyl_p != (struct GRPSYL *) 0
5262                                         && Getting_tup_dur == NO) {
5263                         /* If we are gathering basictime as part of a list
5264                          * of additive times, we will save the value a few
5265                          * lines down from here. But in the normal case,
5266                          * we set basictime in the current GRPSYL. */
5267                         if (Extra_time_p == 0) {
5268                                 /* 1/2 is 0 internally. 1/4 is -1 internally */
5269                                  Curr_grpsyl_p->basictime = (yyvsp[0].intval == 2 ? 0 : -1);
5270                         }
5271                 }
5272                 /* If doing additive times, need to save value. */
5273                 if (Extra_time_p != 0) {
5274                         Extra_basictime = (yyvsp[0].intval == 2 ? 0 : -1);
5275                 }
5276         }
5277     break;
5278
5279   case 331:
5280 #line 3071 "gram.y"
5281     {
5282                 /* check that a power of two from 1 to MAXBASICTIME */
5283                 if (power_of2check(yyvsp[0].intval, "note basic time value") == NO) {
5284                         /* force to a power to two, so that other code
5285                          * (like in expandgrp) that expect a sane value
5286                          * to not blow up. This may lead to a somewhat
5287                          * misleading "time does not add up to time                                      * signature message, but we don't know what
5288                          * time they really meant, and this is better
5289                          * than pfataling. */
5290                         yyvsp[0].intval = 2;
5291                 }
5292                 /* can't use rangecheck here because the error message would
5293                  * say 0 and -1 are valid times, which is only true internally--
5294                  * the user has to use 1/2, 1/4 or m. */
5295                 if (yyvsp[0].intval < MINBASICTIME || yyvsp[0].intval > MAXBASICTIME) {
5296                         l_yyerror(Curr_filename, yylineno,
5297                                 "time value must be between 1 and %d, or 1/2 or 1/4 or m",
5298                                 MAXBASICTIME);
5299                 }
5300                 yyval.ratval.n = 1;
5301                 /* avoid division by zero */
5302                 if (yyvsp[0].intval == 0) {
5303                         yyvsp[0].intval = 1;
5304                 }
5305                 yyval.ratval.d = yyvsp[0].intval;
5306                 if (Curr_grpsyl_p != (struct GRPSYL *) 0
5307                                         && Getting_tup_dur == NO) {
5308                         if (Curr_timelist_p == 0) {
5309                                 Curr_grpsyl_p->basictime = yyvsp[0].intval;
5310                         }
5311                 }
5312                 /* If doing additive times, need to save value */
5313                 if (Extra_time_p != 0) {
5314                         Extra_basictime = yyvsp[0].intval;
5315                 }
5316         }
5317     break;
5318
5319   case 332:
5320 #line 3110 "gram.y"
5321     {
5322                 free_extra_time();
5323         }
5324     break;
5325
5326   case 334:
5327 #line 3120 "gram.y"
5328     {
5329                 /* Set basictime to what we saved in basic_time_val rule,
5330                  * then calculate fulltime from that and number of dots. */
5331                 Curr_timelist_p->basictime = Extra_basictime;
5332                 Curr_timelist_p->fulltime = calcfulltime(yyvsp[-1].ratval, yyvsp[0].intval);
5333                 /* handle subtracted times by negating the fulltime */
5334                 if (yyvsp[-3].intval == -1) {
5335                         Curr_timelist_p->fulltime = rneg(Curr_timelist_p->fulltime);
5336                 }
5337         }
5338     break;
5339
5340   case 335:
5341 #line 3134 "gram.y"
5342     {
5343                 struct TIMELIST *timelist_p;
5344
5345                 MALLOC(TIMELIST, timelist_p, 1);
5346                 /* Add to end of linked list */
5347                 timelist_p->next = 0;
5348                 /* Init fulltime to something to avoid garbage if there
5349                  * in a user input error */
5350                 timelist_p->fulltime = Zero;
5351                 if (Extra_time_p == 0) {
5352                         Last_alloced_timelist_p = Extra_time_p = timelist_p;
5353                 }
5354                 else {
5355                         Curr_timelist_p->next = timelist_p;
5356                 }
5357                 /* Keep track of where to append next item to list, if any */
5358                 Curr_timelist_p = timelist_p;
5359         }
5360     break;
5361
5362   case 336:
5363 #line 3155 "gram.y"
5364     {
5365                 User_meas_time = NO;
5366         }
5367     break;
5368
5369   case 337:
5370 #line 3161 "gram.y"
5371     {
5372                 if (Curr_grpsyl_p != (struct GRPSYL *) 0
5373                                         && Getting_tup_dur == NO) {
5374                         Curr_grpsyl_p->is_meas = YES;
5375                         User_meas_time = YES;
5376                 }
5377                 else {
5378                         yyerror("'m' is not valid here");
5379                 }
5380         }
5381     break;
5382
5383   case 338:
5384 #line 3173 "gram.y"
5385     {
5386                 yyval.intval = 0;
5387         }
5388     break;
5389
5390   case 339:
5391 #line 3179 "gram.y"
5392     {
5393                 /* count up the number of dots */
5394                 yyval.intval = yyvsp[-1].intval + 1;
5395         }
5396     break;
5397
5398   case 340:
5399 #line 3185 "gram.y"
5400     {
5401                 /* We can't distinguish between the default 0.0 and
5402                  * if user explicitly sets to 0.0, so if they set to 0.0
5403                  * then to something else, we won't catch that as setting
5404                  * twice, but that shouldn't be common. Besides, if they
5405                  * expect them to be additive, adding to zero will work
5406                  * as they expect... Because of roundoff, we can't do
5407                  * exact compare for specifying the same value more than once,
5408                  * so treat as identical if pretty close. */
5409                 if (Curr_grpsyl_p->padding != 0.0 && 
5410                                 fabs(Curr_grpsyl_p->padding - (yyvsp[0].floatval * STEPSIZE))
5411                                 > 0.0001) {
5412                         l_warning(Curr_filename, yylineno,
5413                                 "padding specified more than once; using last instance");
5414                 }
5415                 Curr_grpsyl_p->padding = yyvsp[0].floatval * STEPSIZE;
5416         }
5417     break;
5418
5419   case 341:
5420 #line 3205 "gram.y"
5421     {
5422                 yyval.floatval = (float) yyvsp[-1].intval * yyvsp[0].floatval;
5423         }
5424     break;
5425
5426   case 342:
5427 #line 3210 "gram.y"
5428     {
5429                 /* no sign--must be a positive number */
5430                 yyval.intval = 1;
5431         }
5432     break;
5433
5434   case 343:
5435 #line 3217 "gram.y"
5436     {
5437                 /* user wants a negative number */
5438                 yyval.intval = -1;
5439         }
5440     break;
5441
5442   case 344:
5443 #line 3223 "gram.y"
5444     {
5445                 Curr_grpsyl_p->grpcont = GC_NOTES;
5446                 if (yyvsp[0].intval == 0) {
5447                         /* no notes listed, use same as previous group */
5448                         copy_notes(Curr_grpsyl_p, Last_grpsyl_p);
5449                 }
5450                 else {
5451                         resize_notelist(Curr_grpsyl_p);
5452                 }
5453         }
5454     break;
5455
5456   case 348:
5457 #line 3248 "gram.y"
5458     {
5459                 /* allocate GRPSYL for the case where everything is defaulted
5460                  * from the previous group, with just an extra attribute
5461                  * like ? or ~ specified. */
5462                 if (Curr_grpsyl_p == (struct GRPSYL *) 0) {
5463                         /* shouldn't ever happen, but just in case... */
5464                         Curr_grpsyl_p = newGRPSYL(GS_GROUP);
5465                 }
5466                 if (Last_grpsyl_p != (struct GRPSYL *) 0 &&
5467                                         Last_grpsyl_p->nnotes >= 1) {
5468                         copy_notes(Curr_grpsyl_p, Last_grpsyl_p);
5469                 }
5470                 else if (Last_grpsyl_p != (struct GRPSYL *) 0 && 
5471                                 Last_grpsyl_p->grpcont == GC_REST) {
5472                         Curr_grpsyl_p->grpcont = GC_REST;
5473                 }
5474         }
5475     break;
5476
5477   case 349:
5478 #line 3268 "gram.y"
5479     {
5480                 if (Curr_grpsyl_p->grpcont == GC_NOTES &&
5481                                         Curr_grpsyl_p->nnotes > 0) {
5482                         Curr_grpsyl_p->notelist[Curr_grpsyl_p->nnotes - 1]
5483                                                 .notesize = GS_SMALL;
5484                 }
5485                 else if (Curr_grpsyl_p->grpcont == GC_REST) {
5486                         Curr_grpsyl_p->grpsize  = GS_SMALL;
5487                 }
5488                 else {
5489                         yyerror("no note specified for '?'");
5490                 }
5491         }
5492     break;
5493
5494   case 350:
5495 #line 3284 "gram.y"
5496     {
5497                 if (Curr_grpsyl_p->grpcont != GC_NOTES) {
5498                         yyerror("can't tie a rest or space");
5499                 }
5500                 else if (Curr_grpsyl_p->nnotes > 0) {
5501                         struct NOTE *n_p;
5502                         n_p = &(Curr_grpsyl_p->notelist[Curr_grpsyl_p->nnotes - 1]);
5503                         n_p->tie = YES;
5504                         n_p->tiestyle = yyvsp[-1].intval;
5505                         n_p->tiedir = yyvsp[0].intval;
5506                 }
5507                 else {
5508                         yyerror("no note specified for '~'");
5509                 }
5510         }
5511     break;
5512
5513   case 351:
5514 #line 3302 "gram.y"
5515     {
5516                 if (Curr_grpsyl_p->nnotes > 0) {
5517                         switch (Curr_grpsyl_p->notelist
5518                                         [Curr_grpsyl_p->nnotes - 1].letter) {
5519                         case PP_REST:
5520                         case PP_SPACE:
5521                         case PP_RPT:
5522                         case PP_NO_PITCH:  /* this one not really possible */
5523                                 addsym(yyvsp[0].stringval, Curr_grpsyl_p->c, CT_GRPSYL);
5524                                 break;
5525                         default:
5526                                 addsym(yyvsp[0].stringval, Curr_grpsyl_p->notelist
5527                                         [Curr_grpsyl_p->nnotes - 1].c, CT_NOTE);
5528                                 break;
5529                         }
5530                         var_valid();
5531                 }
5532                 else if (Curr_grpsyl_p->grpcont == GC_REST) {
5533                         /* This should really never be hit anymore since
5534                          * chord-at-a-time code was added, but shouldn't
5535                          * hurt to leave it, just in case. */
5536                         addsym(yyvsp[0].stringval, Curr_grpsyl_p->c, CT_GRPSYL);
5537                         var_valid();
5538                 }
5539                 else {
5540                         l_yyerror(Curr_filename, yylineno,
5541                                 "no note specified for location tag '%s'", yyvsp[0].stringval);
5542                 }
5543         }
5544     break;
5545
5546   case 352:
5547 #line 3334 "gram.y"
5548     {
5549                 /* this is for bend on a non-tablature staff */
5550                 if (Doing_tab_staff == YES) {
5551                         yyerror("^ bend not allowed on tablature staff; use quoted bend string");
5552                 }
5553                 else {
5554                         add_slurto(Curr_grpsyl_p, yyvsp[-1].intval, yyvsp[0].intval,
5555                                         Curr_grpsyl_p->nnotes - 1, L_NORMAL);
5556                         if (Curr_grpsyl_p->nnotes > 0) {
5557                                 Curr_grpsyl_p->notelist
5558                                                 [Curr_grpsyl_p->nnotes - 1]
5559                                                 .is_bend = YES;
5560                         }
5561                 }
5562         }
5563     break;
5564
5565   case 353:
5566 #line 3352 "gram.y"
5567     {
5568                 /* this is for a small bend (1/4 step) on a non-tab staff */
5569                 if (Doing_tab_staff == YES) {
5570                         yyerror("^/ not allowed on tablature staff; use quoted bend string");
5571                 }
5572                 else if (Curr_grpsyl_p != 0 && Curr_grpsyl_p->nnotes > 0) {
5573                         Curr_grpsyl_p->notelist[Curr_grpsyl_p->nnotes - 1]
5574                                         .smallbend = YES;
5575                 }
5576         }
5577     break;
5578
5579   case 354:
5580 #line 3365 "gram.y"
5581     {
5582                 if (Curr_grpsyl_p->grpcont == GC_NOTES &&
5583                                         Curr_grpsyl_p->nnotes > 0) {
5584                         if ((Curr_grpsyl_p->notelist[Curr_grpsyl_p->nnotes - 1]
5585                                         .headshape = get_shape_num(yyvsp[0].stringval + 2))
5586                                         == HS_UNKNOWN) {
5587                                 l_yyerror(Curr_filename, yylineno,
5588                                         "'%s' is not a valid head shape name",
5589                                         ascii_str(yyvsp[0].stringval, YES, NO, TM_NONE));
5590                         }
5591                 }
5592                 else {
5593                         yyerror("no note specified for headshape");
5594                 }
5595                 FREE(yyvsp[0].stringval);
5596         }
5597     break;
5598
5599   case 358:
5600 #line 3394 "gram.y"
5601     {
5602                 yyval.intval = yyvsp[-1].intval + yyvsp[0].intval;      /* total number of notes */
5603         }
5604     break;
5605
5606   case 359:
5607 #line 3400 "gram.y"
5608     {
5609                 yyval.intval = 0;
5610         }
5611     break;
5612
5613   case 360:
5614 #line 3406 "gram.y"
5615     {
5616                 switch (yyvsp[0].intval) {
5617                 case PL_ABOVE:
5618                         Curr_grpsyl_p->stemto = CS_ABOVE;
5619                         break;
5620                 case PL_BELOW:
5621                         Curr_grpsyl_p->stemto = CS_BELOW;
5622                         break;
5623                 default:
5624                         yyerror("cross staff stem must be with 'above' or 'below'");
5625                         Curr_grpsyl_p->stemto = CS_SAME;
5626                 }
5627                 if (yyvsp[-1].intval == 0) {
5628                         /* Maybe this wouldn't really hurt to allow,
5629                          * but it's rather silly--why would user bother to go
5630                          * to the trouble of saying there are cross staff stem
5631                          * notes, but then not list any?
5632                          */
5633                         yyerror("cross-staff stem note list is empty");
5634                 }
5635                 yyval.intval = yyvsp[-1].intval;
5636         }
5637     break;
5638
5639   case 361:
5640 #line 3430 "gram.y"
5641     {
5642                 CSSused = YES;
5643                 Curr_grpsyl_p->stemto_idx = Curr_grpsyl_p->nnotes;
5644         }
5645     break;
5646
5647   case 362:
5648 #line 3436 "gram.y"
5649     {
5650                 /* No notes.  If this is for the list of "normal" staff notes,
5651                  * and there are no "other" staff notes (for cross-staff stems),
5652                  * this means use the same notes as the last group. */
5653                 yyval.intval = 0;
5654         }
5655     break;
5656
5657   case 363:
5658 #line 3445 "gram.y"
5659     {
5660                 /* return number of notes in notelist */
5661                 yyval.intval = yyvsp[-2].intval + 1;
5662         }
5663     break;
5664
5665   case 365:
5666 #line 3454 "gram.y"
5667     {
5668                 add_note(Curr_grpsyl_p, (int) PP_REST, 0, USE_DFLT_OCTAVE,
5669                                                         0, NO, (char *) 0);
5670         }
5671     break;
5672
5673   case 366:
5674 #line 3461 "gram.y"
5675     {
5676                 /* temporarily stash uncompressibility (NO in this case)
5677                  * in the octave field */
5678                 add_note(Curr_grpsyl_p, (int) PP_SPACE, 0, NO,
5679                                                         0, NO, (char *) 0);
5680                 if (Curr_grpsyl_p->is_meas == YES && User_meas_time == YES) {
5681                         yyerror("cannot specify time value on measure space");
5682                 }
5683         }
5684     break;
5685
5686   case 367:
5687 #line 3473 "gram.y"
5688     {
5689                 /* temporarily stash uncompressibility (YES in this case)
5690                  * in the octave field */
5691                 add_note(Curr_grpsyl_p, (int) PP_SPACE, 0, YES,
5692                                                         0, NO, (char *) 0);
5693                 if (Curr_grpsyl_p->is_meas == YES && User_meas_time == YES) {
5694                         yyerror("cannot specify time value on measure uncompressible space");
5695                 }
5696         }
5697     break;
5698
5699   case 368:
5700 #line 3485 "gram.y"
5701     {
5702                 if (Curr_grpsyl_p->is_meas == YES) {
5703                         if (User_meas_time == YES) {
5704                                 yyerror("cannot specify time value on m rpt");
5705                         }
5706                 }
5707                 else {
5708                         yyerror("rpt can only be used with m");
5709                 }
5710                 add_note(Curr_grpsyl_p, (int) PP_RPT, 0, USE_DFLT_OCTAVE,
5711                                                         0, NO, (char *) 0);
5712         }
5713     break;
5714
5715   case 369:
5716 #line 3500 "gram.y"
5717     {
5718                 if (yyvsp[0].intval == SINGLEBAR) {
5719                         /* lexer thinks this is 'bar'
5720                          * but is really 'b' 'a' 'r' */
5721                         keyword_notes(yytext);
5722                 }
5723                 else if (yyvsp[0].intval == ENDBAR) {
5724                         /* lexer thinks this is 'endbar'
5725                          * but is really 'en' 'd' 'b' 'a' 'r' */
5726                         add_note(Curr_grpsyl_p, (int) 'e', 'n',
5727                                 USE_DFLT_OCTAVE, 0, NO, (char *) 0);
5728                         keyword_notes(yytext + 2);
5729                 }
5730                 else {
5731                         yyerror("bar type not valid here");
5732                 }
5733         }
5734     break;
5735
5736   case 370:
5737 #line 3520 "gram.y"
5738     {
5739                 /* lexer thinks this is 'grace' but really 'g' 'r' 'a' 'c' 'e' */
5740                 keyword_notes(yytext);
5741         }
5742     break;
5743
5744   case 371:
5745 #line 3527 "gram.y"
5746     {
5747                 if (yyvsp[0].intval == ENDING_BARRED) {
5748                         keyword_notes(yytext);
5749                 }
5750                 else {
5751                         l_yyerror(Curr_filename, yylineno,
5752                                         "%s not valid here", yytext);
5753                 }
5754         }
5755     break;
5756
5757   case 372:
5758 #line 3538 "gram.y"
5759     {
5760                 if (yyvsp[0].intval == J_RAGPARA) {
5761                         keyword_notes(yytext);
5762                 }
5763                 else {
5764                         l_yyerror(Curr_filename, yylineno,
5765                                         "%s not valid here", yytext);
5766                 }
5767         }
5768     break;
5769
5770   case 373:
5771 #line 3550 "gram.y"
5772     {
5773                 if (yyvsp[0].intval == BRACELIST) {
5774                         keyword_notes(yytext);
5775                 }
5776                 else {
5777                         l_yyerror(Curr_filename, yylineno,
5778                                         "%s not valid here", yytext);
5779                 }
5780         }
5781     break;
5782
5783   case 374:
5784 #line 3562 "gram.y"
5785     {
5786                 if (yyvsp[0].intval == BASS) {
5787                         keyword_notes(yytext);
5788                 }
5789                 else {
5790                         l_yyerror(Curr_filename, yylineno,
5791                                         "%s not valid here", yytext);
5792                 }
5793         }
5794     break;
5795
5796   case 375:
5797 #line 3574 "gram.y"
5798     {
5799                 Curr_grpsyl_p->notelist[Curr_grpsyl_p->nnotes - 1].note_has_paren = YES;
5800         }
5801     break;
5802
5803   case 376:
5804 #line 3579 "gram.y"
5805     {
5806                 if (Doing_tab_staff == YES) {
5807                         add_note(Curr_grpsyl_p, yyvsp[-1].intval, 0, NOFRET, 0, NO, yyvsp[0].stringval);
5808                 }
5809                 else {
5810                         add_note(Curr_grpsyl_p, yyvsp[-1].intval, 0, USE_DFLT_OCTAVE, 0, NO, yyvsp[0].stringval);
5811                 }
5812         }
5813     break;
5814
5815   case 377:
5816 #line 3590 "gram.y"
5817     {
5818                 if (Doing_tab_staff == YES) {
5819                         yyerror("extraneous parentheses around accidental");
5820                 }
5821                 add_note(Curr_grpsyl_p, yyvsp[-4].intval, yyvsp[-2].intval, yyvsp[0].intval, 0, YES, (char *) 0);
5822         }
5823     break;
5824
5825   case 378:
5826 #line 3599 "gram.y"
5827     {
5828                 if (Doing_tab_staff == NO) {
5829                         yyerror("extraneous parentheses around octave");
5830                 }
5831                 add_note(Curr_grpsyl_p, yyvsp[-4].intval, 0, yyvsp[-2].intval, 0, YES, yyvsp[0].stringval);
5832         }
5833     break;
5834
5835   case 379:
5836 #line 3608 "gram.y"
5837     {
5838                 /* Whoops! The left paren was really for a new note,
5839                  * which happens to be parenthesized. But beause yacc only
5840                  * looks ahead one token, it finds out too late. So we
5841                  * catch it here, push the parenthesis and pitch back into
5842                  * the input and return back to the parent grammar rule,
5843                  * since we now have complete note. */
5844                 pushback(yytext[0]);
5845                 pushback('(');
5846                 add_note(Curr_grpsyl_p, yyvsp[-2].intval, 0,
5847                         (Doing_tab_staff ? NOFRET : USE_DFLT_OCTAVE),
5848                         0, NO, (char *) 0);
5849         }
5850     break;
5851
5852   case 380:
5853 #line 3624 "gram.y"
5854     {
5855                 add_note(Curr_grpsyl_p, yyvsp[-4].intval, yyvsp[-3].intval, yyvsp[-1].intval, yyvsp[-2].intval, NO, yyvsp[0].stringval);
5856         }
5857     break;
5858
5859   case 381:
5860 #line 3630 "gram.y"
5861     {
5862                 if (Doing_tab_staff == NO) {
5863                         yyerror("extraneous parentheses around octave");
5864                 }
5865                 add_note(Curr_grpsyl_p, yyvsp[-6].intval, yyvsp[-5].intval, yyvsp[-2].intval, yyvsp[-4].intval, YES, yyvsp[0].stringval);
5866         }
5867     break;
5868
5869   case 382:
5870 #line 3639 "gram.y"
5871     {
5872                 /* Whoops! The left paren was really for a new note,
5873                  * which happens to be parenthesized. But beause yacc only
5874                  * looks ahead one token, it finds out too late. So we
5875                  * catch it here, push the parenthesis and pitch back into
5876                  * the input and return back to the parent grammar rule,
5877                  * since we now have complete note. */
5878                 pushback(yytext[0]);
5879                 pushback('(');
5880                 add_note(Curr_grpsyl_p, yyvsp[-3].intval, yyvsp[-2].intval,
5881                         (Doing_tab_staff ? NOFRET : USE_DFLT_OCTAVE),
5882                         0, NO, (char *) 0);
5883         }
5884     break;
5885
5886   case 383:
5887 #line 3655 "gram.y"
5888     {
5889                 add_note(Curr_grpsyl_p, yyvsp[-3].intval, 0, yyvsp[-1].intval, yyvsp[-2].intval, NO, yyvsp[0].stringval);
5890         }
5891     break;
5892
5893   case 384:
5894 #line 3661 "gram.y"
5895     {
5896                 add_note(Curr_grpsyl_p, yyvsp[-5].intval, 0, yyvsp[-2].intval, yyvsp[-4].intval, YES, yyvsp[0].stringval);
5897         }
5898     break;
5899
5900   case 385:
5901 #line 3667 "gram.y"
5902     {
5903                 if (Doing_tab_staff == YES && yyvsp[-1].intval != '\0') {
5904                         yyerror("accidental must be before fret number");
5905                 }
5906                 add_note(Curr_grpsyl_p, yyvsp[-3].intval, yyvsp[-1].intval, yyvsp[-2].intval, 0, NO, yyvsp[0].stringval);
5907         }
5908     break;
5909
5910   case 386:
5911 #line 3676 "gram.y"
5912     {
5913                 add_note(Curr_grpsyl_p, yyvsp[-4].intval, yyvsp[-1].intval, yyvsp[-3].intval, 0, YES, (char *) 0);
5914         }
5915     break;
5916
5917   case 387:
5918 #line 3682 "gram.y"
5919     {
5920                 /* Whoops! The left paren was really for a new note,
5921                  * which happens to be parenthesized. But beause yacc only
5922                  * looks ahead one token, it finds out too late. So we
5923                  * catch it here, push the parenthesis and pitch back into
5924                  * the input and return back to the parent grammar rule,
5925                  * since we now have complete note. */
5926                 pushback(yytext[0]);
5927                 pushback('(');
5928                 add_note(Curr_grpsyl_p, yyvsp[-3].intval, 0, yyvsp[-2].intval, 0, NO, (char *) 0);
5929         }
5930     break;
5931
5932   case 388:
5933 #line 3695 "gram.y"
5934     {
5935                 yyval.stringval = (char *) 0;
5936         }
5937     break;
5938
5939   case 389:
5940 #line 3701 "gram.y"
5941     {
5942                 if (Doing_tab_staff == NO) {
5943                         /* try to give helpful error message */
5944                         if (get_shape_num(yyvsp[0].stringval + 2) != HS_UNKNOWN) {
5945                                 yyerror("missing 'hs' before headshape string");
5946                         }
5947                         else if (strcmp(yyvsp[0].stringval + 2, "full") == 0 || isdigit(yyvsp[0].stringval[2])) {
5948                                 yyerror("bend string not allowed on non-tablature staff; use ^");
5949                         }
5950                         else {
5951                                 yyerror("unexpected string");
5952                         }
5953                         yyval.stringval = (char *) 0;
5954                 }
5955         }
5956     break;
5957
5958   case 390:
5959 #line 3718 "gram.y"
5960     {
5961                 /* return 'a' to 'g' value */
5962                 yyval.intval = (int) *yytext;
5963         }
5964     break;
5965
5966   case 391:
5967 #line 3724 "gram.y"
5968     {
5969                 /* no accidental */
5970                 yyval.intval = 0;
5971         }
5972     break;
5973
5974   case 392:
5975 #line 3731 "gram.y"
5976     {
5977         }
5978     break;
5979
5980   case 393:
5981 #line 3735 "gram.y"
5982     {
5983                 /* no octave or fret designation */
5984                 yyval.intval = (Doing_tab_staff ? NOFRET : USE_DFLT_OCTAVE);
5985         }
5986     break;
5987
5988   case 394:
5989 #line 3742 "gram.y"
5990     {
5991         }
5992     break;
5993
5994   case 395:
5995 #line 3747 "gram.y"
5996     {
5997                 yyval.intval = '#';
5998         }
5999     break;
6000
6001   case 396:
6002 #line 3753 "gram.y"
6003     {
6004                 yyval.intval = '&';
6005         }
6006     break;
6007
6008   case 397:
6009 #line 3759 "gram.y"
6010     {
6011                 /* natural */
6012                 yyval.intval = 'n';
6013         }
6014     break;
6015
6016   case 398:
6017 #line 3766 "gram.y"
6018     {
6019                 /* double sharp */
6020                 yyval.intval = 'x';
6021         }
6022     break;
6023
6024   case 399:
6025 #line 3773 "gram.y"
6026     {
6027                 yyval.intval = 'B';
6028         }
6029     break;
6030
6031   case 400:
6032 #line 3779 "gram.y"
6033     {
6034                 yyval.intval = yyvsp[0].intval;
6035         }
6036     break;
6037
6038   case 401:
6039 #line 3785 "gram.y"
6040     {
6041                 /* we can't really fill in the actual octave yet, because
6042                  * it may be different on different staffs or voices, so
6043                  * we store the relative octave and fill in actual value
6044                  * later.
6045                  */
6046                 /* this will be a negative number */
6047                 yyval.intval = yyvsp[0].intval;
6048         }
6049     break;
6050
6051   case 402:
6052 #line 3797 "gram.y"
6053     {
6054                 /* we can't really fill in the actual octave yet, because
6055                  * it may be different on different staffs or voices, so
6056                  * we store the relative octave and fill in actual value
6057                  * later.
6058                  */
6059                 yyval.intval = USE_DFLT_OCTAVE + yyvsp[0].intval;
6060         }
6061     break;
6062
6063   case 403:
6064 #line 3807 "gram.y"
6065     {
6066                 yyval.intval = -1;
6067         }
6068     break;
6069
6070   case 404:
6071 #line 3813 "gram.y"
6072     {
6073                 /* count up the number of minus signs */
6074                 yyval.intval = yyvsp[-1].intval - 1;
6075         }
6076     break;
6077
6078   case 405:
6079 #line 3819 "gram.y"
6080     {
6081                 yyval.intval = 1;
6082         }
6083     break;
6084
6085   case 406:
6086 #line 3825 "gram.y"
6087     {
6088                 /* count up the number of plus signs */
6089                 yyval.intval = yyvsp[-1].intval + 1;
6090         }
6091     break;
6092
6093   case 407:
6094 #line 3832 "gram.y"
6095     {
6096                 set_slurdir(Curr_grpsyl_p, Curr_grpsyl_p->nnotes - 1, yyvsp[0].intval);
6097         }
6098     break;
6099
6100   case 408:
6101 #line 3839 "gram.y"
6102     {
6103                 Slurstyle = yyvsp[0].intval;
6104                 begin_slur(Curr_grpsyl_p, Curr_grpsyl_p->nnotes - 1);
6105         }
6106     break;
6107
6108   case 409:
6109 #line 3845 "gram.y"
6110     {
6111                 /* empty list. Only allowed if only one note in following
6112                  * group. However, we don't know that yet, so marked pitch
6113                  * as 'U' for unknown */
6114                 add_slurto(Curr_grpsyl_p, 'U', USE_DFLT_OCTAVE,
6115                                 Curr_grpsyl_p->nnotes - 1, Slurstyle);
6116         }
6117     break;
6118
6119   case 410:
6120 #line 3855 "gram.y"
6121     {
6122                 add_slurto(Curr_grpsyl_p, 0, yyvsp[0].intval, Curr_grpsyl_p->nnotes - 1,
6123                                                 Slurstyle);
6124         }
6125     break;
6126
6127   case 414:
6128 #line 3873 "gram.y"
6129     {
6130                 if (Doing_tab_staff == YES) {
6131                         yyerror("cannot specify string inside <> on tab staffs");
6132                 }
6133                 else {
6134                         add_slurto(Curr_grpsyl_p, yyvsp[-1].intval, yyvsp[0].intval,
6135                                         Curr_grpsyl_p->nnotes - 1, Slurstyle);
6136                 }
6137         }
6138     break;
6139
6140   case 415:
6141 #line 3885 "gram.y"
6142     {
6143                 /* save address associated with entire group */
6144                 if ( yyvsp[0].stringval != (char *) 0) {
6145                         addsym(yyvsp[0].stringval, Curr_grpsyl_p->c, CT_GRPSYL);
6146                         var_valid();
6147                 }
6148         }
6149     break;
6150
6151   case 416:
6152 #line 3894 "gram.y"
6153     {
6154                 yyval.stringval = strcpy(Stringbuff, yytext);
6155         }
6156     break;
6157
6158   case 417:
6159 #line 3900 "gram.y"
6160     {
6161                 /* a-g are usually pitches, but in this context, they
6162                  * are 1-character variable names. */
6163                 yyval.stringval = strcpy(Stringbuff, yytext);
6164         }
6165     break;
6166
6167   case 418:
6168 #line 3908 "gram.y"
6169     {
6170                 /* usually m means measure, but here it is the variable m */
6171                 yyval.stringval = strcpy(Stringbuff, yytext);
6172         }
6173     break;
6174
6175   case 419:
6176 #line 3915 "gram.y"
6177     {
6178                 /* usually rest, here variable r */
6179                 yyval.stringval = strcpy(Stringbuff, yytext);
6180         }
6181     break;
6182
6183   case 420:
6184 #line 3922 "gram.y"
6185     {
6186                 /* usually space, here variable s */
6187                 yyval.stringval = strcpy(Stringbuff, yytext);
6188         }
6189     break;
6190
6191   case 421:
6192 #line 3929 "gram.y"
6193     {
6194                 /* usually uncompressible, here variable u */
6195                 yyval.stringval = strcpy(Stringbuff, yytext);
6196         }
6197     break;
6198
6199   case 422:
6200 #line 3936 "gram.y"
6201     {
6202                 /* usually natural, here variable n */
6203                 yyval.stringval = strcpy(Stringbuff, yytext);
6204         }
6205     break;
6206
6207   case 423:
6208 #line 3943 "gram.y"
6209     {
6210                 /* usually double sharp, here variable x */
6211                 yyval.stringval = strcpy(Stringbuff, yytext);
6212         }
6213     break;
6214
6215   case 424:
6216 #line 3949 "gram.y"
6217     {
6218                 /* longer variable -- one with more than one character name */
6219                 yyval.stringval = strcpy(Stringbuff, yytext);
6220         }
6221     break;
6222
6223   case 425:
6224 #line 3955 "gram.y"
6225     {
6226                 end_tuplet(yyvsp[-3].intval, yyvsp[-1].ratval, yyvsp[-2].intval, yyvsp[-4].intval);
6227                 Getting_tup_dur = NO;
6228         }
6229     break;
6230
6231   case 426:
6232 #line 3961 "gram.y"
6233     {
6234                 /* nothing -- use default of when to print tuplet number/bracket */
6235                 yyval.intval = PT_DEFAULT;
6236         }
6237     break;
6238
6239   case 427:
6240 #line 3968 "gram.y"
6241     {
6242                 /* don't print tuplet or bracket */
6243                 yyval.intval = PT_NEITHER;
6244         }
6245     break;
6246
6247   case 428:
6248 #line 3975 "gram.y"
6249     {
6250                 /* print number only */
6251                 yyval.intval = PT_NUMBER;
6252         }
6253     break;
6254
6255   case 429:
6256 #line 3982 "gram.y"
6257     {
6258                 if (*yytext == 'y') {
6259                         yyval.intval = PT_BOTH;
6260                 }
6261                 else {
6262                         yyerror("tuplet number/bracket qualifier must be y or n or num");
6263                 }
6264         }
6265     break;
6266
6267   case 430:
6268 #line 3994 "gram.y"
6269     {
6270                 begin_tuplet();
6271         }
6272     break;
6273
6274   case 431:
6275 #line 3999 "gram.y"
6276     {
6277                 Getting_tup_dur = YES;
6278         }
6279     break;
6280
6281   case 432:
6282 #line 4004 "gram.y"
6283     {
6284                 yyval.intval = PL_UNKNOWN;
6285         }
6286     break;
6287
6288   case 433:
6289 #line 4010 "gram.y"
6290     {
6291                 if (yylval.intval == PL_BETWEEN) {
6292                         yyerror("between not allowed for tuplet side");
6293                         yyval.intval = PL_UNKNOWN;
6294                 }
6295         }
6296     break;
6297
6298   case 434:
6299 #line 4018 "gram.y"
6300     {
6301                 /* optional time value is missing */
6302                 yyval.ratval.n = 0;
6303                 yyval.ratval.d = 1;
6304         }
6305     break;
6306
6307   case 435:
6308 #line 4026 "gram.y"
6309     {
6310                 yyval.ratval = yyvsp[0].ratval;
6311         }
6312     break;
6313
6314   case 436:
6315 #line 4031 "gram.y"
6316     {
6317         }
6318     break;
6319
6320   case 437:
6321 #line 4035 "gram.y"
6322     {
6323                 Last_grpsyl_p = Curr_grpsyl_p = (struct GRPSYL *) 0;
6324         }
6325     break;
6326
6327   case 438:
6328 #line 4040 "gram.y"
6329     {
6330         }
6331     break;
6332
6333   case 439:
6334 #line 4044 "gram.y"
6335     {
6336                 /* empty, use default */
6337                 begin_range(PL_UNKNOWN);
6338                 yyval.intval = PL_UNKNOWN;
6339         }
6340     break;
6341
6342   case 440:
6343 #line 4052 "gram.y"
6344     {
6345                 begin_range(yyvsp[0].intval);
6346         }
6347     break;
6348
6349   case 442:
6350 #line 4060 "gram.y"
6351     {
6352                 /* means goes above or below all the staffs, regardless if
6353                  * some happen to be invisible at the moment, so find top
6354                  * or bottom visible staff as appropriate,and save that
6355                  * away as the staff range */
6356                 all();
6357         }
6358     break;
6359
6360   case 444:
6361 #line 4073 "gram.y"
6362     {
6363                 /* if staff_range == 0, then only one staff specified, so
6364                  * use first staff number for both beginning and end of range */
6365                 save_staff_range(yyvsp[-1].intval, (yyvsp[0].intval == 0 ? yyvsp[-1].intval : yyvsp[0].intval) );
6366         }
6367     break;
6368
6369   case 445:
6370 #line 4080 "gram.y"
6371     {
6372                 /* empty */
6373                 chk_range_type(NO);
6374                 yyval.intval = 0;
6375         }
6376     break;
6377
6378   case 446:
6379 #line 4088 "gram.y"
6380     {
6381                 chk_range_type(NO);
6382                 yyval.intval = yyvsp[0].intval;
6383                 if (yyvsp[0].intval == 0) {
6384                         yyerror("staff of 0 is illegal");
6385                 }
6386         }
6387     break;
6388
6389   case 447:
6390 #line 4098 "gram.y"
6391     {
6392                 chk_range_type(YES);
6393                 yyval.intval = yyvsp[0].intval;
6394         }
6395     break;
6396
6397   case 449:
6398 #line 4107 "gram.y"
6399     { Place = yyvsp[0].intval; }
6400     break;
6401
6402   case 451:
6403 #line 4112 "gram.y"
6404     {
6405         }
6406     break;
6407
6408   case 452:
6409 #line 4117 "gram.y"
6410     {
6411                 if (*yytext != 'c') {
6412                         yyerror("verse must be 'c' or number(s)");
6413                 }
6414                 else {
6415                         save_vno_range(0, 0);
6416                 }
6417         }
6418     break;
6419
6420   case 453:
6421 #line 4128 "gram.y"
6422     {
6423         }
6424     break;
6425
6426   case 454:
6427 #line 4133 "gram.y"
6428     {
6429         }
6430     break;
6431
6432   case 455:
6433 #line 4138 "gram.y"
6434     {
6435                 /* if end of range is 0, not really a range, use first number
6436                  * for both beginning and end */
6437                 lyr_verse(yyvsp[-1].intval, (yyvsp[0].intval == 0 ? yyvsp[-1].intval : yyvsp[0].intval));
6438         }
6439     break;
6440
6441   case 456:
6442 #line 4145 "gram.y"
6443     {
6444                 /* empty */
6445                 yyval.intval = 0;
6446         }
6447     break;
6448
6449   case 457:
6450 #line 4152 "gram.y"
6451     {
6452                 yyval.intval = yyvsp[0].intval;
6453         }
6454     break;
6455
6456   case 458:
6457 #line 4157 "gram.y"
6458     {
6459                 /* null token to allocate a GRPSYL for a lyric */
6460                 Last_grpsyl_p = Curr_grpsyl_p;
6461                 Curr_grpsyl_p = newGRPSYL(GS_SYLLABLE);
6462                 if (Last_grpsyl_p == (struct GRPSYL *) 0) {
6463                         Lyrics_p = Curr_grpsyl_p;
6464                 }
6465         }
6466     break;
6467
6468   case 459:
6469 #line 4167 "gram.y"
6470     {
6471                 /* If user didn't specify a place, fix that. */
6472                 if (Place == PL_UNKNOWN) {
6473                         Place = PL_BELOW;
6474                 }
6475                 /* copies of the lyrics info has been made for all staffs/verses
6476                  * at this point, so get rid of master copy */
6477                 free_grpsyls(Lyrics_p);
6478         }
6479     break;
6480
6481   case 460:
6482 #line 4178 "gram.y"
6483     {
6484                 /* empty -- need to derive times from music */
6485                 Lyrics_p = derive_lyrtime();
6486         }
6487     break;
6488
6489   case 465:
6490 #line 4197 "gram.y"
6491     {
6492                 link_notegroup(Curr_grpsyl_p, Last_grpsyl_p);
6493                 /* Save pointer to current GRPSYL in case the next
6494                  * group gets its time value based on this one,
6495                  * and there are additive times on this one. */
6496                 Prev_grpsyl_p = Curr_grpsyl_p;
6497                 /* If there are additive times, add those in.
6498                  * We don't need to make extra groups for lyrics, because we
6499                  * don't need to tie groups together--the lyrics time
6500                  * can hold any legal RATIONAL, even those that aren't
6501                  * specifiable with a single time value. */
6502                 if (Extra_time_p != 0) {
6503                         struct TIMELIST *timelist_p;
6504                         for (timelist_p = Extra_time_p; timelist_p != 0;
6505                                                 timelist_p = timelist_p->next) {
6506                                 Curr_grpsyl_p->fulltime = radd(Curr_grpsyl_p->fulltime, timelist_p->fulltime);
6507                         }
6508                 }
6509         }
6510     break;
6511
6512   case 466:
6513 #line 4219 "gram.y"
6514     {
6515         }
6516     break;
6517
6518   case 467:
6519 #line 4223 "gram.y"
6520     {
6521                 end_tuplet(yyvsp[-1].intval, yyvsp[0].ratval, NO, PL_UNKNOWN);
6522                 Getting_tup_dur = NO;
6523         }
6524     break;
6525
6526   case 468:
6527 #line 4229 "gram.y"
6528     {
6529                 /* empty, will fill in an actual syllable later */
6530                 Curr_grpsyl_p->syl = (char *) 0;
6531         }
6532     break;
6533
6534   case 469:
6535 #line 4236 "gram.y"
6536     {
6537                 /* space, not a lyric, so mark for later use */
6538                 Curr_grpsyl_p->grpcont = GC_SPACE;
6539         }
6540     break;
6541
6542   case 472:
6543 #line 4249 "gram.y"
6544     {
6545                 /* If no [verseno] is specified, use -1 as special flag
6546                  * to be resolved later to "one more than previous",
6547                  * or if there wasn't a previous, to verse 1.
6548                  */
6549                 lyr_verse(-1, -1);
6550                 proc_lyrics(Lyrics_p, yyvsp[-1].stringval);
6551         }
6552     break;
6553
6554   case 473:
6555 #line 4260 "gram.y"
6556     {
6557                 proc_lyrics(Lyrics_p, yyvsp[-1].stringval);
6558         }
6559     break;
6560
6561   case 474:
6562 #line 4265 "gram.y"
6563     {
6564                 Currstruct_p = (struct MAINLL *) 0;
6565                 /* If there are alternating time signature,
6566                  * add an implicit time signature SSV for the
6567                  * next time signature in the list.
6568                  */
6569                 if (Alt_timesig_list != 0) {
6570                         end_prev_context();
6571                         Context = C_SCORE;
6572                         Currstruct_p = newMAINLLstruct(S_SSV, -1);
6573                         Currstruct_p->u.ssv_p->context = Context;
6574                         if (Tsig_visibility == PTS_ALWAYS &&
6575                                         Next_alt_timesig != Alt_timesig_list) {
6576                                 /* If user wants alternating time signatures
6577                                  * printed on every measure, if there is
6578                                  * a multirest, we will print multiple
6579                                  * time signatures there, and might have to
6580                                  * wrap around to the beginning of the list.
6581                                  * So make a copy of the entire list,
6582                                  * starting from wherever we are now,
6583                                  * wrapping around to the beginning,
6584                                  * and ending just before where we are now.
6585                                  * Most of the time,
6586                                  * there probably won't be a multirest,
6587                                  * so this will be a waste, but unfortunately,
6588                                  * we don't know yet whether there will be
6589                                  * one or not, so need to do the whole list
6590                                  * just in case.
6591                                  *
6592                                  * Calculate length of the two pieces:
6593                                  * from where we are to end, and from
6594                                  * beginning to where we are.
6595                                  */
6596                                 int remlength;
6597                                 int wraplength;
6598                                 remlength = strlen(Next_alt_timesig);
6599                                 wraplength = strlen(Alt_timesig_list)
6600                                                 - remlength;
6601                                 /* need one more for terminator. */
6602                                 MALLOCA(char, Currstruct_p->u.ssv_p->timerep,
6603                                                 remlength + wraplength + 1);
6604
6605                                 /* copy remainder into beginning */
6606                                 strcpy(Currstruct_p->u.ssv_p->timerep,
6607                                                 Next_alt_timesig);
6608                                 /* copy the wrap-around part of list,
6609                                  * but move the TSR_ALTERNATING from the
6610                                  * end of that part to between the two parts */
6611                                 Currstruct_p->u.ssv_p->timerep[remlength]
6612                                                 = TSR_ALTERNATING;
6613                                 strncpy(Currstruct_p->u.ssv_p->timerep +
6614                                                 remlength + 1, Alt_timesig_list,
6615                                                 wraplength - 1);
6616                                 /* Add the terminator */
6617                                 Currstruct_p->u.ssv_p->timerep
6618                                                 [remlength + wraplength]
6619                                                 = TSR_END;
6620
6621                                 assign_timesig(Currstruct_p, PTS_ALWAYS,
6622                                                         &Next_alt_timesig);
6623
6624
6625                                 /* Make this new copy the new
6626                                  * head of the list */
6627                                 Alt_timesig_list =
6628                                                 Currstruct_p->u.ssv_p->timerep;
6629                         }
6630                         else {
6631                                 /* make a copy of the remaining alternating
6632                                  * signatures and assign that */
6633                                 MALLOCA(char, Currstruct_p->u.ssv_p->timerep,
6634                                         strlen(Next_alt_timesig) + 1);
6635                                 strcpy(Currstruct_p->u.ssv_p->timerep,
6636                                                         Next_alt_timesig);
6637                                 assign_timesig(Currstruct_p,
6638                                         (Tsig_visibility == PTS_ALWAYS ?
6639                                         PTS_ALWAYS : PTS_NEVER),
6640                                         &Next_alt_timesig);
6641
6642                                 /* If we reached end of list, start over */
6643                                 if (Next_alt_timesig == 0) {
6644                                         Next_alt_timesig = Alt_timesig_list;
6645                                 }
6646                         }
6647
6648                         asgnssv(Currstruct_p->u.ssv_p);
6649                         end_prev_context();
6650                         Context = C_MUSIC;
6651                 }
6652         }
6653     break;
6654
6655   case 477:
6656 #line 4364 "gram.y"
6657     {
6658                 struct MAINLL * mll_p;
6659                 char *name;
6660
6661
6662                 name = (yylval.intval == YES ? "newpage" : "newscore");
6663
6664                 (void) contextcheck(C_MUSIC | C_BLOCK, name);
6665                 Currstruct_p = newMAINLLstruct(S_FEED, yylineno);
6666                 Currstruct_p->u.feed_p->pagefeed = yyvsp[0].intval;
6667
6668                 /* make sure we're not in the middle of a measure. Go
6669                  * backwards in main list. If we hit STAFF before a BAR,
6670                  * then there is a problem.
6671                  */
6672                 for (mll_p = Mainlltc_p; mll_p != (struct MAINLL *) 0;
6673                                         mll_p = mll_p->prev) {
6674
6675                         if (mll_p->str == S_BAR) {
6676                                 break;
6677                         }
6678                         else if (mll_p->str == S_STAFF) {
6679                                 l_yyerror(Curr_filename, yylineno,
6680                                         "%s not allowed in middle of measure",
6681                                         name);
6682                                 break;
6683                         }
6684                         else if (mll_p->str == S_FEED) {
6685                                 if (mll_p->prev != 0 &&
6686                                                 mll_p->prev->str == S_BLOCKHEAD) {
6687                                         /* This is a feed following a block.
6688                                          * If it was an implicit feed,
6689                                          * we can get rid of it, because
6690                                          * user now put an explicit one.
6691                                          */
6692                                         if (mll_p->inputlineno == -1) {
6693                                                 unlinkMAINLL(mll_p);
6694                                                 FREE(mll_p);
6695                                         }
6696                                         /* We must be in block context,
6697                                          * so no need to check farther back.
6698                                          */
6699                                         break;
6700                                 }
6701                                 else {
6702                                         l_yyerror(Curr_filename, yylineno,
6703                                                 "consecutive newscore/newpage not allowed");
6704                                 }
6705                                 break;
6706                         }
6707                 }
6708                 insertMAINLL(Currstruct_p, Mainlltc_p);
6709
6710                 /* If this is inside a block, we need to create a new block
6711                  * and feed after it.
6712                  */
6713                 if (Context == C_BLOCK) {
6714                         CALLOC(BLOCKHEAD, Currblock_p, 1);
6715                         set_win_coord(Currblock_p->c);
6716                         Next_print_link_p_p = &(Currblock_p->printdata_p);
6717                         insertMAINLL(newMAINLLstruct(S_BLOCKHEAD, yylineno),
6718                                                 Mainlltc_p);
6719                         Mainlltc_p->u.blockhead_p = Currblock_p;
6720                         insertMAINLL(newMAINLLstruct(S_FEED, -1), Mainlltc_p);
6721                 }
6722
6723         }
6724     break;
6725
6726   case 478:
6727 #line 4432 "gram.y"
6728     {
6729                 Currstruct_p = (struct MAINLL *) 0;
6730         }
6731     break;
6732
6733   case 482:
6734 #line 4448 "gram.y"
6735     {
6736                 yyvsp[0].floatval = adjust2inches(yyvsp[0].floatval);   /* in case we are in centimeter mode */
6737                 if (yyvsp[-2].intval == RIGHTMARGIN) {
6738                         if (Currstruct_p->u.feed_p->rightmargin >= 0) {
6739                                 l_warning(Curr_filename, yylineno,
6740                                         "rightmargin specified more than once, using last instance");
6741                                 /* fall through to override the previous */
6742                         }
6743                         Currstruct_p->u.feed_p->rightmargin = yyvsp[0].floatval;
6744                 }
6745                 else if (yyvsp[-2].intval == LEFTMARGIN) {
6746                         if (Currstruct_p->u.feed_p->leftmargin >= 0) {
6747                                 l_warning(Curr_filename, yylineno,
6748                                         "leftmargin specified more than once, using last instance");
6749                                 /* fall through to override the previous */
6750                         }
6751                         Currstruct_p->u.feed_p->leftmargin = yyvsp[0].floatval;
6752                 }
6753                 else {
6754                         yyerror("unexpected parameter; only 'leftmargin' or 'rightmargin' allowed here");
6755                 }
6756                 chkmargin(Score.topmargin, Score.botmargin,
6757                                 Currstruct_p->u.feed_p->leftmargin,
6758                                 Currstruct_p->u.feed_p->rightmargin);
6759         }
6760     break;
6761
6762   case 489:
6763 #line 4494 "gram.y"
6764     {
6765
6766                 /* build a BAR struct and add it to the main list */
6767                 if (contextcheck(C_MUSIC, "bar") == YES) {
6768
6769                         Currstruct_p = newMAINLLstruct(S_BAR, yylineno);
6770                         Currstruct_p->u.bar_p->bartype = (short) yylval.intval;
6771                         Currstruct_p->u.bar_p->endingloc = Endingloc;
6772                         if (yyvsp[-2].intval != L_NORMAL) {
6773                                 if (yyvsp[-2].intval != L_DASHED && yyvsp[-2].intval != L_DOTTED) {
6774                                         yyerror("bar modifier can only be 'dashed' or 'dotted'");
6775                                 }
6776                                 else if (yyvsp[0].intval != SINGLEBAR && yyvsp[0].intval != DOUBLEBAR) {
6777                                         yyerror("only 'bar' or 'dblbar' can be dashed or dotted");
6778                                 }
6779                         }
6780                         Currstruct_p->u.bar_p->linetype = yyvsp[-2].intval;
6781                         insertMAINLL(Currstruct_p, Mainlltc_p);
6782                         Currstruct_p->u.bar_p->timedssv_p = tssv_sort();
6783
6784                         /* re-order things in the  bar,
6785                          * make sure they are all consistent, etc */
6786                         do_bar(yyvsp[0].intval);
6787
6788                         Got_ending = NO;
6789                 }
6790                 if (yyvsp[0].intval == RESTART && Endingloc != NOITEM) {
6791                         yyerror("restart cannot be used inside an ending");
6792                 }
6793
6794                 /* User can specify bar type to use on preceeding staff when
6795                  * a repeatstart gets moved to the next scores's pseudo-bar */
6796                 if (yyvsp[-1].intval != -1) {
6797                         if (yyvsp[0].intval != REPEATSTART) {
6798                                 yyerror("bar type for preceeding score only allowed on repeatstart");
6799                         }
6800                         if (Currstruct_p != 0 && Currstruct_p->u.bar_p != 0) {
6801                                 Currstruct_p->u.bar_p->precbartype = yyvsp[-1].intval;
6802                         }
6803                 }
6804                 else {
6805                         /* Default is single bar. It could be argued that in
6806                          * the case of a key change on this bar, it really
6807                          * should be a dblbar, but user can force that
6808                          * if they want it. */
6809                         if (Currstruct_p != 0 && Currstruct_p->u.bar_p != 0) {
6810                                 Currstruct_p->u.bar_p->precbartype = SINGLEBAR;
6811                         }
6812                 }
6813         }
6814     break;
6815
6816   case 490:
6817 #line 4547 "gram.y"
6818     {
6819                 yyval.intval = -1;      /* special value to mean "none specified" */
6820         }
6821     break;
6822
6823   case 491:
6824 #line 4553 "gram.y"
6825     {
6826                 /* Parens wouldn't be strictly necessary to be able to parse,
6827                  * but seem useful semantically to make it clear this is
6828                  * optional, only applying when repeatstart is moved to
6829                  * next score's pseudo bar. */
6830                 yyval.intval = yyvsp[-1].intval;
6831         }
6832     break;
6833
6834   case 494:
6835 #line 4569 "gram.y"
6836     {
6837                 if (Currstruct_p != (struct MAINLL *) 0) {
6838                         Currstruct_p->u.bar_p->padding += yyvsp[0].floatval * STEPSIZE;
6839                 }
6840         }
6841     break;
6842
6843   case 495:
6844 #line 4577 "gram.y"
6845     {
6846                 if (Currstruct_p != (struct MAINLL *) 0) {
6847                         /* fill in location info */
6848                         if (yyvsp[0].stringval != (char *) 0) {
6849                                 addsym(yyvsp[0].stringval, Currstruct_p->u.bar_p->c, CT_BAR);
6850                         }
6851                 }
6852         }
6853     break;
6854
6855   case 496:
6856 #line 4588 "gram.y"
6857     {
6858                 if (Got_ending == YES) {
6859                         yyerror("Only one ending allowed per bar");
6860                 }
6861                 Got_ending = YES;
6862
6863                 if (Currstruct_p != (struct MAINLL *) 0) {
6864                         if (Currstruct_p->u.bar_p->bartype == RESTART) {
6865                                 yyerror("ending not allowed on restart");
6866                         }
6867                         /* fill in ending label if any */
6868                         Currstruct_p->u.bar_p->endinglabel = yyvsp[0].stringval;
6869                         Currstruct_p->u.bar_p->endingloc = Endingloc;
6870                         ped_endings(Endingloc);
6871
6872                         /* for next time around, figure out what endingloc will
6873                          * be if user doesn't specify something different */
6874                         switch (Endingloc) {
6875                         case STARTITEM:
6876                                 Endingloc = INITEM;
6877                                 break;
6878                         case ENDITEM:
6879                                 Endingloc = NOITEM;
6880                                 break;
6881                         default:
6882                                 break;
6883                         }
6884                 }
6885         }
6886     break;
6887
6888   case 497:
6889 #line 4620 "gram.y"
6890     {
6891                 if (Currstruct_p != 0) {
6892                         if (Currstruct_p->u.bar_p->bartype == RESTART) {
6893                                 yyerror("hidechanges not allowed on restart");
6894                         }
6895                         Currstruct_p->u.bar_p->hidechanges = YES;
6896                 }
6897         }
6898     break;
6899
6900   case 498:
6901 #line 4630 "gram.y"
6902     {
6903                 if (Currstruct_p != 0) {
6904                         set_mnum(Currstruct_p->u.bar_p, yyvsp[0].intval);
6905                 }
6906         }
6907     break;
6908
6909   case 499:
6910 #line 4637 "gram.y"
6911     {
6912                 /* +2 to skip font/size */
6913                 init_reh(-1, yyvsp[0].stringval + 2, Currstruct_p);
6914         }
6915     break;
6916
6917   case 500:
6918 #line 4643 "gram.y"
6919     {
6920                 init_reh(yyvsp[0].intval, (char *)0, Currstruct_p);
6921         }
6922     break;
6923
6924   case 501:
6925 #line 4649 "gram.y"
6926     {
6927                 if (Currstruct_p != (struct MAINLL *) 0) {
6928                         set_reh_string(Currstruct_p->u.bar_p, yyvsp[-4].intval, yyvsp[-3].intval, yyvsp[-2].intval, yyvsp[-1].stringval);
6929                         Currstruct_p->u.bar_p->dist = Dist;
6930                         Currstruct_p->u.bar_p->dist_usage = Dist_usage;
6931                 }
6932         }
6933     break;
6934
6935   case 502:
6936 #line 4659 "gram.y"
6937     {
6938                 yyval.stringval = yyvsp[0].stringval;
6939                 (void) fix_string(yyvsp[0].stringval, FONT_TR, DFLT_SIZE, Curr_filename, yylineno);
6940                 Endingloc = STARTITEM;
6941         }
6942     break;
6943
6944   case 503:
6945 #line 4667 "gram.y"
6946     {
6947                 if (Endingloc == NOITEM) {
6948                         yyerror("no ending in progress");
6949                 }
6950                 else {
6951                         Endingloc = ENDITEM;
6952                 }
6953                 yyval.stringval = (char *) 0;
6954         }
6955     break;
6956
6957   case 504:
6958 #line 4678 "gram.y"
6959     {
6960                 /* null token to check for more than one rehearsal mark
6961                  * on one BAR */
6962                 if (Currstruct_p != (struct MAINLL *) 0 &&
6963                                 Currstruct_p->u.bar_p->reh_type != REH_NONE) {
6964                         yyerror("only one rehearsal mark allowed per bar");
6965                 }
6966         }
6967     break;
6968
6969   case 505:
6970 #line 4688 "gram.y"
6971     {
6972                 if (Currstruct_p != (struct MAINLL *) 0) {
6973                         Currstruct_p->u.bar_p->reh_type = REH_STRING;
6974                 }
6975         }
6976     break;
6977
6978   case 506:
6979 #line 4696 "gram.y"
6980     {
6981                 if (Currstruct_p != (struct MAINLL *) 0) {
6982                         Currstruct_p->u.bar_p->reh_type = REH_MNUM;
6983                 }
6984                 yyval.stringval = (char *) 0;
6985         }
6986     break;
6987
6988   case 507:
6989 #line 4705 "gram.y"
6990     {
6991                 if (Currstruct_p != (struct MAINLL *) 0) {
6992                         Currstruct_p->u.bar_p->reh_type = REH_NUM;
6993                 }
6994                 yyval.stringval = (char *) 0;
6995         }
6996     break;
6997
6998   case 508:
6999 #line 4714 "gram.y"
7000     {
7001                 if (Currstruct_p != (struct MAINLL *) 0) {
7002                         Currstruct_p->u.bar_p->reh_type = REH_LET;
7003                 }
7004                 yyval.stringval = (char *) 0;
7005         }
7006     break;
7007
7008   case 509:
7009 #line 4722 "gram.y"
7010     {
7011                 yyval.inpcoord_p = yyvsp[-4].inpcoord_p;
7012         }
7013     break;
7014
7015   case 510:
7016 #line 4727 "gram.y"
7017     {
7018                 /* null token to allocate an INPCOORD */
7019                 CALLOC(INPCOORD, Curr_loc_info_p, 1);
7020                 yyval.inpcoord_p = Curr_loc_info_p;
7021                 /* set to positive in case input starts with an absolute
7022                  * x coordinate */
7023                 Plus_minus = 1;
7024         }
7025     break;
7026
7027   case 511:
7028 #line 4737 "gram.y"
7029     {
7030                 /* reset sign to positive in case y coordinate is absolute */
7031                 Plus_minus = 1;
7032         }
7033     break;
7034
7035   case 513:
7036 #line 4746 "gram.y"
7037     {
7038                 /* only 1 of these allowed per location */
7039                 if (Curr_loc_info_p->hor_p != (float *) 0) {
7040                         pfatal("only one horizontal location variable allowed per coordinate");
7041                 }
7042                 /* fill in the coord address and type */
7043                 Curr_loc_info_p->hor_p = symval(yyvsp[-2].stringval, &(Curr_loc_info_p->hor_p));
7044                 Curr_loc_info_p->htype = yyvsp[0].intval;
7045         }
7046     break;
7047
7048   case 515:
7049 #line 4762 "gram.y"
7050     {
7051                 /* only valid letters is w */
7052                 if (*yytext != 'w') {
7053                         yyerror("invalid direction: must be x, w, or e");
7054                 }
7055                 yyval.intval = AW;
7056         }
7057     break;
7058
7059   case 516:
7060 #line 4771 "gram.y"
7061     {
7062                 yyval.intval = AX;
7063         }
7064     break;
7065
7066   case 517:
7067 #line 4777 "gram.y"
7068     {
7069                 /* only valid value is e */
7070                 if (*yytext != 'e') {
7071                         yyerror("invalid direction: must be x, w, or e");
7072                 }
7073                 yyval.intval = AE;
7074         }
7075     break;
7076
7077   case 521:
7078 #line 4794 "gram.y"
7079     {
7080                 yyval.intval = Plus_minus = 1;
7081         }
7082     break;
7083
7084   case 522:
7085 #line 4800 "gram.y"
7086     {
7087                 yyval.intval = Plus_minus = -1;
7088         }
7089     break;
7090
7091   case 523:
7092 #line 4805 "gram.y"
7093     {
7094                 Curr_loc_info_p->hsteps += yyvsp[0].floatval * (float) Plus_minus;
7095         }
7096     break;
7097
7098   case 524:
7099 #line 4811 "gram.y"
7100     {
7101                 if (Curr_loc_info_p->hor_p == (float *) 0) {
7102                         yyerror("must specify location before giving time offset");
7103                 }
7104                 /* add or subtract time value from horizontal */
7105                 if (Plus_minus == 1) {
7106                         Curr_loc_info_p->counts += yyvsp[0].floatval;
7107                 }
7108                 else {
7109                         Curr_loc_info_p->counts -= yyvsp[0].floatval;
7110                 }
7111         }
7112     break;
7113
7114   case 527:
7115 #line 4831 "gram.y"
7116     {
7117                 /* only one of these allowed per location */
7118                 if (Curr_loc_info_p->vert_p != (float *) 0) {
7119                         pfatal("only one vertical location variable allowed per coordinate");
7120                 }
7121                 /* fill in the coord address and type */
7122                 Curr_loc_info_p->vert_p = symval(yyvsp[-2].stringval, &(Curr_loc_info_p->vert_p));
7123                 Curr_loc_info_p->vtype = yyvsp[0].intval;
7124
7125         }
7126     break;
7127
7128   case 528:
7129 #line 4843 "gram.y"
7130     {
7131                 yyval.intval = AN;
7132         }
7133     break;
7134
7135   case 529:
7136 #line 4849 "gram.y"
7137     {
7138                 yyval.intval = AS;
7139         }
7140     break;
7141
7142   case 530:
7143 #line 4855 "gram.y"
7144     {
7145                 /* only valid value here is y */
7146                 if (*yytext != 'y') {
7147                         yyerror("invalid direction: must be y, n, or s");
7148                 }
7149                 yyval.intval = AY;
7150         }
7151     break;
7152
7153   case 533:
7154 #line 4870 "gram.y"
7155     {
7156         }
7157     break;
7158
7159   case 534:
7160 #line 4875 "gram.y"
7161     {
7162                 /* this is number of steps up (or down if negative) */
7163                 Curr_loc_info_p->vsteps += yyvsp[0].floatval * (float) Plus_minus;
7164         }
7165     break;
7166
7167   case 535:
7168 #line 4881 "gram.y"
7169     {
7170                 yyval.floatval = (float) yyvsp[0].intval;
7171         }
7172     break;
7173
7174   case 536:
7175 #line 4886 "gram.y"
7176     {
7177                 sprintf(Tmpbuff,"%d.%s", yyvsp[-2].intval, yyvsp[0].stringval);
7178                 yyval.floatval = (float) atof(Tmpbuff);
7179         }
7180     break;
7181
7182   case 537:
7183 #line 4892 "gram.y"
7184     {
7185                 sprintf(Tmpbuff,"0.%s", yyvsp[0].stringval);
7186                 yyval.floatval = (float) atof(Tmpbuff);
7187         }
7188     break;
7189
7190   case 538:
7191 #line 4898 "gram.y"
7192     {
7193                 /* no decimal fraction part of float number */
7194                 yyval.stringval = "";
7195         }
7196     break;
7197
7198   case 540:
7199 #line 4908 "gram.y"
7200     {
7201                 yyval.stringval = yytext;
7202         }
7203     break;
7204
7205   case 542:
7206 #line 4916 "gram.y"
7207     {
7208                 Currstruct_p->u.line_p->linetype = yyvsp[-6].intval;
7209                 Currstruct_p->u.line_p->start = *(yyvsp[-3].inpcoord_p);
7210                 Currstruct_p->u.line_p->end = *(yyvsp[-1].inpcoord_p);
7211                 rep_inpcoord(yyvsp[-3].inpcoord_p, &(Currstruct_p->u.line_p->start));
7212                 rep_inpcoord(yyvsp[-1].inpcoord_p, &(Currstruct_p->u.line_p->end));
7213                 Currstruct_p->u.line_p->string = yyvsp[0].stringval;
7214
7215                 /* copies of the location info went into the LINE struct,
7216                  * so we can free the original copy of the information */
7217                 if (yyvsp[-3].inpcoord_p) {
7218                         FREE(yyvsp[-3].inpcoord_p);
7219                 }
7220                 if (yyvsp[-1].inpcoord_p) {
7221                         FREE(yyvsp[-1].inpcoord_p);
7222                 }
7223                 insertMAINLL(Currstruct_p, Mainlltc_p);
7224                 Currstruct_p = (struct MAINLL *) 0;
7225         }
7226     break;
7227
7228   case 543:
7229 #line 4937 "gram.y"
7230     {
7231                 /* null token to cause allocation of LINE struct */
7232                 (void) contextcheck(C_MUSIC, "line");
7233                 Currstruct_p = newMAINLLstruct(S_LINE, yylineno);
7234         }
7235     break;
7236
7237   case 544:
7238 #line 4944 "gram.y"
7239     {
7240                 yyval.intval = L_NORMAL;
7241         }
7242     break;
7243
7244   case 546:
7245 #line 4954 "gram.y"
7246     {
7247                 yyval.stringval = 0;
7248         }
7249     break;
7250
7251   case 547:
7252 #line 4959 "gram.y"
7253     {
7254                 yyval.stringval = fix_string(yyvsp[0].stringval, Titlefont, Titlesize, Curr_filename, yylineno);
7255         }
7256     break;
7257
7258   case 548:
7259 #line 4965 "gram.y"
7260     {
7261                 if (yyvsp[-6].intval == L_WAVY) {
7262                         l_yyerror(Curr_filename, yylineno,
7263                                                 "wavy curve not allowed");
7264                 }
7265                 Currstruct_p->u.curve_p->curvetype = yyvsp[-6].intval;
7266                 insertMAINLL(Currstruct_p, Mainlltc_p);
7267                 Currstruct_p = (struct MAINLL *) 0;
7268         }
7269     break;
7270
7271   case 549:
7272 #line 4976 "gram.y"
7273     {
7274                 (void) contextcheck(C_MUSIC, "curve");
7275                 Currstruct_p = newMAINLLstruct(S_CURVE, yylineno);
7276
7277                 /* get space for a list of locations and mark it as empty */
7278                 Item_count = 0;
7279                 Currstruct_p->u.curve_p->ncoord = (short) Item_count;
7280                 Currstruct_p->u.curve_p->nbulge = (short) Item_count;
7281                 MALLOC(INPCOORD, Currstruct_p->u.curve_p->coordlist, ITEMS);
7282                 Max_items = ITEMS;
7283         }
7284     break;
7285
7286   case 556:
7287 #line 5010 "gram.y"
7288     {
7289                 /* get enough space to store some values if don't have enough */
7290                 if (Currstruct_p->u.curve_p->nbulge == 0) {
7291                         MALLOCA(float, Currstruct_p->u.curve_p->bulgelist, ITEMS);
7292                 }
7293                 else if ( (Currstruct_p->u.curve_p->nbulge % ITEMS) == 0) {
7294                         REALLOCA(float, Currstruct_p->u.curve_p->bulgelist,
7295                                 Currstruct_p->u.curve_p->nbulge + ITEMS);
7296                 }
7297
7298                 /* fill in the value and increment the count of how many */
7299                 Currstruct_p->u.curve_p->bulgelist[Currstruct_p->u.curve_p->nbulge] = yyvsp[-1].intval * yyvsp[0].floatval;
7300                 (Currstruct_p->u.curve_p->nbulge)++;
7301         }
7302     break;
7303
7304   case 557:
7305 #line 5026 "gram.y"
7306     {
7307                 struct INPCOORD *curve_inpcoord_p;
7308
7309                 /* If ran off end of list, make list bigger.
7310                  * We cannot use REALLOC here, since we need to update
7311                  * the tag reference information on each individual array
7312                  * element, so we alloc all new space, copy the existing data,
7313                  * and update the tag references, then free the old space,
7314                  * and redirect the pointer to the new space. */
7315                 if (Currstruct_p->u.curve_p->ncoord >= Max_items) {
7316                         struct INPCOORD *newlist_p;
7317                         int n;
7318                         Max_items += ITEMS;
7319                         MALLOC(INPCOORD, newlist_p, Max_items);
7320                         for (n = 0; n < Currstruct_p->u.curve_p->ncoord; n++) {
7321                                 newlist_p[n] = Currstruct_p->u.curve_p->coordlist[n];
7322                                 rep_inpcoord(
7323                                     &(Currstruct_p->u.curve_p->coordlist[n]),
7324                                     &(newlist_p[n]));
7325                         }
7326                         FREE(Currstruct_p->u.curve_p->coordlist);
7327                         Currstruct_p->u.curve_p->coordlist = newlist_p;
7328                 }
7329
7330                 /* Add this entry to the end of the list, update the
7331                  * tag reference to point to this permanent copy rather
7332                  * the temporary one we will be deleting, and update the
7333                  * count of how many elements in the list. */
7334                 curve_inpcoord_p = &(Currstruct_p->u.curve_p->coordlist
7335                                         [Currstruct_p->u.curve_p->ncoord]);
7336                 *curve_inpcoord_p = *(yyvsp[0].inpcoord_p);
7337                 rep_inpcoord(yyvsp[0].inpcoord_p, curve_inpcoord_p);
7338                 (Currstruct_p->u.curve_p->ncoord)++;
7339                 FREE(yyvsp[0].inpcoord_p);
7340         }
7341     break;
7342
7343   case 558:
7344 #line 5063 "gram.y"
7345     {
7346                 attach_stuff();
7347                 /* so reset flag */
7348                 Defining_multiple = NO;
7349         }
7350     break;
7351
7352   case 559:
7353 #line 5071 "gram.y"
7354     {
7355                 chk_stuff_header(yyvsp[-4].intval, yyvsp[-3].intval, yyvsp[-2].intval, Dist_usage);
7356                 add_to_sv_list();
7357         }
7358     break;
7359
7360   case 560:
7361 #line 5078 "gram.y"
7362     {
7363                 /* Separate rule for phrase because it has the linetype
7364                  * modifier in front, unlike any other STUFF. The size,
7365                  * and dist are not really allowed, but we match them
7366                  * if they are there in order to give more clear error
7367                  * message than just "syntax error," since there was
7368                  * already code elsewhere to check for these errors.
7369                  */
7370                 set_stuff_type(ST_PHRASE);
7371                 chk_stuff_header(yyvsp[-3].intval, yyvsp[-5].intval, yyvsp[-2].intval, Dist_usage);
7372                 add_to_sv_list();
7373         }
7374     break;
7375
7376   case 561:
7377 #line 5092 "gram.y"
7378     {
7379                 /* need a separate rule for midi, because it can include
7380                  * a voice as well as staff. It also cannot have the chord,
7381                  * size or place, although those are checked elsewhere anyway */
7382                 chk_stuff_header(-1, NO, PL_UNKNOWN, SD_NONE);
7383         }
7384     break;
7385
7386   case 562:
7387 #line 5101 "gram.y"
7388     {
7389                 set_stuff_type(ST_MIDI);
7390                 begin_range(PL_UNKNOWN);
7391         }
7392     break;
7393
7394   case 564:
7395 #line 5111 "gram.y"
7396     {
7397                 all();
7398                 add_to_sv_list();
7399         }
7400     break;
7401
7402   case 565:
7403 #line 5118 "gram.y"
7404     {
7405                 /* dummy token for sole purpose of saving away current
7406                  * stuff type. We have to do this in order to have it in
7407                  * time to figure out the default place for "all" */
7408                 set_stuff_type(yyvsp[0].intval);
7409         }
7410     break;
7411
7412   case 566:
7413 #line 5127 "gram.y"
7414     {
7415                 Curr_family = yyvsp[-1].intval;
7416
7417                 switch (yyvsp[0].intval) {
7418                 case FONT_TR:
7419                         yyval.intval = ST_ROM;
7420                         break;
7421                 case FONT_TI:
7422                         yyval.intval = ST_ITAL;
7423                         break;
7424                 case FONT_TB:
7425                         yyval.intval = ST_BOLD;
7426                         break;
7427                 case FONT_TX:
7428                         yyval.intval = ST_BOLDITAL;
7429                         break;
7430                 default:
7431                         pfatal("unknown font");
7432                         break;
7433                 }
7434         }
7435     break;
7436
7437   case 567:
7438 #line 5151 "gram.y"
7439     {
7440                 if (yyvsp[0].intval != L_NORMAL) {
7441                         /* user used 'dotted' or 'dashed' which applies only
7442                          * to use of T_L_ANGLE for slurs. Use generic error
7443                          * message so looks like any other similar error. */
7444                         yyerror("syntax error");
7445                 }
7446                 yyval.intval = ST_CRESC;
7447         }
7448     break;
7449
7450   case 568:
7451 #line 5163 "gram.y"
7452     {
7453                 yyval.intval = ST_DECRESC;
7454         }
7455     break;
7456
7457   case 569:
7458 #line 5169 "gram.y"
7459     {
7460                 yyval.intval = ST_PEDAL;
7461         }
7462     break;
7463
7464   case 570:
7465 #line 5175 "gram.y"
7466     {
7467                 yyval.intval = ST_MUSSYM;
7468         }
7469     break;
7470
7471   case 571:
7472 #line 5181 "gram.y"
7473     {
7474                 yyval.intval = ST_OCTAVE;
7475         }
7476     break;
7477
7478   case 572:
7479 #line 5187 "gram.y"
7480     {
7481                 /* use -1 to indicate user didn't specify so must use default */
7482                 yyval.intval = -1;
7483         }
7484     break;
7485
7486   case 573:
7487 #line 5194 "gram.y"
7488     {
7489                 yyval.intval = yyvsp[-1].intval;
7490         }
7491     break;
7492
7493   case 574:
7494 #line 5199 "gram.y"
7495     {
7496                 yyval.intval = TM_NONE;
7497         }
7498     break;
7499
7500   case 575:
7501 #line 5205 "gram.y"
7502     {
7503                 yyval.intval = yyvsp[0].intval;
7504         }
7505     break;
7506
7507   case 576:
7508 #line 5210 "gram.y"
7509     {
7510                 Dist = 0;
7511                 Dist_usage = SD_NONE;
7512         }
7513     break;
7514
7515   case 577:
7516 #line 5217 "gram.y"
7517     {
7518                 if (yyvsp[-1].intval != DIST) {
7519                         yyerror("unexpected parameter name instead of 'dist'");
7520                 }
7521                 else {
7522                         if (rangecheck(yyvsp[0].intval, -MAXDIST, MAXDIST, "dist") == YES) {
7523                                 Dist = yyvsp[0].intval;
7524                         }
7525                 }
7526         }
7527     break;
7528
7529   case 578:
7530 #line 5230 "gram.y"
7531     {
7532                 yyval.intval = yyvsp[-1].intval;
7533         }
7534     break;
7535
7536   case 579:
7537 #line 5236 "gram.y"
7538     {
7539                 if (Dist_usage != SD_FORCE) {
7540                         l_warning(Curr_filename, yylineno,
7541                                 "negative dist requires !, setting to 0");
7542                         yyval.intval = 0;
7543                 }
7544                 else {
7545                         yyval.intval = - yyvsp[-1].intval;
7546                 }
7547         }
7548     break;
7549
7550   case 580:
7551 #line 5248 "gram.y"
7552     {
7553                 Dist_usage = SD_MIN;
7554         }
7555     break;
7556
7557   case 581:
7558 #line 5254 "gram.y"
7559     {
7560                 Dist_usage = SD_FORCE;
7561         }
7562     break;
7563
7564   case 584:
7565 #line 5267 "gram.y"
7566     {
7567                 add_stuff_item(yyvsp[-4].floatval, yyvsp[-3].floatval, Gracebackup, yyvsp[-2].stringval, Til_bars, Til_offset,
7568                                                 Dist, Dist_usage);
7569         }
7570     break;
7571
7572   case 585:
7573 #line 5274 "gram.y"
7574     {
7575                 Til_bars = 0;
7576                 Til_offset = 0.0;
7577                 yyval.floatval = yyvsp[-1].floatval;
7578         }
7579     break;
7580
7581   case 586:
7582 #line 5281 "gram.y"
7583     {
7584                 Gracebackup = 0;
7585         }
7586     break;
7587
7588   case 587:
7589 #line 5287 "gram.y"
7590     {
7591                 Gracebackup = yyvsp[-1].intval;
7592         }
7593     break;
7594
7595   case 588:
7596 #line 5292 "gram.y"
7597     {
7598                 yyval.floatval = 0.0;
7599         }
7600     break;
7601
7602   case 589:
7603 #line 5298 "gram.y"
7604     {
7605                 yyval.floatval = yyvsp[-1].floatval * (float) yyvsp[-2].intval;
7606         }
7607     break;
7608
7609   case 590:
7610 #line 5303 "gram.y"
7611     {
7612                 yyval.stringval = (char *) 0;
7613         }
7614     break;
7615
7616   case 591:
7617 #line 5309 "gram.y"
7618     {
7619                 if (get_stuff_type() != ST_PEDAL) {
7620                         yyerror("'*' only valid with pedal");
7621                 }
7622                 MALLOCA(char, yyval.stringval, 12);
7623                 yyval.stringval[0] = FONT_MUSIC;
7624                 yyval.stringval[1] = DFLT_SIZE;
7625                 sprintf(yyval.stringval + 2, "\\(endped)");
7626         }
7627     break;
7628
7629   case 592:
7630 #line 5321 "gram.y"
7631     {
7632                 yyval.stringval = yyvsp[0].stringval;
7633         }
7634     break;
7635
7636   case 593:
7637 #line 5326 "gram.y"
7638     {
7639         }
7640     break;
7641
7642   case 594:
7643 #line 5331 "gram.y"
7644     {
7645         }
7646     break;
7647
7648   case 595:
7649 #line 5336 "gram.y"
7650     {
7651                 /** if there is a non-empty til_suffix, the floatnum better
7652                  ** have been an integer, and is really the number
7653                  * of bars. **/
7654                 if (yyvsp[0].intval == YES) {
7655                         Til_bars = (int) yyvsp[-1].floatval;
7656                         if (yyvsp[-1].floatval - Til_bars != 0.0) {
7657                                 yyerror("number of measures in til clause must be a whole number");
7658                         }
7659                 }
7660                 else {
7661                         /* only a number, that means it was really a beat offset */
7662                         Til_offset = yyvsp[-1].floatval;
7663                 }
7664         }
7665     break;
7666
7667   case 596:
7668 #line 5353 "gram.y"
7669     {
7670                 yyval.intval = NO;
7671         }
7672     break;
7673
7674   case 597:
7675 #line 5359 "gram.y"
7676     {
7677                 yyval.intval = YES;
7678         }
7679     break;
7680
7681   case 598:
7682 #line 5364 "gram.y"
7683     {
7684                 Til_offset = 0.0;
7685         }
7686     break;
7687
7688   case 599:
7689 #line 5370 "gram.y"
7690     {
7691                 Til_offset = yyvsp[0].floatval;
7692         }
7693     break;
7694
7695   case 601:
7696 #line 5378 "gram.y"
7697     {
7698                 newROLLINFO();
7699         }
7700     break;
7701
7702   case 602:
7703 #line 5384 "gram.y"
7704     {
7705                 newROLLINFO();
7706                 setrolldir(UP);
7707         }
7708     break;
7709
7710   case 603:
7711 #line 5391 "gram.y"
7712     {
7713                 newROLLINFO();
7714                 setrolldir(DOWN);
7715         }
7716     break;
7717
7718   case 605:
7719 #line 5402 "gram.y"
7720     {
7721                 /* save staffnum and voice 1 for start of roll */
7722                 rollparam(yyvsp[0].intval, 1, -1, -1);
7723         }
7724     break;
7725
7726   case 606:
7727 #line 5409 "gram.y"
7728     {
7729                 /* save staff and voice for start of roll */
7730                 rollparam(yyvsp[-1].intval, yyvsp[0].intval, -1, -1);
7731         }
7732     break;
7733
7734   case 608:
7735 #line 5418 "gram.y"
7736     {
7737                 /* save staffnum, voice 1 for end of roll */
7738                 rollparam(-1, -1, yyvsp[0].intval, 1);
7739         }
7740     break;
7741
7742   case 609:
7743 #line 5425 "gram.y"
7744     {
7745                 /* save staffnum and voice for end of roll */
7746                 rollparam(-1, -1, yyvsp[-1].intval, yyvsp[0].intval);
7747         }
7748     break;
7749
7750   case 610:
7751 #line 5432 "gram.y"
7752     {
7753                 rolloffset( (double) yyvsp[-1].floatval);
7754         }
7755     break;
7756
7757   case 611:
7758 #line 5438 "gram.y"
7759     {   
7760                 rolloffset( (double) yyvsp[-1].floatval);
7761         }
7762     break;
7763
7764   case 612:
7765 #line 5443 "gram.y"
7766     {
7767                 if (Curr_family == FAMILY_DFLT) {
7768                         Curr_family = Score.fontfamily;
7769                 }
7770                 Extra = extra_needed(Curr_family + Curr_font, Curr_size, yyvsp[0].stringval);
7771                 proc_printcmd(yyvsp[-2].intval, Curr_loc_info_p, yyvsp[0].stringval, Curr_family + Curr_font,
7772                         Curr_size, yyvsp[-1].intval, NO, (yyvsp[-1].intval == YES ? Extra : (double) 0.0));
7773         }
7774     break;
7775
7776   case 613:
7777 #line 5454 "gram.y"
7778     {
7779                 if (yyvsp[-1].intval == YES) {
7780                         warning("nl ignored for postscript");
7781                 }
7782                 proc_printcmd(J_NONE, Curr_loc_info_p, yyvsp[0].stringval, FONT_UNKNOWN,
7783                         DFLT_SIZE, NO, YES, (double) 0.0);
7784                 end_raw();
7785         }
7786     break;
7787
7788   case 614:
7789 #line 5465 "gram.y"
7790     {
7791                 begin_raw();
7792         }
7793     break;
7794
7795   case 616:
7796 #line 5473 "gram.y"
7797     {
7798                 /* this means print at default location */
7799                 Curr_loc_info_p = (struct INPCOORD *) 0;
7800                 yyval.intval = NO;
7801         }
7802     break;
7803
7804   case 617:
7805 #line 5481 "gram.y"
7806     {
7807                 Curr_loc_info_p = (struct INPCOORD *) 0;
7808                 yyval.intval = YES;
7809         }
7810     break;
7811
7812   case 618:
7813 #line 5488 "gram.y"
7814     {
7815                 yyval.intval = NO;
7816         }
7817     break;
7818
7819
7820     }
7821
7822 /* Line 1016 of /usr/share/bison/yacc.c.  */
7823 #line 7824 "y.tab.c"
7824 \f
7825   yyvsp -= yylen;
7826   yyssp -= yylen;
7827
7828
7829 #if YYDEBUG
7830   if (yydebug)
7831     {
7832       short *yyssp1 = yyss - 1;
7833       YYFPRINTF (stderr, "state stack now");
7834       while (yyssp1 != yyssp)
7835         YYFPRINTF (stderr, " %d", *++yyssp1);
7836       YYFPRINTF (stderr, "\n");
7837     }
7838 #endif
7839
7840   *++yyvsp = yyval;
7841
7842
7843   /* Now `shift' the result of the reduction.  Determine what state
7844      that goes to, based on the state we popped back to and the rule
7845      number reduced by.  */
7846
7847   yyn = yyr1[yyn];
7848
7849   yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
7850   if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
7851     yystate = yytable[yystate];
7852   else
7853     yystate = yydefgoto[yyn - YYNTOKENS];
7854
7855   goto yynewstate;
7856
7857
7858 /*------------------------------------.
7859 | yyerrlab -- here on detecting error |
7860 `------------------------------------*/
7861 yyerrlab:
7862   /* If not already recovering from an error, report this error.  */
7863   if (!yyerrstatus)
7864     {
7865       ++yynerrs;
7866 #if YYERROR_VERBOSE
7867       yyn = yypact[yystate];
7868
7869       if (YYPACT_NINF < yyn && yyn < YYLAST)
7870         {
7871           YYSIZE_T yysize = 0;
7872           int yytype = YYTRANSLATE (yychar);
7873           char *yymsg;
7874           int yyx, yycount;
7875
7876           yycount = 0;
7877           /* Start YYX at -YYN if negative to avoid negative indexes in
7878              YYCHECK.  */
7879           for (yyx = yyn < 0 ? -yyn : 0;
7880                yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
7881             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
7882               yysize += yystrlen (yytname[yyx]) + 15, yycount++;
7883           yysize += yystrlen ("parse error, unexpected ") + 1;
7884           yysize += yystrlen (yytname[yytype]);
7885           yymsg = (char *) YYSTACK_ALLOC (yysize);
7886           if (yymsg != 0)
7887             {
7888               char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
7889               yyp = yystpcpy (yyp, yytname[yytype]);
7890
7891               if (yycount < 5)
7892                 {
7893                   yycount = 0;
7894                   for (yyx = yyn < 0 ? -yyn : 0;
7895                        yyx < (int) (sizeof (yytname) / sizeof (char *));
7896                        yyx++)
7897                     if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
7898                       {
7899                         const char *yyq = ! yycount ? ", expecting " : " or ";
7900                         yyp = yystpcpy (yyp, yyq);
7901                         yyp = yystpcpy (yyp, yytname[yyx]);
7902                         yycount++;
7903                       }
7904                 }
7905               yyerror (yymsg);
7906               YYSTACK_FREE (yymsg);
7907             }
7908           else
7909             yyerror ("parse error; also virtual memory exhausted");
7910         }
7911       else
7912 #endif /* YYERROR_VERBOSE */
7913         yyerror ("parse error");
7914     }
7915   goto yyerrlab1;
7916
7917
7918 /*----------------------------------------------------.
7919 | yyerrlab1 -- error raised explicitly by an action.  |
7920 `----------------------------------------------------*/
7921 yyerrlab1:
7922   if (yyerrstatus == 3)
7923     {
7924       /* If just tried and failed to reuse lookahead token after an
7925          error, discard it.  */
7926
7927       /* Return failure if at end of input.  */
7928       if (yychar == YYEOF)
7929         {
7930           /* Pop the error token.  */
7931           YYPOPSTACK;
7932           /* Pop the rest of the stack.  */
7933           while (yyssp > yyss)
7934             {
7935               YYDPRINTF ((stderr, "Error: popping "));
7936               YYDSYMPRINT ((stderr,
7937                             yystos[*yyssp],
7938                             *yyvsp));
7939               YYDPRINTF ((stderr, "\n"));
7940               yydestruct (yystos[*yyssp], *yyvsp);
7941               YYPOPSTACK;
7942             }
7943           YYABORT;
7944         }
7945
7946       YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
7947                   yychar, yytname[yychar1]));
7948       yydestruct (yychar1, yylval);
7949       yychar = YYEMPTY;
7950     }
7951
7952   /* Else will try to reuse lookahead token after shifting the error
7953      token.  */
7954
7955   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
7956
7957   for (;;)
7958     {
7959       yyn = yypact[yystate];
7960       if (yyn != YYPACT_NINF)
7961         {
7962           yyn += YYTERROR;
7963           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
7964             {
7965               yyn = yytable[yyn];
7966               if (0 < yyn)
7967                 break;
7968             }
7969         }
7970
7971       /* Pop the current state because it cannot handle the error token.  */
7972       if (yyssp == yyss)
7973         YYABORT;
7974
7975       YYDPRINTF ((stderr, "Error: popping "));
7976       YYDSYMPRINT ((stderr,
7977                     yystos[*yyssp], *yyvsp));
7978       YYDPRINTF ((stderr, "\n"));
7979
7980       yydestruct (yystos[yystate], *yyvsp);
7981       yyvsp--;
7982       yystate = *--yyssp;
7983
7984
7985 #if YYDEBUG
7986       if (yydebug)
7987         {
7988           short *yyssp1 = yyss - 1;
7989           YYFPRINTF (stderr, "Error: state stack now");
7990           while (yyssp1 != yyssp)
7991             YYFPRINTF (stderr, " %d", *++yyssp1);
7992           YYFPRINTF (stderr, "\n");
7993         }
7994 #endif
7995     }
7996
7997   if (yyn == YYFINAL)
7998     YYACCEPT;
7999
8000   YYDPRINTF ((stderr, "Shifting error token, "));
8001
8002   *++yyvsp = yylval;
8003
8004
8005   yystate = yyn;
8006   goto yynewstate;
8007
8008
8009 /*-------------------------------------.
8010 | yyacceptlab -- YYACCEPT comes here.  |
8011 `-------------------------------------*/
8012 yyacceptlab:
8013   yyresult = 0;
8014   goto yyreturn;
8015
8016 /*-----------------------------------.
8017 | yyabortlab -- YYABORT comes here.  |
8018 `-----------------------------------*/
8019 yyabortlab:
8020   yyresult = 1;
8021   goto yyreturn;
8022
8023 #ifndef yyoverflow
8024 /*----------------------------------------------.
8025 | yyoverflowlab -- parser overflow comes here.  |
8026 `----------------------------------------------*/
8027 yyoverflowlab:
8028   yyerror ("parser stack overflow");
8029   yyresult = 2;
8030   /* Fall through.  */
8031 #endif
8032
8033 yyreturn:
8034 #ifndef yyoverflow
8035   if (yyss != yyssa)
8036     YYSTACK_FREE (yyss);
8037 #endif
8038   return yyresult;
8039 }
8040
8041
8042 #line 5493 "gram.y"
8043
8044
8045 #include <stdio.h>
8046
8047
8048 /* print error message along with current filename and line number */
8049
8050 int
8051 yyerror(msg)
8052
8053 char *msg;
8054
8055 {
8056         if (strncmp(msg, "syntax error", 12) == 0 ||
8057                         strncmp(msg, "parse error", 11) == 0) {
8058                 /* beef up yacc's default syntax error message */
8059                 if (*yytext == '\n') {
8060                         l_yyerror(Curr_filename, yylineno,
8061                                 "error detected at end of line (maybe missing semicolon or other required element?)");
8062                 }
8063                 else {
8064                         l_yyerror(Curr_filename, yylineno,
8065                                 "error detected at '%s'", yytext);
8066                 }
8067         }
8068         else {
8069                 l_yyerror(Curr_filename, yylineno, "%s", msg);
8070         }
8071
8072         /* return something to keep lint happy */
8073         return(0);
8074 }
8075 \f
8076
8077 /* if argument is surrounded by double quotes, remove them and return the
8078  * unquoted string. Actually just NULL out the end quote and return a
8079  * pointer to beyond the leading quote */
8080
8081 static char *
8082 stripquotes(string)
8083
8084 char *string;
8085
8086 {
8087         char *p;
8088
8089         p = string + strlen(string) - 1;
8090         if (*p == '"') {
8091                 *p = '\0';
8092         }
8093         return( *string == '"' ? string + 1 : string);
8094 }
8095
8096
8097 /* make sure each header/footer type specified only once */
8098
8099 static void
8100 chkdup_headfoot(flag, which)
8101
8102 int flag;       /* if non-zero, had gotten this head/foot before */
8103 char *which;    /* header, footer, header2 or footer2 */
8104
8105 {
8106         if (flag != 0) {
8107                 l_yyerror(Curr_filename, yylineno,
8108                                 "%s context specified more than once", which);
8109         }
8110 }
8111 \f
8112
8113 /* when entering new context, need to save away everything about current one */
8114
8115 static void
8116 end_prev_context()
8117
8118 {
8119         struct MAINLL *place_p;         /* where to insert SSV in main list */
8120
8121
8122         /* assume we will place at the end of main list. Later we'll set
8123          * the right value if that assumption is wrong */
8124         place_p = Mainlltc_p;
8125
8126         /* If current main list item hasn't been added to list yet,
8127          * do that now. */
8128         if (Currstruct_p != (struct MAINLL *) 0 && Currstruct_p != place_p) {
8129
8130                 if (Currstruct_p->str == S_SSV) {
8131
8132                         if (List_of_staffs_p != (struct MAINLL *) 0) {
8133                                 yyerror("can't change context inside a measure");
8134                                 Currstruct_p = (struct MAINLL *) 0;
8135                                 return;
8136                         }
8137
8138                         /* if is an SSV struct, we also need to set the
8139                          * correct values at this point, because the
8140                          * parser needs to know current values of some
8141                          * things (like font and point size) */
8142                         asgnssv(Currstruct_p->u.ssv_p);
8143
8144                         /* if this SSV is after a FEED, we have to move it
8145                          * before the FEED in order to follow the rules of
8146                          * what comes when on the main list */
8147                         for (   ; place_p != (struct MAINLL *) 0 &&
8148                                         place_p->str == S_FEED;
8149                                         place_p = place_p->prev) {
8150                         }
8151                 }
8152
8153                 insertMAINLL(Currstruct_p, place_p);
8154         }
8155
8156         if (Currstruct_p != 0 && Currstruct_p->str == S_SSV) {
8157                 /* memorize or recall beamstyle and timeunit if appropriate */
8158                 remember_tsig_params(Currstruct_p);
8159         }
8160
8161         Curr_grpsyl_p = (struct GRPSYL *) 0;
8162         Currblock_p = (struct BLOCKHEAD *) 0;
8163         set_win_coord(0);
8164 }
8165 \f
8166
8167 /* if defining more than one voice at the moment, not valid to set
8168  * a location variable. Print message and reset flag so we don't
8169  * give any more of the same message this measure */
8170
8171 static void
8172 var_valid()
8173
8174 {
8175         if (Defining_multiple == YES) {
8176                 yyerror("location tag is only allowed when defining a single voice");
8177                 Defining_multiple = NO;
8178         }
8179         else if (Chord_at_a_time == YES) {
8180                 yyerror("location tag not allowed with chord-at-a-time input");
8181         }
8182 }
8183 \f
8184
8185 /* do a print command like left, right, or center. Allocate a PRINTDATA
8186  * struct and fill in all the information about what to print and where
8187  * to print it. */
8188
8189 static void
8190 proc_printcmd(justifytype, inpc_p, str, font, size, got_nl, isPostScript, extra)
8191
8192 int justifytype;        /* J_LEFT, etc */
8193 struct INPCOORD *inpc_p;        /* where to print */
8194 char *str;              /* the string to print */
8195 int font;
8196 int size;
8197 int got_nl;     /* YES if should go to next line before printing */
8198 int isPostScript;       /* YES if is raw PostScript rather than normal print */
8199 double extra;   /* how much extra vetical padding to add */
8200
8201 {
8202         struct PRINTDATA *curr_print_p;
8203
8204
8205         (void) contextcheck(C_MUSIC | C_BLOCKHEAD, "print");
8206
8207         /* save all the info in a PRINTDATA struct */
8208         MALLOC(PRINTDATA, curr_print_p, 1);
8209
8210         if (inpc_p == (struct INPCOORD *) 0) {
8211
8212                 /* print at default location */
8213                 curr_print_p->location.vert_p = symval("_cur", (float **) 0);
8214
8215                 switch (justifytype) {
8216                 case J_LEFT:
8217                 case J_RAGPARA:
8218                 case J_JUSTPARA:
8219                         /* default x is relative to _win.w */
8220                         curr_print_p->location.hor_p = symval("_win", (float **) 0);
8221                         curr_print_p->location.htype = AW;
8222                         break;
8223                 case J_RIGHT:
8224                         /* default x is relative to _win.e */
8225                         curr_print_p->location.hor_p = symval("_win", (float **) 0);
8226                         curr_print_p->location.htype = AE;
8227                         break;
8228                 case J_CENTER:
8229                         /* default x is relative to _win.x */
8230                         curr_print_p->location.hor_p = symval("_win", (float **) 0);
8231                         curr_print_p->location.htype = AX;
8232                         break;
8233                 case J_NONE:
8234                 default:
8235                         /* default is at current location */
8236                         curr_print_p->location.hor_p = symval("_cur", (float **) 0);
8237                         curr_print_p->location.htype = AX;
8238                         break;
8239                 }
8240
8241                 curr_print_p->location.hsteps = 0.0;
8242                 curr_print_p->location.counts = 0.0;
8243                 curr_print_p->location.vtype = AY;
8244                 curr_print_p->location.vsteps = -extra;
8245
8246                 /* If this is the first print command in a block,
8247                  * we implicitly go down by the font ascent. */
8248                 if (isPostScript == NO && Currblock_p != 0
8249                                         && Next_print_link_p_p
8250                                         == &(Currblock_p->printdata_p) ) {
8251                         curr_print_p->location.vsteps -= fontascent(font, size)
8252                                                 / STEPSIZE;
8253                         got_nl = NO;
8254                 }
8255
8256         }
8257         else {
8258                 curr_print_p->location = *(inpc_p);
8259                 rep_inpcoord(inpc_p, &(curr_print_p->location) );
8260                 FREE(inpc_p);
8261         }
8262
8263         curr_print_p->isPostScript = isPostScript;
8264         if (isPostScript == YES) {
8265                 curr_print_p->width = 0.0;
8266         }
8267         else {
8268                 curr_print_p->width = strwidth(str);
8269         }
8270         curr_print_p->justifytype = (short) justifytype;
8271         curr_print_p->string = str;
8272         curr_print_p->inputfile = Curr_filename;
8273         curr_print_p->inputlineno = (short) yylineno;
8274
8275         /* special case of user asking that this be printed
8276          * on the next line. In this case we go down by the
8277          * current point size */
8278         if (got_nl) {
8279                 curr_print_p->location.vsteps -=
8280                                         fontheight(font, size) / STEPSIZE;
8281         }
8282
8283         /* Now link onto proper list -- could be in BLOCKHEAD
8284          * context or doing a PRHEAD. If we are in BLOCKHEAD context, we
8285          * definitely have something in the main list to attach to.
8286          * If in C_MUSIC, we may or may not depending on whether
8287          * this is the first in a series of print commands. */
8288         if ( ((Context & C_BLOCKHEAD) != 0)
8289                 || ((Currstruct_p != (struct MAINLL *) 0) &&
8290                 (Currstruct_p->str == S_PRHEAD) ) ) {
8291                         if (Next_print_link_p_p == (struct PRINTDATA **) 0) {
8292                                 pfatal("Next_print_link_p_p is null");
8293                         }
8294                         /* this means the value of Next_print_link_p_p
8295                          * is valid and will tell us where to link */
8296                         *Next_print_link_p_p = curr_print_p;
8297         }
8298         else {
8299                 /* We must be in music context, but the last
8300                  * thing we saw wasn't a print command, so
8301                  * we have to allocate a PRHEAD and put it
8302                  * in the main list and attach to that. */
8303                 /* allocate a new struct, put on main list and attach
8304                  * the print command to it */
8305                 Currstruct_p = newMAINLLstruct(S_PRHEAD, yylineno);
8306                 insertMAINLL(Currstruct_p, Mainlltc_p);
8307                 Currstruct_p->u.prhead_p->printdata_p = curr_print_p;
8308                 Currstruct_p = (struct MAINLL *) 0;
8309         }
8310
8311         /* in any case, if we get another print command right away, it
8312          * should be linked onto this one, so remember where we are */
8313         Next_print_link_p_p = &(curr_print_p->next);
8314         curr_print_p->next = (struct PRINTDATA *) 0;
8315 }
8316 \f
8317
8318 /* if the given string has a higher ascent than the given font/size, return
8319  * the amount is it higher, in stepsizes */
8320
8321 static double
8322 extra_needed(font, size, string)
8323
8324 int font;       /* default font for this string */
8325 int size;       /* default size for this string */
8326 char *string;   /* string, which might contain \s(xx) to make it bigger
8327                  * than normal */
8328
8329 {
8330         double usual_ascent;
8331         double this_string_ascent;
8332
8333
8334         /* get expected ascent for this font/size and actual for string */
8335         usual_ascent = fontascent(font, size);
8336         (void) fix_string(string, font, size, Curr_filename, yylineno);
8337         this_string_ascent = strascent(string);
8338
8339         /* if this string is too tall, return by how much it is too tall */
8340         if (this_string_ascent > usual_ascent) {
8341                 return (this_string_ascent - usual_ascent) / STEPSIZE;
8342         }
8343         else {
8344                 return(0.0);
8345         }
8346 }
8347 \f
8348
8349 /* Sometimes lexer will recognize something as a keyword, but it's
8350  * really a bunch of note letters, due to context. This function turns
8351  * the mistaken keyword into notes. It handles a through g and r and s, but
8352  * not n and u which would also be troublesome.
8353  */
8354
8355 static void
8356 keyword_notes(str)
8357
8358 char *str;
8359
8360 {
8361         for (  ; *str != '\0'; str++) {
8362                 /* On the last letter, if it's a true pitch, have to
8363                  * push it back into input, because it could be followed
8364                  * by an accidental or octave mark or tick or something. */
8365                 if (*(str+1) == '\0' && *str >= 'a' && *str <= 'g') {
8366                         pushback(*str);
8367                 }
8368                 else {
8369                         add_note(Curr_grpsyl_p, (int) *str, 0, USE_DFLT_OCTAVE,
8370                                                         0, NO, (char *) 0);
8371                 }
8372         }
8373 }
8374 \f
8375
8376 /* Free up the current additive time list, if any */
8377
8378 static void
8379 free_extra_time()
8380 {
8381         struct TIMELIST *tl_p;
8382
8383         /* If this was the most recently allocated list, we can free it.
8384          * We can't free otherwise, since Extra_time_p might be
8385          * pointing to one from an SSV, which must be kept around. */
8386         if (Extra_time_p == Last_alloced_timelist_p) {
8387                 while (Extra_time_p != 0) {
8388                         tl_p = Extra_time_p->next;
8389                         FREE(Extra_time_p);
8390                         Extra_time_p = tl_p;
8391                 }
8392         }
8393         Extra_time_p = 0;
8394         Last_alloced_timelist_p = 0;
8395         Curr_timelist_p = 0;
8396 }
8397 \f
8398
8399 /* Add an item to the internal representation of the time signature
8400  * currently being collected */
8401
8402 static void
8403 tsig_item(item)
8404
8405 int item;       /* the byte to add to timerep */
8406
8407 {
8408         if (Tsig_offset >= MAXTSLEN  - 1) {
8409                 l_ufatal(Curr_filename, yylineno,
8410                                 "time signature is too complicated");
8411         }
8412         Timerep[Tsig_offset++] = (char) item;
8413 }
8414