Debian Codegraph @

texk/gregorio/gregorio-src/src/gabc/gabc-score-determination-y.c

raw
1 /* A Bison parser, made by GNU Bison 3.8.2. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
6 Inc.
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <https://www.gnu.org/licenses/>. */
20
21 /* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
30
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
33
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
36
37 /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38 especially those whose name start with YY_ or yy_. They are
39 private implementation details that can be changed or removed. */
40
41 /* All symbols defined below should begin with yy or YY, to avoid
42 infringing on user name space. This should be done even for local
43 variables, as they might otherwise be expanded by user macros.
44 There are some unavoidable exceptions within include files to
45 define necessary library symbols; they are noted "INFRINGES ON
46 USER NAME SPACE" below. */
47
48 /* Identify Bison output, and Bison version. */
49 #define YYBISON 30802
50
51 /* Bison version string. */
52 #define YYBISON_VERSION "3.8.2"
53
54 /* Skeleton name. */
55 #define YYSKELETON_NAME "yacc.c"
56
57 /* Pure parsers. */
58 #define YYPURE 0
59
60 /* Push parsers. */
61 #define YYPUSH 0
62
63 /* Pull parsers. */
64 #define YYPULL 1
65
66
67 /* Substitute the variable and function names. */
68 #define yyparse gabc_score_determination_parse
69 #define yylex gabc_score_determination_lex
70 #define yyerror gabc_score_determination_error
71 #define yydebug gabc_score_determination_debug
72 #define yynerrs gabc_score_determination_nerrs
73 #define yylval gabc_score_determination_lval
74 #define yychar gabc_score_determination_char
75 #define yylloc gabc_score_determination_lloc
76
77 /* First part of user prologue. */
78 #line 1 "gabc/gabc-score-determination.y"
79
80 /*
81 * Gregorio is a program that translates gabc files to GregorioTeX
82 * This file implements the score parser.
83 *
84 * Gregorio score determination from gabc.
85 * Copyright (C) 2006-2025 The Gregorio Project (see CONTRIBUTORS.md)
86 *
87 * This file is part of Gregorio.
88 *
89 * This program is free software: you can redistribute it and/or modify it
90 * under the terms of the GNU General Public License as published by the Free
91 * Software Foundation, either version 3 of the License, or (at your option)
92 * any later version.
93 *
94 * This program is distributed in the hope that it will be useful, but WITHOUT
95 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
96 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
97 * more details.
98 *
99 * You should have received a copy of the GNU General Public License along with
100 * this program. If not, see <http://www.gnu.org/licenses/>.
101 */
102
103 /*
104 *
105 * This file is certainly not the most easy to understand, it is a bison file.
106 * See the bison manual on gnu.org for further details.
107 *
108 */
109
110 #include "config.h"
111 #include <stdio.h>
112 #include <stdlib.h>
113 #include <assert.h>
114 #include "bool.h"
115 #include "struct.h"
116 #include "unicode.h"
117 #include "messages.h"
118 #include "characters.h"
119 #include "support.h"
120 #include "sha1.h"
121 #include "plugins.h"
122 #include "gabc.h"
123
124 #define YYLLOC_DEFAULT(Current, Rhs, N) \
125 if (N) { \
126 (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
127 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
128 (Current).first_offset = YYRHSLOC (Rhs, 1).first_offset; \
129 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
130 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
131 (Current).last_offset = YYRHSLOC (Rhs, N).last_offset; \
132 (Current).generate_point_and_click = YYRHSLOC (Rhs, 1).generate_point_and_click; \
133 } else { \
134 (Current).first_line = (Current).last_line = YYRHSLOC (Rhs, 0).last_line; \
135 (Current).first_column = (Current).last_column = YYRHSLOC (Rhs, 0).last_column; \
136 (Current).first_offset = (Current).last_offset = YYRHSLOC (Rhs, 0).last_offset; \
137 (Current).first_offset = (Current).last_offset = YYRHSLOC (Rhs, 0).last_offset; \
138 (Current).generate_point_and_click = YYRHSLOC (Rhs, 0).generate_point_and_click; \
139 }
140
141 #include "gabc-score-determination.h"
142 #include "gabc-score-determination-l.h"
143
144 /* SB_IGNORE used to ignore a style that don't stay open between syllables */
145 #define GABC_STYLE_BITS(A,E,X,L) \
146 A(SB_IGNORE, 0x00) \
147 A(SB_ITALIC, 0x01) \
148 A(SB_BOLD, 0x02) \
149 A(SB_TT, 0x04) \
150 A(SB_SMALL_CAPS, 0x08) \
151 A(SB_UNDERLINED, 0x10) \
152 A(SB_COLORED, 0x20) \
153 X(SB_ELISION, 0x40)
154 ENUM(gabc_style_bits, GABC_STYLE_BITS);
155
156 ENUM_TO_STRING(gabc_style_bits, GABC_STYLE_BITS)
157
158 /* forward declaration of the flex/bison process function */
159 static int gabc_score_determination_parse(void);
160
161 /* uncomment it if you want to have an interactive shell to understand the
162 * details on how bison works for a certain input */
163 /* int gabc_score_determination_debug=1; */
164
165 /*
166 *
167 * We will need some variables and functions through the entire file, we
168 * declare them there:
169 *
170 */
171
172 /* the score that we will determine and return */
173 static gregorio_score *score;
174 /* an array of elements that we will use for each syllable */
175 static gregorio_element **elements;
176 gregorio_element *current_element;
177 /* a table containing the macros to use in gabc file */
178 static char *macros[10];
179 /* other variables that we will have to use */
180 static gregorio_character *current_character;
181 static gregorio_character *suspended_character;
182 static gregorio_character *first_text_character;
183 static gregorio_character *first_translation_character;
184 static gregorio_tr_centering translation_type;
185 static gregorio_nlba no_linebreak_area;
186 static gregorio_euouae euouae;
187 static gregorio_voice_info *current_voice_info;
188 static int number_of_voices;
189 static int voice;
190 /* see comments on text to understand this */
191 static gregorio_center_determination center_is_determined;
192 /* current_key is... the current key... updated by each notes determination
193 * (for key changes) */
194 static int current_key;
195 static bool got_language;
196 static bool got_staff_lines;
197 static bool started_first_word;
198 static struct sha1_ctx digester;
199 /* used to track styles that stay open across syllables */
200 static gabc_style_bits styles;
201 static bool generate_point_and_click;
202 static bool clear_syllable_text;
203 static bool has_protrusion;
204
205 /* punctum_inclinatum_orientation maintains the running punctum inclinatum
206 * orientation in order to decide if the glyph needs to be cut when a punctum
207 * inclinatum with forced orientation is encountered. This should be set to
208 * the shape of a non-liquescent punctum inclinatum with forced orientation
209 * when one is encountered, be left alone when a non-liquescent punctum
210 * inclinatum with undetermined orientation is encountered, or be reset to
211 * S_PUNCTUM_INCLINATUM_UNDETERMINED otherwise (because such ends any previous
212 * run of punctum inclinatum notes). Based on the assumption that a punctum
213 * inclinatum with forced orientation changes all the punctum inclinatum shapes
214 * with undetermined orientation in the same run of notes before and after it
215 * unless influenced by an earlier punctum inclinatum with forced orientation,
216 * the value of punctum_inclinatum_orientation can be used to determine if a
217 * punctum inclinatum with a forced orientation will have a different
218 * orientation than the punctum inclinatum immediately before it, which would
219 * require a cut of the glyph. */
220 static gregorio_shape punctum_inclinatum_orientation;
221
222 static __inline void check_multiple(const char *name, bool exists) {
223 if (exists) {
224 gregorio_messagef("det_score", VERBOSITY_WARNING, 0,
225 _("several %s definitions found, only the last will be taken "
226 "into consideration"), name);
227 }
228 }
229
230 static void gabc_score_determination_error(const char *error_str)
231 {
232 gregorio_message(error_str, (const char *) "gabc_score_determination_parse",
233 VERBOSITY_ERROR, 0);
234 }
235
236 /*
237 * The function that will initialize the variables.
238 */
239
240 static void initialize_variables(bool point_and_click)
241 {
242 int i;
243 /* build a brand new empty score */
244 score = gregorio_new_score();
245 /* initialization of the first voice info to an empty voice info */
246 current_voice_info = NULL;
247 gregorio_add_voice_info(&current_voice_info);
248 score->first_voice_info = current_voice_info;
249 /* other initializations */
250 number_of_voices = 1;
251 voice = 0; /* first (and only) voice */
252 current_character = NULL;
253 suspended_character = NULL;
254 first_translation_character = NULL;
255 first_text_character = NULL;
256 translation_type = TR_NORMAL;
257 no_linebreak_area = NLBA_NORMAL;
258 euouae = EUOUAE_NORMAL;
259 center_is_determined = CENTER_NOT_DETERMINED;
260 current_key = gregorio_calculate_new_key(gregorio_default_clef);
261 for (i = 0; i < 10; i++) {
262 macros[i] = NULL;
263 }
264 got_language = false;
265 got_staff_lines = false;
266 started_first_word = false;
267 styles = 0;
268 punctum_inclinatum_orientation = S_PUNCTUM_INCLINATUM_UNDETERMINED;
269 generate_point_and_click = point_and_click;
270 clear_syllable_text = false;
271 has_protrusion = false;
272 }
273
274 /*
275 * function that frees the variables that need it, for when we have finished to
276 * determine the score
277 */
278
279 static void free_variables(void)
280 {
281 int i;
282 free(elements);
283 for (i = 0; i < 10; i++) {
284 free(macros[i]);
285 }
286 }
287
288 /*
289 * Function called when we have reached the end of the definitions, it tries to
290 * make the voice_infos coherent.
291 */
292 static void end_definitions(void)
293 {
294 int i;
295
296 gregorio_assert_only(gabc_check_infos_integrity(score), end_definitions,
297 "can't determine valid infos on the score");
298
299 elements = (gregorio_element **) gregorio_malloc(number_of_voices *
300 sizeof(gregorio_element *));
301 for (i = 0; i < number_of_voices; i++) {
302 elements[i] = NULL;
303 }
304
305 if (!got_language) {
306 static char latin[] = "Latin";
307 gregorio_set_centering_language(latin);
308 }
309 }
310
311 /*
312 * Here starts the code for the determinations of the notes. The notes are not
313 * precisely determined here, we separate the text describing the notes of each
314 * voice, and we call determine_elements_from_string to really determine them.
315 */
316 static char position = WORD_BEGINNING;
317 static gregorio_syllable *current_syllable = NULL;
318 static char *abovelinestext = NULL;
319
320 /*
321 * Function called each time we find a space, it updates the current position.
322 */
323 static void update_position_with_space(void)
324 {
325 if (position == WORD_MIDDLE) {
326 position = WORD_END;
327 }
328 if (position == WORD_BEGINNING) {
329 position = WORD_ONE_SYLLABLE;
330 }
331 }
332
333 /*
334 * When we encounter a translation center ending, we call this function that
335 * sets translation_type = TR_WITH_CENTER_BEGINNING on previous syllable with
336 * translation
337 */
338 static void gregorio_set_translation_center_beginning(
339 gregorio_syllable *current_syllable)
340 {
341 gregorio_syllable *syllable = current_syllable->previous_syllable;
342 while (syllable) {
343 if (syllable->translation_type == TR_WITH_CENTER_END) {
344 gregorio_message("encountering translation centering end but "
345 "cannot find translation centering beginning...",
346 "set_translation_center_beginning", VERBOSITY_ERROR, 0);
347 current_syllable->translation_type = TR_NORMAL;
348 return;
349 }
350 if (syllable->translation) {
351 syllable->translation_type = TR_WITH_CENTER_BEGINNING;
352 return;
353 }
354 syllable = syllable->previous_syllable;
355 }
356 /* we didn't find any beginning... */
357 gregorio_message("encountering translation centering end but cannot find "
358 "translation centering beginning...",
359 "set_translation_center_beginning", VERBOSITY_ERROR, 0);
360 current_syllable->translation_type = TR_NORMAL;
361 }
362
363 static void ready_characters(void)
364 {
365 if (current_character) {
366 gregorio_go_to_first_character_c(&current_character);
367 if (!score->first_syllable || (current_syllable
368 && !current_syllable->previous_syllable
369 && !current_syllable->text)) {
370 started_first_word = true;
371 }
372 }
373 }
374
375 static void rebuild_score_characters(void)
376 {
377 if (score->first_syllable) {
378 gregorio_syllable *syllable;
379 for (syllable = score->first_syllable; syllable;
380 syllable = syllable->next_syllable) {
381 const gregorio_character *t;
382
383 /* find out if there is a forced center */
384 gregorio_center_determination center = CENTER_NOT_DETERMINED;
385 for (t = syllable->text; t; t = t->next_character) {
386 if (!t->is_character && t->cos.s.style == ST_FORCED_CENTER) {
387 syllable->forced_center = true;
388 center = CENTER_FULLY_DETERMINED;
389 break;
390 }
391 }
392
393 if (syllable == score->first_syllable) {
394 /* leave the first syllable text untouched at this time */
395 continue;
396 }
397
398 gregorio_rebuild_characters(&(syllable->text), center, false);
399
400 if (syllable->first_word) {
401 gregorio_set_first_word(&(syllable->text));
402 }
403 }
404 }
405 }
406
407 /*
408 *
409 * The two functions called when lex returns a style, we simply add it. All the
410 * complex things will be done by the function after...
411 *
412 */
413
414 static void add_style(grestyle_style style, gabc_style_bits bit);
415
416 static void maybe_insert_open_styles(void)
417 {
418 if (!current_character) {
419 /* insert open styles, leaving out ELISION on purpose */
420 if (styles & SB_ITALIC) {
421 gregorio_begin_style(&current_character, ST_ITALIC);
422 }
423 if (styles & SB_BOLD) {
424 gregorio_begin_style(&current_character, ST_BOLD);
425 }
426 if (styles & SB_TT) {
427 gregorio_begin_style(&current_character, ST_TT);
428 }
429 if (styles & SB_SMALL_CAPS) {
430 gregorio_begin_style(&current_character, ST_SMALL_CAPS);
431 }
432 if (styles & SB_UNDERLINED) {
433 gregorio_begin_style(&current_character, ST_UNDERLINED);
434 }
435 if (styles & SB_COLORED) {
436 gregorio_begin_style(&current_character, ST_COLORED);
437 }
438 }
439 }
440
441 static void add_style(grestyle_style style, gabc_style_bits bit)
442 {
443 maybe_insert_open_styles();
444 if (bit) {
445 if (styles & bit) {
446 gregorio_messagef("add_style", VERBOSITY_ERROR, 0,
447 _("style already started: %s"),
448 gabc_style_bits_to_string(bit));
449 } else {
450 styles ^= bit;
451 }
452 }
453 gregorio_begin_style(&current_character, style);
454 }
455
456 static void end_style(grestyle_style style, gabc_style_bits bit)
457 {
458 maybe_insert_open_styles();
459 if (bit) {
460 if (styles & bit) {
461 styles ^= bit;
462 } else {
463 gregorio_messagef("end_style", VERBOSITY_ERROR, 0,
464 _("style not started: %s"),
465 gabc_style_bits_to_string(bit));
466 }
467 }
468 gregorio_end_style(&current_character, style);
469 }
470
471 static __inline void save_text(void)
472 {
473 if (has_protrusion) {
474 end_style(ST_PROTRUSION, SB_IGNORE);
475 }
476 ready_characters();
477 first_text_character = current_character;
478 }
479
480 /* a function called when we see a [, basically, all characters are added to
481 * the translation pointer instead of the text pointer */
482 static void start_translation(unsigned char asked_translation_type)
483 {
484 suspended_character = current_character;
485 /* the middle letters of the translation have no sense */
486 /*center_is_determined = CENTER_FULLY_DETERMINED;*/
487 current_character = NULL;
488 translation_type = asked_translation_type;
489 }
490
491 static void end_translation(void)
492 {
493 ready_characters();
494 first_translation_character = current_character;
495 current_character = suspended_character;
496 }
497
498 /*
499 * add_text is the function called when lex returns a char *. In
500 * this function we convert it into grewchar, and then we add the corresponding
501 * gregorio_characters in the list of gregorio_characters.
502 */
503
504 static void add_text(char *mbcharacters)
505 {
506 maybe_insert_open_styles();
507 if (current_character) {
508 current_character->next_character = gregorio_build_char_list_from_buf(
509 mbcharacters);
510 current_character->next_character->previous_character =
511 current_character;
512 } else {
513 current_character = gregorio_build_char_list_from_buf(mbcharacters);
514 }
515 while (current_character && current_character->next_character) {
516 current_character = current_character->next_character;
517 }
518 free(mbcharacters);
519 }
520
521 static void add_protrusion(char *factor)
522 {
523 if (has_protrusion) {
524 gregorio_message("syllable already has protrusion; pr tag ignored",
525 "det_score", VERBOSITY_WARNING, 0);
526 free(factor);
527 } else {
528 if (center_is_determined == CENTER_HALF_DETERMINED) {
529 gregorio_message("closing open syllable center before protrusion",
530 "det_score", VERBOSITY_WARNING, 0);
531 end_style(ST_FORCED_CENTER, SB_IGNORE);
532 center_is_determined = CENTER_FULLY_DETERMINED;
533 }
534
535 add_style(ST_PROTRUSION_FACTOR, SB_IGNORE);
536 add_text(factor);
537 end_style(ST_PROTRUSION_FACTOR, SB_IGNORE);
538 add_style(ST_PROTRUSION, SB_IGNORE);
539 has_protrusion = true;
540 }
541 }
542
543 static void add_auto_protrusion(char *protrusion)
544 {
545 if (has_protrusion) {
546 add_text(protrusion);
547 } else {
548 add_style(ST_PROTRUSION_FACTOR, SB_IGNORE);
549 add_style(ST_VERBATIM, SB_IGNORE);
550 add_text(gregorio_strdup("\\GreProtrusionFactor{"));
551
552 switch (*protrusion) {
553 case ',':
554 add_text(gregorio_strdup("comma"));
555 break;
556 case ';':
557 add_text(gregorio_strdup("semicolon"));
558 break;
559 case ':':
560 add_text(gregorio_strdup("colon"));
561 break;
562 case '.':
563 add_text(gregorio_strdup("period"));
564 break;
565 default:
566 /* not reachable unless there's a programming error */
567 /* LCOV_EXCL_START */
568 gregorio_fail2(add_auto_protrusion,
569 "unsupported protruding punctuation: %c", *protrusion);
570 break;
571 /* LCOV_EXCL_STOP */
572 }
573
574 add_text(gregorio_strdup("}"));
575 end_style(ST_VERBATIM, SB_IGNORE);
576 end_style(ST_PROTRUSION_FACTOR, SB_IGNORE);
577
578 add_style(ST_PROTRUSION, SB_IGNORE);
579 add_text(protrusion);
580 end_style(ST_PROTRUSION, SB_IGNORE);
581
582 has_protrusion = true;
583 }
584 }
585
586 /*
587 * Function to close a syllable and update the position.
588 */
589
590 static void close_syllable(YYLTYPE *loc)
591 {
592 int i = 0;
593 gregorio_character *ch;
594
595 /* make sure any elisions that are opened are closed within the syllable */
596 for (ch = first_text_character; ch; ch = ch->next_character) {
597 if (!ch->is_character) {
598 switch (ch->cos.s.style) {
599 case ST_ELISION:
600 switch (ch->cos.s.type) {
601 case ST_T_BEGIN:
602 ++i;
603 /* the parser precludes this from falling here */
604 gregorio_assert_only(i <= 1, close_syllable,
605 "elisions may not be nested");
606 break;
607
608 case ST_T_END:
609 --i;
610 /* the parser precludes this from failing here */
611 gregorio_assert_only(i >= 0, close_syllable,
612 "encountered elision end with no beginning");
613 break;
614
615 case ST_T_NOTHING:
616 /* not reachable unless there's a programming error */
617 /* LCOV_EXCL_START */
618 gregorio_fail(close_syllable, "encountered ST_T_NOTHING");
619 break;
620 /* LCOV_EXCL_STOP */
621 }
622 break;
623
624 case ST_FORCED_CENTER:
625 if (i > 0) {
626 gregorio_message(
627 _("forced center may not be within an elision"),
628 "close_syllable", VERBOSITY_ERROR, 0);
629 }
630 break;
631
632 default:
633 break;
634 }
635 }
636 }
637 /* the parser precludes this from failing here */
638 gregorio_assert_only(i == 0, close_syllable,
639 "encountered elision beginning with no end");
640
641 gregorio_add_syllable(&current_syllable, number_of_voices, elements,
642 first_text_character, first_translation_character, position,
643 abovelinestext, translation_type, no_linebreak_area, euouae, loc,
644 started_first_word, clear_syllable_text);
645 if (!score->first_syllable) {
646 /* we rebuild the first syllable if we have to */
647 score->first_syllable = current_syllable;
648 }
649 if (translation_type == TR_WITH_CENTER_END) {
650 gregorio_set_translation_center_beginning(current_syllable);
651 }
652 /* we update the position */
653 if (position == WORD_BEGINNING) {
654 position = WORD_MIDDLE;
655 }
656 if (position == WORD_ONE_SYLLABLE || position == WORD_END) {
657 position = WORD_BEGINNING;
658
659 if (started_first_word) {
660 started_first_word = false;
661 }
662 }
663 center_is_determined = CENTER_NOT_DETERMINED;
664 current_character = NULL;
665 suspended_character = NULL;
666 first_text_character = NULL;
667 first_translation_character = NULL;
668 translation_type = TR_NORMAL;
669 no_linebreak_area = NLBA_NORMAL;
670 euouae = EUOUAE_NORMAL;
671 abovelinestext = NULL;
672 for (i = 0; i < number_of_voices; i++) {
673 elements[i] = NULL;
674 }
675 current_element = NULL;
676 clear_syllable_text = false;
677 has_protrusion = false;
678 }
679
680 void gabc_digest(const void *const buf, const size_t size)
681 {
682 sha1_process_bytes(buf, size, &digester);
683 }
684
685 /*
686 * The "main" function. It is the function that is called when we have to read
687 * a gabc file. It takes a file descriptor, that is to say a file that is
688 * aleady open. It returns a valid gregorio_score
689 */
690
691 gregorio_score *gabc_read_score(FILE *f_in, bool point_and_click)
692 {
693 /* compute the SHA-1 digest while parsing, for I/O efficiency */
694 sha1_init_ctx(&digester);
695 /* digest GREGORIO_VERSION to get a different value when the version
696 changes */
697 sha1_process_bytes(GREGORIO_VERSION, strlen(GREGORIO_VERSION), &digester);
698 /* the input file that flex will parse */
699 gabc_score_determination_in = f_in;
700 gregorio_assert(f_in, gabc_read_score, "can't read stream from NULL",
701 return NULL);
702 initialize_variables(point_and_click);
703 /* the flex/bison main call, it will build the score (that we have
704 * initialized) */
705 gabc_score_determination_parse();
706 if (!score->legacy_oriscus_orientation) {
707 gabc_determine_oriscus_orientation(score);
708 }
709 gabc_determine_punctum_inclinatum_orientation(score);
710 gabc_determine_ledger_lines(score);
711 gregorio_fix_initial_keys(score, gregorio_default_clef);
712 rebuild_score_characters();
713 gabc_suppress_extra_custos_at_linebreak(score);
714 gabc_fix_custos_pitches(score);
715 gabc_det_notes_finish();
716 free_variables();
717 /* then we check the validity and integrity of the score we have built. */
718 if (!gabc_check_score_integrity(score)) {
719 gregorio_message(_("unable to determine a valid score from file"),
720 "gabc_read_score", VERBOSITY_ERROR, 0);
721 }
722 sha1_finish_ctx(&digester, score->digest);
723 return score;
724 }
725
726 unsigned char nabc_state = 0;
727 size_t nabc_lines = 0;
728
729 static void gabc_y_add_notes(char *notes, YYLTYPE loc) {
730 if (nabc_state == 0) {
731 if (!elements[voice]) {
732 elements[voice] = gabc_det_elements_from_string(notes, &current_key,
733 macros, &loc, &punctum_inclinatum_orientation, score);
734 current_element = elements[voice];
735 } else {
736 gregorio_element *new_elements = gabc_det_elements_from_string(
737 notes, &current_key, macros, &loc,
738 &punctum_inclinatum_orientation, score);
739 gregorio_element *last_element = elements[voice];
740 while (last_element->next) {
741 last_element = last_element->next;
742 }
743 last_element->next = new_elements;
744 new_elements->previous = last_element;
745 current_element = new_elements;
746 }
747 } else {
748 if (!elements[voice]) {
749 gregorio_add_element(&elements[voice], NULL);
750 current_element = elements[voice];
751 }
752 gregorio_assert(current_element, gabc_y_add_notes,
753 "current_element is null, this shouldn't happen!",
754 return);
755 if (!current_element->nabc) {
756 current_element->nabc = (char **) gregorio_calloc (nabc_lines,
757 sizeof (char *));
758 }
759 current_element->nabc[nabc_state-1] = gregorio_strdup(notes);
760 current_element->nabc_lines = nabc_state;
761 }
762 }
763
764 static char *concatenate(char *first, char *const second) {
765 first = (char *)gregorio_realloc(first, strlen(first) + strlen(second) + 1);
766 strcat(first, second);
767 free(second);
768 return first;
769 }
770
771 #line 772 "gabc/gabc-score-determination-y.c"
772
773 # ifndef YY_CAST
774 # ifdef __cplusplus
775 # define YY_CAST(Type, Val) static_cast<Type> (Val)
776 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
777 # else
778 # define YY_CAST(Type, Val) ((Type) (Val))
779 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
780 # endif
781 # endif
782 # ifndef YY_NULLPTR
783 # if defined __cplusplus
784 # if 201103L <= __cplusplus
785 # define YY_NULLPTR nullptr
786 # else
787 # define YY_NULLPTR 0
788 # endif
789 # else
790 # define YY_NULLPTR ((void*)0)
791 # endif
792 # endif
793
794 #include "gabc-score-determination-y.h"
795 /* Symbol kind. */
796 enum yysymbol_kind_t
797 {
798 YYSYMBOL_YYEMPTY = -2,
799 YYSYMBOL_YYEOF = 0, /* "end of file" */
800 YYSYMBOL_YYerror = 1, /* error */
801 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
802 YYSYMBOL_NAME = 3, /* NAME */
803 YYSYMBOL_AUTHOR = 4, /* AUTHOR */
804 YYSYMBOL_GABC_COPYRIGHT = 5, /* GABC_COPYRIGHT */
805 YYSYMBOL_SCORE_COPYRIGHT = 6, /* SCORE_COPYRIGHT */
806 YYSYMBOL_LANGUAGE = 7, /* LANGUAGE */
807 YYSYMBOL_STAFF_LINES = 8, /* STAFF_LINES */
808 YYSYMBOL_ORISCUS_ORIENTATION = 9, /* ORISCUS_ORIENTATION */
809 YYSYMBOL_DEF_MACRO = 10, /* DEF_MACRO */
810 YYSYMBOL_OTHER_HEADER = 11, /* OTHER_HEADER */
811 YYSYMBOL_ANNOTATION = 12, /* ANNOTATION */
812 YYSYMBOL_MODE = 13, /* MODE */
813 YYSYMBOL_MODE_MODIFIER = 14, /* MODE_MODIFIER */
814 YYSYMBOL_MODE_DIFFERENTIA = 15, /* MODE_DIFFERENTIA */
815 YYSYMBOL_END_OF_DEFINITIONS = 16, /* END_OF_DEFINITIONS */
816 YYSYMBOL_END_OF_FILE = 17, /* END_OF_FILE */
817 YYSYMBOL_COLON = 18, /* COLON */
818 YYSYMBOL_SEMICOLON = 19, /* SEMICOLON */
819 YYSYMBOL_CHARACTERS = 20, /* CHARACTERS */
820 YYSYMBOL_NOTES = 21, /* NOTES */
821 YYSYMBOL_HYPHEN = 22, /* HYPHEN */
822 YYSYMBOL_ATTRIBUTE = 23, /* ATTRIBUTE */
823 YYSYMBOL_OPENING_BRACKET = 24, /* OPENING_BRACKET */
824 YYSYMBOL_CLOSING_BRACKET = 25, /* CLOSING_BRACKET */
825 YYSYMBOL_CLOSING_BRACKET_WITH_SPACE = 26, /* CLOSING_BRACKET_WITH_SPACE */
826 YYSYMBOL_I_BEGIN = 27, /* I_BEGIN */
827 YYSYMBOL_I_END = 28, /* I_END */
828 YYSYMBOL_TT_BEGIN = 29, /* TT_BEGIN */
829 YYSYMBOL_TT_END = 30, /* TT_END */
830 YYSYMBOL_UL_BEGIN = 31, /* UL_BEGIN */
831 YYSYMBOL_UL_END = 32, /* UL_END */
832 YYSYMBOL_C_BEGIN = 33, /* C_BEGIN */
833 YYSYMBOL_C_END = 34, /* C_END */
834 YYSYMBOL_B_BEGIN = 35, /* B_BEGIN */
835 YYSYMBOL_B_END = 36, /* B_END */
836 YYSYMBOL_SC_BEGIN = 37, /* SC_BEGIN */
837 YYSYMBOL_SC_END = 38, /* SC_END */
838 YYSYMBOL_SP_BEGIN = 39, /* SP_BEGIN */
839 YYSYMBOL_SP_END = 40, /* SP_END */
840 YYSYMBOL_VERB_BEGIN = 41, /* VERB_BEGIN */
841 YYSYMBOL_VERB_END = 42, /* VERB_END */
842 YYSYMBOL_CENTER_BEGIN = 43, /* CENTER_BEGIN */
843 YYSYMBOL_CENTER_END = 44, /* CENTER_END */
844 YYSYMBOL_ELISION_BEGIN = 45, /* ELISION_BEGIN */
845 YYSYMBOL_ELISION_END = 46, /* ELISION_END */
846 YYSYMBOL_TRANSLATION_BEGIN = 47, /* TRANSLATION_BEGIN */
847 YYSYMBOL_TRANSLATION_END = 48, /* TRANSLATION_END */
848 YYSYMBOL_TRANSLATION_CENTER_END = 49, /* TRANSLATION_CENTER_END */
849 YYSYMBOL_ALT_BEGIN = 50, /* ALT_BEGIN */
850 YYSYMBOL_ALT_END = 51, /* ALT_END */
851 YYSYMBOL_NLBA_B = 52, /* NLBA_B */
852 YYSYMBOL_NLBA_E = 53, /* NLBA_E */
853 YYSYMBOL_EUOUAE_B = 54, /* EUOUAE_B */
854 YYSYMBOL_EUOUAE_E = 55, /* EUOUAE_E */
855 YYSYMBOL_NABC_CUT = 56, /* NABC_CUT */
856 YYSYMBOL_NABC_LINES = 57, /* NABC_LINES */
857 YYSYMBOL_CLEAR = 58, /* CLEAR */
858 YYSYMBOL_PROTRUSION = 59, /* PROTRUSION */
859 YYSYMBOL_PROTRUSION_VALUE = 60, /* PROTRUSION_VALUE */
860 YYSYMBOL_PROTRUSION_END = 61, /* PROTRUSION_END */
861 YYSYMBOL_PROTRUDING_PUNCTUATION = 62, /* PROTRUDING_PUNCTUATION */
862 YYSYMBOL_YYACCEPT = 63, /* $accept */
863 YYSYMBOL_score = 64, /* score */
864 YYSYMBOL_all_definitions = 65, /* all_definitions */
865 YYSYMBOL_definitions = 66, /* definitions */
866 YYSYMBOL_attribute_value = 67, /* attribute_value */
867 YYSYMBOL_attribute = 68, /* attribute */
868 YYSYMBOL_definition = 69, /* definition */
869 YYSYMBOL_notes = 70, /* notes */
870 YYSYMBOL_note = 71, /* note */
871 YYSYMBOL_closing_bracket_with_space = 72, /* closing_bracket_with_space */
872 YYSYMBOL_style_beginning = 73, /* style_beginning */
873 YYSYMBOL_style_end = 74, /* style_end */
874 YYSYMBOL_special_style_beginning = 75, /* special_style_beginning */
875 YYSYMBOL_special_style_end = 76, /* special_style_end */
876 YYSYMBOL_euouae = 77, /* euouae */
877 YYSYMBOL_linebreak_area = 78, /* linebreak_area */
878 YYSYMBOL_protrusion = 79, /* protrusion */
879 YYSYMBOL_character = 80, /* character */
880 YYSYMBOL_text = 81, /* text */
881 YYSYMBOL_translation_character = 82, /* translation_character */
882 YYSYMBOL_translation_text = 83, /* translation_text */
883 YYSYMBOL_translation_beginning = 84, /* translation_beginning */
884 YYSYMBOL_translation = 85, /* translation */
885 YYSYMBOL_above_line_text = 86, /* above_line_text */
886 YYSYMBOL_syllable_with_notes = 87, /* syllable_with_notes */
887 YYSYMBOL_notes_without_word = 88, /* notes_without_word */
888 YYSYMBOL_syllable = 89, /* syllable */
889 YYSYMBOL_syllables = 90 /* syllables */
890 };
891 typedef enum yysymbol_kind_t yysymbol_kind_t;
892
893
894
895
896 #ifdef short
897 # undef short
898 #endif
899
900 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
901 <limits.h> and (if available) <stdint.h> are included
902 so that the code can choose integer types of a good width. */
903
904 #ifndef __PTRDIFF_MAX__
905 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
906 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
907 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
908 # define YY_STDINT_H
909 # endif
910 #endif
911
912 /* Narrow types that promote to a signed type and that can represent a
913 signed or unsigned integer of at least N bits. In tables they can
914 save space and decrease cache pressure. Promoting to a signed type
915 helps avoid bugs in integer arithmetic. */
916
917 #ifdef __INT_LEAST8_MAX__
918 typedef __INT_LEAST8_TYPE__ yytype_int8;
919 #elif defined YY_STDINT_H
920 typedef int_least8_t yytype_int8;
921 #else
922 typedef signed char yytype_int8;
923 #endif
924
925 #ifdef __INT_LEAST16_MAX__
926 typedef __INT_LEAST16_TYPE__ yytype_int16;
927 #elif defined YY_STDINT_H
928 typedef int_least16_t yytype_int16;
929 #else
930 typedef short yytype_int16;
931 #endif
932
933 /* Work around bug in HP-UX 11.23, which defines these macros
934 incorrectly for preprocessor constants. This workaround can likely
935 be removed in 2023, as HPE has promised support for HP-UX 11.23
936 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
937 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
938 #ifdef __hpux
939 # undef UINT_LEAST8_MAX
940 # undef UINT_LEAST16_MAX
941 # define UINT_LEAST8_MAX 255
942 # define UINT_LEAST16_MAX 65535
943 #endif
944
945 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
946 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
947 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
948 && UINT_LEAST8_MAX <= INT_MAX)
949 typedef uint_least8_t yytype_uint8;
950 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
951 typedef unsigned char yytype_uint8;
952 #else
953 typedef short yytype_uint8;
954 #endif
955
956 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
957 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
958 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
959 && UINT_LEAST16_MAX <= INT_MAX)
960 typedef uint_least16_t yytype_uint16;
961 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
962 typedef unsigned short yytype_uint16;
963 #else
964 typedef int yytype_uint16;
965 #endif
966
967 #ifndef YYPTRDIFF_T
968 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
969 # define YYPTRDIFF_T __PTRDIFF_TYPE__
970 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
971 # elif defined PTRDIFF_MAX
972 # ifndef ptrdiff_t
973 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
974 # endif
975 # define YYPTRDIFF_T ptrdiff_t
976 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
977 # else
978 # define YYPTRDIFF_T long
979 # define YYPTRDIFF_MAXIMUM LONG_MAX
980 # endif
981 #endif
982
983 #ifndef YYSIZE_T
984 # ifdef __SIZE_TYPE__
985 # define YYSIZE_T __SIZE_TYPE__
986 # elif defined size_t
987 # define YYSIZE_T size_t
988 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
989 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
990 # define YYSIZE_T size_t
991 # else
992 # define YYSIZE_T unsigned
993 # endif
994 #endif
995
996 #define YYSIZE_MAXIMUM \
997 YY_CAST (YYPTRDIFF_T, \
998 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
999 ? YYPTRDIFF_MAXIMUM \
1000 : YY_CAST (YYSIZE_T, -1)))
1001
1002 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
1003
1004
1005 /* Stored state numbers (used for stacks). */
1006 typedef yytype_uint8 yy_state_t;
1007
1008 /* State numbers in computations. */
1009 typedef int yy_state_fast_t;
1010
1011 #ifndef YY_
1012 # if defined YYENABLE_NLS && YYENABLE_NLS
1013 # if ENABLE_NLS
1014 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
1015 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
1016 # endif
1017 # endif
1018 # ifndef YY_
1019 # define YY_(Msgid) Msgid
1020 # endif
1021 #endif
1022
1023
1024 #ifndef YY_ATTRIBUTE_PURE
1025 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
1026 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
1027 # else
1028 # define YY_ATTRIBUTE_PURE
1029 # endif
1030 #endif
1031
1032 #ifndef YY_ATTRIBUTE_UNUSED
1033 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
1034 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
1035 # else
1036 # define YY_ATTRIBUTE_UNUSED
1037 # endif
1038 #endif
1039
1040 /* Suppress unused-variable warnings by "using" E. */
1041 #if ! defined lint || defined __GNUC__
1042 # define YY_USE(E) ((void) (E))
1043 #else
1044 # define YY_USE(E) /* empty */
1045 #endif
1046
1047 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
1048 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
1049 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
1050 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
1051 _Pragma ("GCC diagnostic push") \
1052 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
1053 # else
1054 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
1055 _Pragma ("GCC diagnostic push") \
1056 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
1057 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
1058 # endif
1059 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
1060 _Pragma ("GCC diagnostic pop")
1061 #else
1062 # define YY_INITIAL_VALUE(Value) Value
1063 #endif
1064 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1065 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1066 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
1067 #endif
1068 #ifndef YY_INITIAL_VALUE
1069 # define YY_INITIAL_VALUE(Value) /* Nothing. */
1070 #endif
1071
1072 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
1073 # define YY_IGNORE_USELESS_CAST_BEGIN \
1074 _Pragma ("GCC diagnostic push") \
1075 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
1076 # define YY_IGNORE_USELESS_CAST_END \
1077 _Pragma ("GCC diagnostic pop")
1078 #endif
1079 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
1080 # define YY_IGNORE_USELESS_CAST_BEGIN
1081 # define YY_IGNORE_USELESS_CAST_END
1082 #endif
1083
1084
1085 #define YY_ASSERT(E) ((void) (0 && (E)))
1086
1087 #if !defined yyoverflow
1088
1089 /* The parser invokes alloca or malloc; define the necessary symbols. */
1090
1091 # ifdef YYSTACK_USE_ALLOCA
1092 # if YYSTACK_USE_ALLOCA
1093 # ifdef __GNUC__
1094 # define YYSTACK_ALLOC __builtin_alloca
1095 # elif defined __BUILTIN_VA_ARG_INCR
1096 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
1097 # elif defined _AIX
1098 # define YYSTACK_ALLOC __alloca
1099 # elif defined _MSC_VER
1100 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
1101 # define alloca _alloca
1102 # else
1103 # define YYSTACK_ALLOC alloca
1104 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
1105 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1106 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
1107 # ifndef EXIT_SUCCESS
1108 # define EXIT_SUCCESS 0
1109 # endif
1110 # endif
1111 # endif
1112 # endif
1113 # endif
1114
1115 # ifdef YYSTACK_ALLOC
1116 /* Pacify GCC's 'empty if-body' warning. */
1117 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
1118 # ifndef YYSTACK_ALLOC_MAXIMUM
1119 /* The OS might guarantee only one guard page at the bottom of the stack,
1120 and a page size can be as small as 4096 bytes. So we cannot safely
1121 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
1122 to allow for a few compiler-allocated temporary stack slots. */
1123 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
1124 # endif
1125 # else
1126 # define YYSTACK_ALLOC YYMALLOC
1127 # define YYSTACK_FREE YYFREE
1128 # ifndef YYSTACK_ALLOC_MAXIMUM
1129 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
1130 # endif
1131 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
1132 && ! ((defined YYMALLOC || defined malloc) \
1133 && (defined YYFREE || defined free)))
1134 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
1135 # ifndef EXIT_SUCCESS
1136 # define EXIT_SUCCESS 0
1137 # endif
1138 # endif
1139 # ifndef YYMALLOC
1140 # define YYMALLOC malloc
1141 # if ! defined malloc && ! defined EXIT_SUCCESS
1142 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
1143 # endif
1144 # endif
1145 # ifndef YYFREE
1146 # define YYFREE free
1147 # if ! defined free && ! defined EXIT_SUCCESS
1148 void free (void *); /* INFRINGES ON USER NAME SPACE */
1149 # endif
1150 # endif
1151 # endif
1152 #endif /* !defined yyoverflow */
1153
1154 #if (! defined yyoverflow \
1155 && (! defined __cplusplus \
1156 || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
1157 && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
1158
1159 /* A type that is properly aligned for any stack member. */
1160 union yyalloc
1161 {
1162 yy_state_t yyss_alloc;
1163 YYSTYPE yyvs_alloc;
1164 YYLTYPE yyls_alloc;
1165 };
1166
1167 /* The size of the maximum gap between one aligned stack and the next. */
1168 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
1169
1170 /* The size of an array large to enough to hold all stacks, each with
1171 N elements. */
1172 # define YYSTACK_BYTES(N) \
1173 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \
1174 + YYSIZEOF (YYLTYPE)) \
1175 + 2 * YYSTACK_GAP_MAXIMUM)
1176
1177 # define YYCOPY_NEEDED 1
1178
1179 /* Relocate STACK from its old location to the new one. The
1180 local variables YYSIZE and YYSTACKSIZE give the old and new number of
1181 elements in the stack, and YYPTR gives the new location of the
1182 stack. Advance YYPTR to a properly aligned location for the next
1183 stack. */
1184 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
1185 do \
1186 { \
1187 YYPTRDIFF_T yynewbytes; \
1188 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
1189 Stack = &yyptr->Stack_alloc; \
1190 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
1191 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
1192 } \
1193 while (0)
1194
1195 #endif
1196
1197 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
1198 /* Copy COUNT objects from SRC to DST. The source and destination do
1199 not overlap. */
1200 # ifndef YYCOPY
1201 # if defined __GNUC__ && 1 < __GNUC__
1202 # define YYCOPY(Dst, Src, Count) \
1203 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
1204 # else
1205 # define YYCOPY(Dst, Src, Count) \
1206 do \
1207 { \
1208 YYPTRDIFF_T yyi; \
1209 for (yyi = 0; yyi < (Count); yyi++) \
1210 (Dst)[yyi] = (Src)[yyi]; \
1211 } \
1212 while (0)
1213 # endif
1214 # endif
1215 #endif /* !YYCOPY_NEEDED */
1216
1217 /* YYFINAL -- State number of the termination state. */
1218 #define YYFINAL 4
1219 /* YYLAST -- Last index in YYTABLE. */
1220 #define YYLAST 247
1221
1222 /* YYNTOKENS -- Number of terminals. */
1223 #define YYNTOKENS 63
1224 /* YYNNTS -- Number of nonterminals. */
1225 #define YYNNTS 28
1226 /* YYNRULES -- Number of rules. */
1227 #define YYNRULES 101
1228 /* YYNSTATES -- Number of states. */
1229 #define YYNSTATES 145
1230
1231 /* YYMAXUTOK -- Last valid token kind. */
1232 #define YYMAXUTOK 317
1233
1234
1235 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
1236 as returned by yylex, with out-of-bounds checking. */
1237 #define YYTRANSLATE(YYX) \
1238 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
1239 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
1240 : YYSYMBOL_YYUNDEF)
1241
1242 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
1243 as returned by yylex. */
1244 static const yytype_int8 yytranslate[] =
1245 {
1246 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1247 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1248 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1249 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1250 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1251 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1252 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1253 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1254 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1255 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1256 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1257 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1258 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1259 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1260 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1261 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1262 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1263 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1264 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1265 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1266 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1267 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1268 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1269 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1270 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1271 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
1272 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
1273 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
1274 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
1275 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
1276 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
1277 55, 56, 57, 58, 59, 60, 61, 62
1278 };
1279
1280 #if YYDEBUG
1281 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
1282 static const yytype_int16 yyrline[] =
1283 {
1284 0, 737, 737, 741, 746, 747, 751, 754, 760, 763,
1285 769, 774, 783, 789, 794, 799, 804, 809, 814, 822,
1286 830, 839, 844, 848, 853, 854, 858, 863, 869, 880,
1287 884, 892, 893, 894, 898, 901, 904, 907, 910, 913,
1288 916, 919, 925, 928, 931, 934, 937, 940, 943, 946,
1289 952, 955, 972, 975, 988, 991, 997, 1000, 1006, 1009,
1290 1015, 1016, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1028,
1291 1029, 1032, 1038, 1039, 1043, 1046, 1047, 1048, 1051, 1057,
1292 1058, 1062, 1068, 1071, 1074, 1081, 1087, 1091, 1098, 1105,
1293 1110, 1115, 1119, 1126, 1133, 1138, 1146, 1149, 1155, 1156,
1294 1159, 1160
1295 };
1296 #endif
1297
1298 /** Accessing symbol of state STATE. */
1299 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
1300
1301 #if YYDEBUG || 0
1302 /* The user-facing name of the symbol whose (internal) number is
1303 YYSYMBOL. No bounds checking. */
1304 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
1305
1306 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
1307 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
1308 static const char *const yytname[] =
1309 {
1310 "\"end of file\"", "error", "\"invalid token\"", "NAME", "AUTHOR",
1311 "GABC_COPYRIGHT", "SCORE_COPYRIGHT", "LANGUAGE", "STAFF_LINES",
1312 "ORISCUS_ORIENTATION", "DEF_MACRO", "OTHER_HEADER", "ANNOTATION", "MODE",
1313 "MODE_MODIFIER", "MODE_DIFFERENTIA", "END_OF_DEFINITIONS", "END_OF_FILE",
1314 "COLON", "SEMICOLON", "CHARACTERS", "NOTES", "HYPHEN", "ATTRIBUTE",
1315 "OPENING_BRACKET", "CLOSING_BRACKET", "CLOSING_BRACKET_WITH_SPACE",
1316 "I_BEGIN", "I_END", "TT_BEGIN", "TT_END", "UL_BEGIN", "UL_END",
1317 "C_BEGIN", "C_END", "B_BEGIN", "B_END", "SC_BEGIN", "SC_END", "SP_BEGIN",
1318 "SP_END", "VERB_BEGIN", "VERB_END", "CENTER_BEGIN", "CENTER_END",
1319 "ELISION_BEGIN", "ELISION_END", "TRANSLATION_BEGIN", "TRANSLATION_END",
1320 "TRANSLATION_CENTER_END", "ALT_BEGIN", "ALT_END", "NLBA_B", "NLBA_E",
1321 "EUOUAE_B", "EUOUAE_E", "NABC_CUT", "NABC_LINES", "CLEAR", "PROTRUSION",
1322 "PROTRUSION_VALUE", "PROTRUSION_END", "PROTRUDING_PUNCTUATION",
1323 "$accept", "score", "all_definitions", "definitions", "attribute_value",
1324 "attribute", "definition", "notes", "note", "closing_bracket_with_space",
1325 "style_beginning", "style_end", "special_style_beginning",
1326 "special_style_end", "euouae", "linebreak_area", "protrusion",
1327 "character", "text", "translation_character", "translation_text",
1328 "translation_beginning", "translation", "above_line_text",
1329 "syllable_with_notes", "notes_without_word", "syllable", "syllables", YY_NULLPTR
1330 };
1331
1332 static const char *
1333 yysymbol_name (yysymbol_kind_t yysymbol)
1334 {
1335 return yytname[yysymbol];
1336 }
1337 #endif
1338
1339 #define YYPACT_NINF (-85)
1340
1341 #define yypact_value_is_default(Yyn) \
1342 ((Yyn) == YYPACT_NINF)
1343
1344 #define YYTABLE_NINF (-1)
1345
1346 #define yytable_value_is_error(Yyn) \
1347 0
1348
1349 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
1350 STATE-NUM. */
1351 static const yytype_int16 yypact[] =
1352 {
1353 -85, 11, -85, 69, -85, 66, 0, 0, 0, 0,
1354 0, 0, 0, 0, 0, 0, 0, 0, 0, -85,
1355 0, -85, -85, -20, -85, -85, -85, -85, -85, -85,
1356 -85, -85, -85, -85, -85, -85, -85, -85, -85, -85,
1357 -85, -85, -85, -85, -85, -85, -85, 4, -85, -85,
1358 -85, -85, -85, -41, -19, -85, -85, -85, -85, -85,
1359 -85, -85, -85, 107, 148, -4, -85, -85, -85, -85,
1360 -7, -85, -85, -85, -85, -85, -85, -85, -85, -85,
1361 -85, -85, -85, -85, -85, -85, 1, -11, -17, -29,
1362 -85, 9, -2, -85, -1, -85, 13, -85, -85, -85,
1363 -85, -85, -85, -85, 184, -85, -85, -85, -6, -11,
1364 -85, -18, 27, 32, -85, -85, -85, -85, -11, -85,
1365 -85, 26, -11, -85, 28, -85, -85, -85, -11, -85,
1366 -85, -11, 27, -85, -85, -85, -85, -11, -11, -85,
1367 -11, -85, -11, -11, -11
1368 };
1369
1370 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
1371 Performed when YYTABLE does not specify something else to do. Zero
1372 means the default is an error. */
1373 static const yytype_int8 yydefact[] =
1374 {
1375 4, 0, 100, 0, 1, 2, 0, 0, 0, 0,
1376 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
1377 0, 5, 61, 70, 24, 34, 42, 35, 43, 36,
1378 44, 37, 45, 38, 46, 39, 47, 41, 49, 40,
1379 48, 51, 53, 50, 52, 81, 84, 0, 56, 57,
1380 54, 55, 68, 59, 71, 62, 63, 64, 65, 67,
1381 66, 69, 72, 0, 0, 0, 60, 98, 99, 101,
1382 0, 11, 21, 13, 14, 12, 18, 22, 10, 23,
1383 20, 15, 16, 17, 19, 24, 0, 96, 0, 0,
1384 24, 0, 70, 24, 71, 73, 0, 74, 77, 82,
1385 78, 75, 76, 79, 0, 24, 9, 6, 0, 87,
1386 24, 0, 29, 31, 25, 30, 85, 58, 89, 24,
1387 24, 0, 86, 24, 0, 24, 83, 80, 97, 8,
1388 7, 92, 26, 28, 27, 33, 32, 94, 88, 24,
1389 90, 24, 91, 93, 95
1390 };
1391
1392 /* YYPGOTO[NTERM-NUM]. */
1393 static const yytype_int16 yypgoto[] =
1394 {
1395 -85, -85, -85, -85, -85, 227, -85, -84, -85, -60,
1396 -62, -61, -85, -85, -85, -85, -85, -10, -85, -50,
1397 -85, -85, -23, -85, -85, -85, -85, -85
1398 };
1399
1400 /* YYDEFGOTO[NTERM-NUM]. */
1401 static const yytype_int8 yydefgoto[] =
1402 {
1403 0, 1, 2, 3, 108, 71, 21, 87, 114, 115,
1404 55, 56, 57, 58, 59, 60, 61, 62, 63, 103,
1405 104, 64, 65, 66, 67, 68, 69, 5
1406 };
1407
1408 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
1409 positive, shift that token. If negative, reduce the rule whose
1410 number is the opposite. If YYTABLE_NINF, syntax error. */
1411 static const yytype_uint8 yytable[] =
1412 {
1413 86, 109, 101, 102, 85, 90, 118, 132, 113, 122,
1414 111, 4, 106, 129, 112, 113, 107, 130, 70, 89,
1415 105, 128, 120, 123, 88, 110, 131, 45, 45, 46,
1416 46, 91, 117, 119, 116, 137, 138, 125, 133, 140,
1417 96, 142, 101, 102, 135, 45, 45, 46, 46, 136,
1418 139, 134, 141, 95, 127, 143, 0, 144, 0, 0,
1419 0, 0, 0, 0, 0, 0, 0, 0, 0, 121,
1420 0, 124, 6, 7, 8, 9, 10, 11, 12, 13,
1421 14, 15, 16, 17, 18, 19, 22, 0, 23, 0,
1422 24, 0, 0, 25, 26, 27, 28, 29, 30, 31,
1423 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
1424 42, 43, 44, 45, 0, 46, 47, 0, 48, 49,
1425 50, 51, 0, 0, 52, 53, 20, 22, 54, 92,
1426 0, 93, 0, 0, 25, 26, 27, 28, 29, 30,
1427 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
1428 41, 42, 43, 44, 45, 0, 46, 47, 0, 48,
1429 49, 50, 51, 0, 0, 52, 53, 0, 97, 94,
1430 98, 0, 0, 0, 0, 25, 26, 27, 28, 29,
1431 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
1432 40, 0, 0, 0, 0, 0, 99, 0, 0, 0,
1433 0, 0, 0, 0, 97, 0, 98, 0, 0, 0,
1434 100, 25, 26, 27, 28, 29, 30, 31, 32, 33,
1435 34, 35, 36, 37, 38, 39, 40, 0, 0, 0,
1436 0, 0, 126, 0, 72, 73, 74, 75, 76, 77,
1437 78, 79, 80, 81, 82, 83, 100, 84
1438 };
1439
1440 static const yytype_int16 yycheck[] =
1441 {
1442 23, 85, 64, 64, 24, 24, 90, 25, 26, 93,
1443 21, 0, 19, 19, 25, 26, 23, 23, 18, 60,
1444 24, 105, 24, 24, 20, 24, 110, 47, 47, 49,
1445 49, 54, 61, 24, 51, 119, 120, 24, 56, 123,
1446 63, 125, 104, 104, 17, 47, 47, 49, 49, 17,
1447 24, 111, 24, 63, 104, 139, -1, 141, -1, -1,
1448 -1, -1, -1, -1, -1, -1, -1, -1, -1, 92,
1449 -1, 94, 3, 4, 5, 6, 7, 8, 9, 10,
1450 11, 12, 13, 14, 15, 16, 20, -1, 22, -1,
1451 24, -1, -1, 27, 28, 29, 30, 31, 32, 33,
1452 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
1453 44, 45, 46, 47, -1, 49, 50, -1, 52, 53,
1454 54, 55, -1, -1, 58, 59, 57, 20, 62, 22,
1455 -1, 24, -1, -1, 27, 28, 29, 30, 31, 32,
1456 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
1457 43, 44, 45, 46, 47, -1, 49, 50, -1, 52,
1458 53, 54, 55, -1, -1, 58, 59, -1, 20, 62,
1459 22, -1, -1, -1, -1, 27, 28, 29, 30, 31,
1460 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
1461 42, -1, -1, -1, -1, -1, 48, -1, -1, -1,
1462 -1, -1, -1, -1, 20, -1, 22, -1, -1, -1,
1463 62, 27, 28, 29, 30, 31, 32, 33, 34, 35,
1464 36, 37, 38, 39, 40, 41, 42, -1, -1, -1,
1465 -1, -1, 48, -1, 7, 8, 9, 10, 11, 12,
1466 13, 14, 15, 16, 17, 18, 62, 20
1467 };
1468
1469 /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
1470 state STATE-NUM. */
1471 static const yytype_int8 yystos[] =
1472 {
1473 0, 64, 65, 66, 0, 90, 3, 4, 5, 6,
1474 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
1475 57, 69, 20, 22, 24, 27, 28, 29, 30, 31,
1476 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
1477 42, 43, 44, 45, 46, 47, 49, 50, 52, 53,
1478 54, 55, 58, 59, 62, 73, 74, 75, 76, 77,
1479 78, 79, 80, 81, 84, 85, 86, 87, 88, 89,
1480 18, 68, 68, 68, 68, 68, 68, 68, 68, 68,
1481 68, 68, 68, 68, 68, 24, 85, 70, 20, 60,
1482 24, 85, 22, 24, 62, 80, 85, 20, 22, 48,
1483 62, 73, 74, 82, 83, 24, 19, 23, 67, 70,
1484 24, 21, 25, 26, 71, 72, 51, 61, 70, 24,
1485 24, 85, 70, 24, 85, 24, 48, 82, 70, 19,
1486 23, 70, 25, 56, 72, 17, 17, 70, 70, 24,
1487 70, 24, 70, 70, 70
1488 };
1489
1490 /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
1491 static const yytype_int8 yyr1[] =
1492 {
1493 0, 63, 64, 65, 66, 66, 67, 67, 68, 68,
1494 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
1495 69, 69, 69, 69, 70, 70, 71, 71, 71, 71,
1496 71, 72, 72, 72, 73, 73, 73, 73, 73, 73,
1497 73, 73, 74, 74, 74, 74, 74, 74, 74, 74,
1498 75, 75, 76, 76, 77, 77, 78, 78, 79, 79,
1499 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
1500 80, 80, 81, 81, 82, 82, 82, 82, 82, 83,
1501 83, 84, 85, 85, 85, 86, 87, 87, 87, 87,
1502 87, 87, 87, 87, 87, 87, 88, 88, 89, 89,
1503 90, 90
1504 };
1505
1506 /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
1507 static const yytype_int8 yyr2[] =
1508 {
1509 0, 2, 2, 2, 0, 2, 1, 2, 3, 2,
1510 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1511 2, 2, 2, 2, 0, 2, 2, 2, 2, 1,
1512 1, 1, 2, 2, 1, 1, 1, 1, 1, 1,
1513 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1514 1, 1, 1, 1, 1, 1, 1, 1, 3, 1,
1515 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1516 1, 1, 1, 2, 1, 1, 1, 1, 1, 1,
1517 2, 1, 2, 3, 1, 3, 3, 3, 4, 3,
1518 4, 4, 4, 5, 4, 5, 2, 3, 1, 1,
1519 0, 2
1520 };
1521
1522
1523 enum { YYENOMEM = -2 };
1524
1525 #define yyerrok (yyerrstatus = 0)
1526 #define yyclearin (yychar = YYEMPTY)
1527
1528 #define YYACCEPT goto yyacceptlab
1529 #define YYABORT goto yyabortlab
1530 #define YYERROR goto yyerrorlab
1531 #define YYNOMEM goto yyexhaustedlab
1532
1533
1534 #define YYRECOVERING() (!!yyerrstatus)
1535
1536 #define YYBACKUP(Token, Value) \
1537 do \
1538 if (yychar == YYEMPTY) \
1539 { \
1540 yychar = (Token); \
1541 yylval = (Value); \
1542 YYPOPSTACK (yylen); \
1543 yystate = *yyssp; \
1544 goto yybackup; \
1545 } \
1546 else \
1547 { \
1548 yyerror (YY_("syntax error: cannot back up")); \
1549 YYERROR; \
1550 } \
1551 while (0)
1552
1553 /* Backward compatibility with an undocumented macro.
1554 Use YYerror or YYUNDEF. */
1555 #define YYERRCODE YYUNDEF
1556
1557 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
1558 If N is 0, then set CURRENT to the empty location which ends
1559 the previous symbol: RHS[0] (always defined). */
1560
1561 #ifndef YYLLOC_DEFAULT
1562 # define YYLLOC_DEFAULT(Current, Rhs, N) \
1563 do \
1564 if (N) \
1565 { \
1566 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
1567 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
1568 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
1569 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
1570 } \
1571 else \
1572 { \
1573 (Current).first_line = (Current).last_line = \
1574 YYRHSLOC (Rhs, 0).last_line; \
1575 (Current).first_column = (Current).last_column = \
1576 YYRHSLOC (Rhs, 0).last_column; \
1577 } \
1578 while (0)
1579 #endif
1580
1581 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
1582
1583
1584 /* Enable debugging if requested. */
1585 #if YYDEBUG
1586
1587 # ifndef YYFPRINTF
1588 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1589 # define YYFPRINTF fprintf
1590 # endif
1591
1592 # define YYDPRINTF(Args) \
1593 do { \
1594 if (yydebug) \
1595 YYFPRINTF Args; \
1596 } while (0)
1597
1598
1599 /* YYLOCATION_PRINT -- Print the location on the stream.
1600 This macro was not mandated originally: define only if we know
1601 we won't break user code: when these are the locations we know. */
1602
1603 # ifndef YYLOCATION_PRINT
1604
1605 # if defined YY_LOCATION_PRINT
1606
1607 /* Temporary convenience wrapper in case some people defined the
1608 undocumented and private YY_LOCATION_PRINT macros. */
1609 # define YYLOCATION_PRINT(File, Loc) YY_LOCATION_PRINT(File, *(Loc))
1610
1611 # elif defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1612
1613 /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
1614
1615 YY_ATTRIBUTE_UNUSED
1616 static int
1617 yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
1618 {
1619 int res = 0;
1620 int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
1621 if (0 <= yylocp->first_line)
1622 {
1623 res += YYFPRINTF (yyo, "%d", yylocp->first_line);
1624 if (0 <= yylocp->first_column)
1625 res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
1626 }
1627 if (0 <= yylocp->last_line)
1628 {
1629 if (yylocp->first_line < yylocp->last_line)
1630 {
1631 res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
1632 if (0 <= end_col)
1633 res += YYFPRINTF (yyo, ".%d", end_col);
1634 }
1635 else if (0 <= end_col && yylocp->first_column < end_col)
1636 res += YYFPRINTF (yyo, "-%d", end_col);
1637 }
1638 return res;
1639 }
1640
1641 # define YYLOCATION_PRINT yy_location_print_
1642
1643 /* Temporary convenience wrapper in case some people defined the
1644 undocumented and private YY_LOCATION_PRINT macros. */
1645 # define YY_LOCATION_PRINT(File, Loc) YYLOCATION_PRINT(File, &(Loc))
1646
1647 # else
1648
1649 # define YYLOCATION_PRINT(File, Loc) ((void) 0)
1650 /* Temporary convenience wrapper in case some people defined the
1651 undocumented and private YY_LOCATION_PRINT macros. */
1652 # define YY_LOCATION_PRINT YYLOCATION_PRINT
1653
1654 # endif
1655 # endif /* !defined YYLOCATION_PRINT */
1656
1657
1658 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
1659 do { \
1660 if (yydebug) \
1661 { \
1662 YYFPRINTF (stderr, "%s ", Title); \
1663 yy_symbol_print (stderr, \
1664 Kind, Value, Location); \
1665 YYFPRINTF (stderr, "\n"); \
1666 } \
1667 } while (0)
1668
1669
1670 /*-----------------------------------.
1671 | Print this symbol's value on YYO. |
1672 `-----------------------------------*/
1673
1674 static void
1675 yy_symbol_value_print (FILE *yyo,
1676 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
1677 {
1678 FILE *yyoutput = yyo;
1679 YY_USE (yyoutput);
1680 YY_USE (yylocationp);
1681 if (!yyvaluep)
1682 return;
1683 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1684 YY_USE (yykind);
1685 YY_IGNORE_MAYBE_UNINITIALIZED_END
1686 }
1687
1688
1689 /*---------------------------.
1690 | Print this symbol on YYO. |
1691 `---------------------------*/
1692
1693 static void
1694 yy_symbol_print (FILE *yyo,
1695 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
1696 {
1697 YYFPRINTF (yyo, "%s %s (",
1698 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
1699
1700 YYLOCATION_PRINT (yyo, yylocationp);
1701 YYFPRINTF (yyo, ": ");
1702 yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp);
1703 YYFPRINTF (yyo, ")");
1704 }
1705
1706 /*------------------------------------------------------------------.
1707 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1708 | TOP (included). |
1709 `------------------------------------------------------------------*/
1710
1711 static void
1712 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
1713 {
1714 YYFPRINTF (stderr, "Stack now");
1715 for (; yybottom <= yytop; yybottom++)
1716 {
1717 int yybot = *yybottom;
1718 YYFPRINTF (stderr, " %d", yybot);
1719 }
1720 YYFPRINTF (stderr, "\n");
1721 }
1722
1723 # define YY_STACK_PRINT(Bottom, Top) \
1724 do { \
1725 if (yydebug) \
1726 yy_stack_print ((Bottom), (Top)); \
1727 } while (0)
1728
1729
1730 /*------------------------------------------------.
1731 | Report that the YYRULE is going to be reduced. |
1732 `------------------------------------------------*/
1733
1734 static void
1735 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp,
1736 int yyrule)
1737 {
1738 int yylno = yyrline[yyrule];
1739 int yynrhs = yyr2[yyrule];
1740 int yyi;
1741 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1742 yyrule - 1, yylno);
1743 /* The symbols being reduced. */
1744 for (yyi = 0; yyi < yynrhs; yyi++)
1745 {
1746 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1747 yy_symbol_print (stderr,
1748 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
1749 &yyvsp[(yyi + 1) - (yynrhs)],
1750 &(yylsp[(yyi + 1) - (yynrhs)]));
1751 YYFPRINTF (stderr, "\n");
1752 }
1753 }
1754
1755 # define YY_REDUCE_PRINT(Rule) \
1756 do { \
1757 if (yydebug) \
1758 yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \
1759 } while (0)
1760
1761 /* Nonzero means print parse trace. It is left uninitialized so that
1762 multiple parsers can coexist. */
1763 int yydebug;
1764 #else /* !YYDEBUG */
1765 # define YYDPRINTF(Args) ((void) 0)
1766 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
1767 # define YY_STACK_PRINT(Bottom, Top)
1768 # define YY_REDUCE_PRINT(Rule)
1769 #endif /* !YYDEBUG */
1770
1771
1772 /* YYINITDEPTH -- initial size of the parser's stacks. */
1773 #ifndef YYINITDEPTH
1774 # define YYINITDEPTH 200
1775 #endif
1776
1777 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1778 if the built-in stack extension method is used).
1779
1780 Do not make this value too large; the results are undefined if
1781 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1782 evaluated with infinite-precision integer arithmetic. */
1783
1784 #ifndef YYMAXDEPTH
1785 # define YYMAXDEPTH 10000
1786 #endif
1787
1788
1789
1790
1791
1792
1793 /*-----------------------------------------------.
1794 | Release the memory associated to this symbol. |
1795 `-----------------------------------------------*/
1796
1797 static void
1798 yydestruct (const char *yymsg,
1799 yysymbol_kind_t yykind, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
1800 {
1801 YY_USE (yyvaluep);
1802 YY_USE (yylocationp);
1803 if (!yymsg)
1804 yymsg = "Deleting";
1805 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1806
1807 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1808 YY_USE (yykind);
1809 YY_IGNORE_MAYBE_UNINITIALIZED_END
1810 }
1811
1812
1813 /* Lookahead token kind. */
1814 int yychar;
1815
1816 /* The semantic value of the lookahead symbol. */
1817 YYSTYPE yylval;
1818 /* Location data for the lookahead symbol. */
1819 YYLTYPE yylloc
1820 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
1821 = { 1, 1, 1, 1 }
1822 # endif
1823 ;
1824 /* Number of syntax errors so far. */
1825 int yynerrs;
1826
1827
1828
1829
1830 /*----------.
1831 | yyparse. |
1832 `----------*/
1833
1834 int
1835 yyparse (void)
1836 {
1837 yy_state_fast_t yystate = 0;
1838 /* Number of tokens to shift before error messages enabled. */
1839 int yyerrstatus = 0;
1840
1841 /* Refer to the stacks through separate pointers, to allow yyoverflow
1842 to reallocate them elsewhere. */
1843
1844 /* Their size. */
1845 YYPTRDIFF_T yystacksize = YYINITDEPTH;
1846
1847 /* The state stack: array, bottom, top. */
1848 yy_state_t yyssa[YYINITDEPTH];
1849 yy_state_t *yyss = yyssa;
1850 yy_state_t *yyssp = yyss;
1851
1852 /* The semantic value stack: array, bottom, top. */
1853 YYSTYPE yyvsa[YYINITDEPTH];
1854 YYSTYPE *yyvs = yyvsa;
1855 YYSTYPE *yyvsp = yyvs;
1856
1857 /* The location stack: array, bottom, top. */
1858 YYLTYPE yylsa[YYINITDEPTH];
1859 YYLTYPE *yyls = yylsa;
1860 YYLTYPE *yylsp = yyls;
1861
1862 int yyn;
1863 /* The return value of yyparse. */
1864 int yyresult;
1865 /* Lookahead symbol kind. */
1866 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1867 /* The variables used to return semantic value and location from the
1868 action routines. */
1869 YYSTYPE yyval;
1870 YYLTYPE yyloc;
1871
1872 /* The locations where the error started and ended. */
1873 YYLTYPE yyerror_range[3];
1874
1875
1876
1877 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1878
1879 /* The number of symbols on the RHS of the reduced rule.
1880 Keep to zero when no symbol should be popped. */
1881 int yylen = 0;
1882
1883 YYDPRINTF ((stderr, "Starting parse\n"));
1884
1885 yychar = YYEMPTY; /* Cause a token to be read. */
1886
1887
1888 /* User initialization code. */
1889 #line 694 "gabc/gabc-score-determination.y"
1890 {
1891 yylloc.first_line = 1;
1892 yylloc.first_column = 0;
1893 yylloc.first_offset = 0;
1894 yylloc.last_line = 1;
1895 yylloc.last_column = 0;
1896 yylloc.last_offset = 0;
1897 yylloc.generate_point_and_click = generate_point_and_click;
1898 }
1899
1900 #line 1901 "gabc/gabc-score-determination-y.c"
1901
1902 yylsp[0] = yylloc;
1903 goto yysetstate;
1904
1905
1906 /*------------------------------------------------------------.
1907 | yynewstate -- push a new state, which is found in yystate. |
1908 `------------------------------------------------------------*/
1909 yynewstate:
1910 /* In all cases, when you get here, the value and location stacks
1911 have just been pushed. So pushing a state here evens the stacks. */
1912 yyssp++;
1913
1914
1915 /*--------------------------------------------------------------------.
1916 | yysetstate -- set current state (the top of the stack) to yystate. |
1917 `--------------------------------------------------------------------*/
1918 yysetstate:
1919 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1920 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1921 YY_IGNORE_USELESS_CAST_BEGIN
1922 *yyssp = YY_CAST (yy_state_t, yystate);
1923 YY_IGNORE_USELESS_CAST_END
1924 YY_STACK_PRINT (yyss, yyssp);
1925
1926 if (yyss + yystacksize - 1 <= yyssp)
1927 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1928 YYNOMEM;
1929 #else
1930 {
1931 /* Get the current used size of the three stacks, in elements. */
1932 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1933
1934 # if defined yyoverflow
1935 {
1936 /* Give user a chance to reallocate the stack. Use copies of
1937 these so that the &'s don't force the real ones into
1938 memory. */
1939 yy_state_t *yyss1 = yyss;
1940 YYSTYPE *yyvs1 = yyvs;
1941 YYLTYPE *yyls1 = yyls;
1942
1943 /* Each stack pointer address is followed by the size of the
1944 data in use in that stack, in bytes. This used to be a
1945 conditional around just the two extra args, but that might
1946 be undefined if yyoverflow is a macro. */
1947 yyoverflow (YY_("memory exhausted"),
1948 &yyss1, yysize * YYSIZEOF (*yyssp),
1949 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1950 &yyls1, yysize * YYSIZEOF (*yylsp),
1951 &yystacksize);
1952 yyss = yyss1;
1953 yyvs = yyvs1;
1954 yyls = yyls1;
1955 }
1956 # else /* defined YYSTACK_RELOCATE */
1957 /* Extend the stack our own way. */
1958 if (YYMAXDEPTH <= yystacksize)
1959 YYNOMEM;
1960 yystacksize *= 2;
1961 if (YYMAXDEPTH < yystacksize)
1962 yystacksize = YYMAXDEPTH;
1963
1964 {
1965 yy_state_t *yyss1 = yyss;
1966 union yyalloc *yyptr =
1967 YY_CAST (union yyalloc *,
1968 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1969 if (! yyptr)
1970 YYNOMEM;
1971 YYSTACK_RELOCATE (yyss_alloc, yyss);
1972 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1973 YYSTACK_RELOCATE (yyls_alloc, yyls);
1974 # undef YYSTACK_RELOCATE
1975 if (yyss1 != yyssa)
1976 YYSTACK_FREE (yyss1);
1977 }
1978 # endif
1979
1980 yyssp = yyss + yysize - 1;
1981 yyvsp = yyvs + yysize - 1;
1982 yylsp = yyls + yysize - 1;
1983
1984 YY_IGNORE_USELESS_CAST_BEGIN
1985 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1986 YY_CAST (long, yystacksize)));
1987 YY_IGNORE_USELESS_CAST_END
1988
1989 if (yyss + yystacksize - 1 <= yyssp)
1990 YYABORT;
1991 }
1992 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1993
1994
1995 if (yystate == YYFINAL)
1996 YYACCEPT;
1997
1998 goto yybackup;
1999
2000
2001 /*-----------.
2002 | yybackup. |
2003 `-----------*/
2004 yybackup:
2005 /* Do appropriate processing given the current state. Read a
2006 lookahead token if we need one and don't already have one. */
2007
2008 /* First try to decide what to do without reference to lookahead token. */
2009 yyn = yypact[yystate];
2010 if (yypact_value_is_default (yyn))
2011 goto yydefault;
2012
2013 /* Not known => get a lookahead token if don't already have one. */
2014
2015 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
2016 if (yychar == YYEMPTY)
2017 {
2018 YYDPRINTF ((stderr, "Reading a token\n"));
2019 yychar = yylex ();
2020 }
2021
2022 if (yychar <= YYEOF)
2023 {
2024 yychar = YYEOF;
2025 yytoken = YYSYMBOL_YYEOF;
2026 YYDPRINTF ((stderr, "Now at end of input.\n"));
2027 }
2028 else if (yychar == YYerror)
2029 {
2030 /* The scanner already issued an error message, process directly
2031 to error recovery. But do not keep the error token as
2032 lookahead, it is too special and may lead us to an endless
2033 loop in error recovery. */
2034 yychar = YYUNDEF;
2035 yytoken = YYSYMBOL_YYerror;
2036 yyerror_range[1] = yylloc;
2037 goto yyerrlab1;
2038 }
2039 else
2040 {
2041 yytoken = YYTRANSLATE (yychar);
2042 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
2043 }
2044
2045 /* If the proper action on seeing token YYTOKEN is to reduce or to
2046 detect an error, take that action. */
2047 yyn += yytoken;
2048 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
2049 goto yydefault;
2050 yyn = yytable[yyn];
2051 if (yyn <= 0)
2052 {
2053 if (yytable_value_is_error (yyn))
2054 goto yyerrlab;
2055 yyn = -yyn;
2056 goto yyreduce;
2057 }
2058
2059 /* Count tokens shifted since error; after three, turn off error
2060 status. */
2061 if (yyerrstatus)
2062 yyerrstatus--;
2063
2064 /* Shift the lookahead token. */
2065 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
2066 yystate = yyn;
2067 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2068 *++yyvsp = yylval;
2069 YY_IGNORE_MAYBE_UNINITIALIZED_END
2070 *++yylsp = yylloc;
2071
2072 /* Discard the shifted token. */
2073 yychar = YYEMPTY;
2074 goto yynewstate;
2075
2076
2077 /*-----------------------------------------------------------.
2078 | yydefault -- do the default action for the current state. |
2079 `-----------------------------------------------------------*/
2080 yydefault:
2081 yyn = yydefact[yystate];
2082 if (yyn == 0)
2083 goto yyerrlab;
2084 goto yyreduce;
2085
2086
2087 /*-----------------------------.
2088 | yyreduce -- do a reduction. |
2089 `-----------------------------*/
2090 yyreduce:
2091 /* yyn is the number of a rule to reduce with. */
2092 yylen = yyr2[yyn];
2093
2094 /* If YYLEN is nonzero, implement the default value of the action:
2095 '$$ = $1'.
2096
2097 Otherwise, the following line sets YYVAL to garbage.
2098 This behavior is undocumented and Bison
2099 users should not rely upon it. Assigning to YYVAL
2100 unconditionally makes the parser a bit smaller, and it avoids a
2101 GCC warning that YYVAL may be used uninitialized. */
2102 yyval = yyvsp[1-yylen];
2103
2104 /* Default location. */
2105 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
2106 yyerror_range[1] = yyloc;
2107 YY_REDUCE_PRINT (yyn);
2108 switch (yyn)
2109 {
2110 case 3: /* all_definitions: definitions END_OF_DEFINITIONS */
2111 #line 741 "gabc/gabc-score-determination.y"
2112 {
2113 end_definitions();
2114 }
2115 #line 2116 "gabc/gabc-score-determination-y.c"
2116 break;
2117
2118 case 6: /* attribute_value: ATTRIBUTE */
2119 #line 751 "gabc/gabc-score-determination.y"
2120 {
2121 yyval.text = yyvsp[0].text;
2122 }
2123 #line 2124 "gabc/gabc-score-determination-y.c"
2124 break;
2125
2126 case 7: /* attribute_value: attribute_value ATTRIBUTE */
2127 #line 754 "gabc/gabc-score-determination.y"
2128 {
2129 yyval.text = concatenate(yyvsp[-1].text, yyvsp[0].text);
2130 }
2131 #line 2132 "gabc/gabc-score-determination-y.c"
2132 break;
2133
2134 case 8: /* attribute: COLON attribute_value SEMICOLON */
2135 #line 760 "gabc/gabc-score-determination.y"
2136 {
2137 yyval.text = yyvsp[-1].text;
2138 }
2139 #line 2140 "gabc/gabc-score-determination-y.c"
2140 break;
2141
2142 case 9: /* attribute: COLON SEMICOLON */
2143 #line 763 "gabc/gabc-score-determination.y"
2144 {
2145 yyval.text = NULL;
2146 }
2147 #line 2148 "gabc/gabc-score-determination-y.c"
2148 break;
2149
2150 case 10: /* definition: DEF_MACRO attribute */
2151 #line 769 "gabc/gabc-score-determination.y"
2152 {
2153 /* these definitions are not passed through */
2154 free(macros[yyvsp[-1].character - '0']);
2155 macros[yyvsp[-1].character - '0'] = yyvsp[0].text;
2156 }
2157 #line 2158 "gabc/gabc-score-determination-y.c"
2158 break;
2159
2160 case 11: /* definition: NAME attribute */
2161 #line 774 "gabc/gabc-score-determination.y"
2162 {
2163 if (yyvsp[0].text == NULL) {
2164 gregorio_message("name can't be empty","det_score",
2165 VERBOSITY_WARNING, 0);
2166 }
2167 check_multiple("name", score->name != NULL);
2168 gregorio_add_score_header(score, yyvsp[-1].text, yyvsp[0].text);
2169 score->name = yyvsp[0].text;
2170 }
2171 #line 2172 "gabc/gabc-score-determination-y.c"
2172 break;
2173
2174 case 12: /* definition: LANGUAGE attribute */
2175 #line 783 "gabc/gabc-score-determination.y"
2176 {
2177 check_multiple("language", got_language);
2178 gregorio_add_score_header(score, yyvsp[-1].text, yyvsp[0].text);
2179 gregorio_set_centering_language(yyvsp[0].text);
2180 got_language = true;
2181 }
2182 #line 2183 "gabc/gabc-score-determination-y.c"
2183 break;
2184
2185 case 13: /* definition: GABC_COPYRIGHT attribute */
2186 #line 789 "gabc/gabc-score-determination.y"
2187 {
2188 check_multiple("gabc-copyright", score->gabc_copyright != NULL);
2189 gregorio_add_score_header(score, yyvsp[-1].text, yyvsp[0].text);
2190 score->gabc_copyright = yyvsp[0].text;
2191 }
2192 #line 2193 "gabc/gabc-score-determination-y.c"
2193 break;
2194
2195 case 14: /* definition: SCORE_COPYRIGHT attribute */
2196 #line 794 "gabc/gabc-score-determination.y"
2197 {
2198 check_multiple("score_copyright", score->score_copyright != NULL);
2199 gregorio_add_score_header(score, yyvsp[-1].text, yyvsp[0].text);
2200 score->score_copyright = yyvsp[0].text;
2201 }
2202 #line 2203 "gabc/gabc-score-determination-y.c"
2203 break;
2204
2205 case 15: /* definition: MODE attribute */
2206 #line 799 "gabc/gabc-score-determination.y"
2207 {
2208 check_multiple("mode", score->mode != 0);
2209 gregorio_add_score_header(score, yyvsp[-1].text, yyvsp[0].text);
2210 score->mode = yyvsp[0].text;
2211 }
2212 #line 2213 "gabc/gabc-score-determination-y.c"
2213 break;
2214
2215 case 16: /* definition: MODE_MODIFIER attribute */
2216 #line 804 "gabc/gabc-score-determination.y"
2217 {
2218 check_multiple("mode-modifier", score->mode_modifier != NULL);
2219 gregorio_add_score_header(score, yyvsp[-1].text, yyvsp[0].text);
2220 score->mode_modifier = yyvsp[0].text;
2221 }
2222 #line 2223 "gabc/gabc-score-determination-y.c"
2223 break;
2224
2225 case 17: /* definition: MODE_DIFFERENTIA attribute */
2226 #line 809 "gabc/gabc-score-determination.y"
2227 {
2228 check_multiple("mode-differentia", score->mode_differentia != NULL);
2229 gregorio_add_score_header(score, yyvsp[-1].text, yyvsp[0].text);
2230 score->mode_differentia = yyvsp[0].text;
2231 }
2232 #line 2233 "gabc/gabc-score-determination-y.c"
2233 break;
2234
2235 case 18: /* definition: STAFF_LINES attribute */
2236 #line 814 "gabc/gabc-score-determination.y"
2237 {
2238 check_multiple("staff-lines", got_staff_lines);
2239 if (yyvsp[0].text) {
2240 gregorio_add_score_header(score, yyvsp[-1].text, yyvsp[0].text);
2241 gregorio_set_score_staff_lines(score, atoi(yyvsp[0].text));
2242 got_staff_lines = true;
2243 }
2244 }
2245 #line 2246 "gabc/gabc-score-determination-y.c"
2246 break;
2247
2248 case 19: /* definition: NABC_LINES attribute */
2249 #line 822 "gabc/gabc-score-determination.y"
2250 {
2251 check_multiple("nabc lines", score->nabc_lines != 0);
2252 if (yyvsp[0].text) {
2253 gregorio_add_score_header(score, yyvsp[-1].text, yyvsp[0].text);
2254 nabc_lines=atoi(yyvsp[0].text);
2255 score->nabc_lines=nabc_lines;
2256 }
2257 }
2258 #line 2259 "gabc/gabc-score-determination-y.c"
2259 break;
2260
2261 case 20: /* definition: ANNOTATION attribute */
2262 #line 830 "gabc/gabc-score-determination.y"
2263 {
2264 if (score->annotation [MAX_ANNOTATIONS - 1]) {
2265 gregorio_messagef("det_score", VERBOSITY_WARNING, 0,
2266 _("too many definitions of annotation found, only the "
2267 "first %d will be taken"), MAX_ANNOTATIONS);
2268 }
2269 gregorio_add_score_header(score, yyvsp[-1].text, yyvsp[0].text);
2270 gregorio_set_score_annotation(score, yyvsp[0].text);
2271 }
2272 #line 2273 "gabc/gabc-score-determination-y.c"
2273 break;
2274
2275 case 21: /* definition: AUTHOR attribute */
2276 #line 839 "gabc/gabc-score-determination.y"
2277 {
2278 check_multiple("author", score->author != NULL);
2279 gregorio_add_score_header(score, yyvsp[-1].text, yyvsp[0].text);
2280 score->author = yyvsp[0].text;
2281 }
2282 #line 2283 "gabc/gabc-score-determination-y.c"
2283 break;
2284
2285 case 22: /* definition: ORISCUS_ORIENTATION attribute */
2286 #line 844 "gabc/gabc-score-determination.y"
2287 {
2288 gregorio_add_score_header(score, yyvsp[-1].text, yyvsp[0].text);
2289 score->legacy_oriscus_orientation = (strcmp(yyvsp[0].text, "legacy") == 0);
2290 }
2291 #line 2292 "gabc/gabc-score-determination-y.c"
2292 break;
2293
2294 case 23: /* definition: OTHER_HEADER attribute */
2295 #line 848 "gabc/gabc-score-determination.y"
2296 {
2297 gregorio_add_score_header(score, yyvsp[-1].text, yyvsp[0].text);
2298 }
2299 #line 2300 "gabc/gabc-score-determination-y.c"
2300 break;
2301
2302 case 26: /* note: NOTES CLOSING_BRACKET */
2303 #line 858 "gabc/gabc-score-determination.y"
2304 {
2305 gabc_y_add_notes(yyvsp[-1].text, (yylsp[-1]));
2306 free(yyvsp[-1].text);
2307 nabc_state=0;
2308 }
2309 #line 2310 "gabc/gabc-score-determination-y.c"
2310 break;
2311
2312 case 27: /* note: NOTES closing_bracket_with_space */
2313 #line 863 "gabc/gabc-score-determination.y"
2314 {
2315 gabc_y_add_notes(yyvsp[-1].text, (yylsp[-1]));
2316 free(yyvsp[-1].text);
2317 nabc_state=0;
2318 update_position_with_space();
2319 }
2320 #line 2321 "gabc/gabc-score-determination-y.c"
2321 break;
2322
2323 case 28: /* note: NOTES NABC_CUT */
2324 #line 869 "gabc/gabc-score-determination.y"
2325 {
2326 if (!nabc_lines) {
2327 gregorio_message(_("You used character \"|\" in gabc without "
2328 "setting \"nabc-lines\" parameter. Please "
2329 "set it in your gabc header."),
2330 "det_score", VERBOSITY_FATAL, 0);
2331 }
2332 gabc_y_add_notes(yyvsp[-1].text, (yylsp[-1]));
2333 free(yyvsp[-1].text);
2334 nabc_state = (nabc_state + 1) % (nabc_lines+1);
2335 }
2336 #line 2337 "gabc/gabc-score-determination-y.c"
2337 break;
2338
2339 case 29: /* note: CLOSING_BRACKET */
2340 #line 880 "gabc/gabc-score-determination.y"
2341 {
2342 elements[voice]=NULL;
2343 nabc_state=0;
2344 }
2345 #line 2346 "gabc/gabc-score-determination-y.c"
2346 break;
2347
2348 case 30: /* note: closing_bracket_with_space */
2349 #line 884 "gabc/gabc-score-determination.y"
2350 {
2351 elements[voice]=NULL;
2352 nabc_state=0;
2353 update_position_with_space();
2354 }
2355 #line 2356 "gabc/gabc-score-determination-y.c"
2356 break;
2357
2358 case 34: /* style_beginning: I_BEGIN */
2359 #line 898 "gabc/gabc-score-determination.y"
2360 {
2361 add_style(ST_ITALIC, SB_ITALIC);
2362 }
2363 #line 2364 "gabc/gabc-score-determination-y.c"
2364 break;
2365
2366 case 35: /* style_beginning: TT_BEGIN */
2367 #line 901 "gabc/gabc-score-determination.y"
2368 {
2369 add_style(ST_TT, SB_TT);
2370 }
2371 #line 2372 "gabc/gabc-score-determination-y.c"
2372 break;
2373
2374 case 36: /* style_beginning: UL_BEGIN */
2375 #line 904 "gabc/gabc-score-determination.y"
2376 {
2377 add_style(ST_UNDERLINED, SB_UNDERLINED);
2378 }
2379 #line 2380 "gabc/gabc-score-determination-y.c"
2380 break;
2381
2382 case 37: /* style_beginning: C_BEGIN */
2383 #line 907 "gabc/gabc-score-determination.y"
2384 {
2385 add_style(ST_COLORED, SB_COLORED);
2386 }
2387 #line 2388 "gabc/gabc-score-determination-y.c"
2388 break;
2389
2390 case 38: /* style_beginning: B_BEGIN */
2391 #line 910 "gabc/gabc-score-determination.y"
2392 {
2393 add_style(ST_BOLD, SB_BOLD);
2394 }
2395 #line 2396 "gabc/gabc-score-determination-y.c"
2396 break;
2397
2398 case 39: /* style_beginning: SC_BEGIN */
2399 #line 913 "gabc/gabc-score-determination.y"
2400 {
2401 add_style(ST_SMALL_CAPS, SB_SMALL_CAPS);
2402 }
2403 #line 2404 "gabc/gabc-score-determination-y.c"
2404 break;
2405
2406 case 40: /* style_beginning: VERB_BEGIN */
2407 #line 916 "gabc/gabc-score-determination.y"
2408 {
2409 add_style(ST_VERBATIM, SB_IGNORE);
2410 }
2411 #line 2412 "gabc/gabc-score-determination-y.c"
2412 break;
2413
2414 case 41: /* style_beginning: SP_BEGIN */
2415 #line 919 "gabc/gabc-score-determination.y"
2416 {
2417 add_style(ST_SPECIAL_CHAR, SB_IGNORE);
2418 }
2419 #line 2420 "gabc/gabc-score-determination-y.c"
2420 break;
2421
2422 case 42: /* style_end: I_END */
2423 #line 925 "gabc/gabc-score-determination.y"
2424 {
2425 end_style(ST_ITALIC, SB_ITALIC);
2426 }
2427 #line 2428 "gabc/gabc-score-determination-y.c"
2428 break;
2429
2430 case 43: /* style_end: TT_END */
2431 #line 928 "gabc/gabc-score-determination.y"
2432 {
2433 end_style(ST_TT, SB_TT);
2434 }
2435 #line 2436 "gabc/gabc-score-determination-y.c"
2436 break;
2437
2438 case 44: /* style_end: UL_END */
2439 #line 931 "gabc/gabc-score-determination.y"
2440 {
2441 end_style(ST_UNDERLINED, SB_UNDERLINED);
2442 }
2443 #line 2444 "gabc/gabc-score-determination-y.c"
2444 break;
2445
2446 case 45: /* style_end: C_END */
2447 #line 934 "gabc/gabc-score-determination.y"
2448 {
2449 end_style(ST_COLORED, SB_COLORED);
2450 }
2451 #line 2452 "gabc/gabc-score-determination-y.c"
2452 break;
2453
2454 case 46: /* style_end: B_END */
2455 #line 937 "gabc/gabc-score-determination.y"
2456 {
2457 end_style(ST_BOLD, SB_BOLD);
2458 }
2459 #line 2460 "gabc/gabc-score-determination-y.c"
2460 break;
2461
2462 case 47: /* style_end: SC_END */
2463 #line 940 "gabc/gabc-score-determination.y"
2464 {
2465 end_style(ST_SMALL_CAPS, SB_SMALL_CAPS);
2466 }
2467 #line 2468 "gabc/gabc-score-determination-y.c"
2468 break;
2469
2470 case 48: /* style_end: VERB_END */
2471 #line 943 "gabc/gabc-score-determination.y"
2472 {
2473 end_style(ST_VERBATIM, SB_IGNORE);
2474 }
2475 #line 2476 "gabc/gabc-score-determination-y.c"
2476 break;
2477
2478 case 49: /* style_end: SP_END */
2479 #line 946 "gabc/gabc-score-determination.y"
2480 {
2481 end_style(ST_SPECIAL_CHAR, SB_IGNORE);
2482 }
2483 #line 2484 "gabc/gabc-score-determination-y.c"
2484 break;
2485
2486 case 50: /* special_style_beginning: ELISION_BEGIN */
2487 #line 952 "gabc/gabc-score-determination.y"
2488 {
2489 add_style(ST_ELISION, SB_ELISION);
2490 }
2491 #line 2492 "gabc/gabc-score-determination-y.c"
2492 break;
2493
2494 case 51: /* special_style_beginning: CENTER_BEGIN */
2495 #line 955 "gabc/gabc-score-determination.y"
2496 {
2497 if (center_is_determined) {
2498 gregorio_message(
2499 "syllable already has center; ignoring additional center",
2500 "det_score", VERBOSITY_WARNING, 0);
2501 } else if (has_protrusion) {
2502 gregorio_message(
2503 "center not allowed after protrusion; ignored",
2504 "det_score", VERBOSITY_WARNING, 0);
2505 } else {
2506 add_style(ST_FORCED_CENTER, SB_IGNORE);
2507 center_is_determined = CENTER_HALF_DETERMINED;
2508 }
2509 }
2510 #line 2511 "gabc/gabc-score-determination-y.c"
2511 break;
2512
2513 case 52: /* special_style_end: ELISION_END */
2514 #line 972 "gabc/gabc-score-determination.y"
2515 {
2516 end_style(ST_ELISION, SB_ELISION);
2517 }
2518 #line 2519 "gabc/gabc-score-determination-y.c"
2519 break;
2520
2521 case 53: /* special_style_end: CENTER_END */
2522 #line 975 "gabc/gabc-score-determination.y"
2523 {
2524 if (center_is_determined == CENTER_HALF_DETERMINED) {
2525 end_style(ST_FORCED_CENTER, SB_IGNORE);
2526 center_is_determined = CENTER_FULLY_DETERMINED;
2527 } else {
2528 gregorio_message(
2529 "not within a syllable center",
2530 "det_score", VERBOSITY_WARNING, 0);
2531 }
2532 }
2533 #line 2534 "gabc/gabc-score-determination-y.c"
2534 break;
2535
2536 case 54: /* euouae: EUOUAE_B */
2537 #line 988 "gabc/gabc-score-determination.y"
2538 {
2539 euouae = EUOUAE_BEGINNING;
2540 }
2541 #line 2542 "gabc/gabc-score-determination-y.c"
2542 break;
2543
2544 case 55: /* euouae: EUOUAE_E */
2545 #line 991 "gabc/gabc-score-determination.y"
2546 {
2547 euouae = EUOUAE_END;
2548 }
2549 #line 2550 "gabc/gabc-score-determination-y.c"
2550 break;
2551
2552 case 56: /* linebreak_area: NLBA_B */
2553 #line 997 "gabc/gabc-score-determination.y"
2554 {
2555 no_linebreak_area = NLBA_BEGINNING;
2556 }
2557 #line 2558 "gabc/gabc-score-determination-y.c"
2558 break;
2559
2560 case 57: /* linebreak_area: NLBA_E */
2561 #line 1000 "gabc/gabc-score-determination.y"
2562 {
2563 no_linebreak_area = NLBA_END;
2564 }
2565 #line 2566 "gabc/gabc-score-determination-y.c"
2566 break;
2567
2568 case 58: /* protrusion: PROTRUSION PROTRUSION_VALUE PROTRUSION_END */
2569 #line 1006 "gabc/gabc-score-determination.y"
2570 {
2571 add_protrusion(yyvsp[-1].text);
2572 }
2573 #line 2574 "gabc/gabc-score-determination-y.c"
2574 break;
2575
2576 case 59: /* protrusion: PROTRUSION */
2577 #line 1009 "gabc/gabc-score-determination.y"
2578 {
2579 add_protrusion(gregorio_strdup("d")); /* d = default */
2580 }
2581 #line 2582 "gabc/gabc-score-determination-y.c"
2582 break;
2583
2584 case 61: /* character: CHARACTERS */
2585 #line 1016 "gabc/gabc-score-determination.y"
2586 {
2587 add_text(yyvsp[0].text);
2588 }
2589 #line 2590 "gabc/gabc-score-determination-y.c"
2590 break;
2591
2592 case 68: /* character: CLEAR */
2593 #line 1025 "gabc/gabc-score-determination.y"
2594 {
2595 clear_syllable_text = true;
2596 }
2597 #line 2598 "gabc/gabc-score-determination-y.c"
2598 break;
2599
2600 case 70: /* character: HYPHEN */
2601 #line 1029 "gabc/gabc-score-determination.y"
2602 {
2603 add_text(gregorio_strdup("-"));
2604 }
2605 #line 2606 "gabc/gabc-score-determination-y.c"
2606 break;
2607
2608 case 71: /* character: PROTRUDING_PUNCTUATION */
2609 #line 1032 "gabc/gabc-score-determination.y"
2610 {
2611 add_text(yyvsp[0].text);
2612 }
2613 #line 2614 "gabc/gabc-score-determination-y.c"
2614 break;
2615
2616 case 74: /* translation_character: CHARACTERS */
2617 #line 1043 "gabc/gabc-score-determination.y"
2618 {
2619 add_text(yyvsp[0].text);
2620 }
2621 #line 2622 "gabc/gabc-score-determination-y.c"
2622 break;
2623
2624 case 77: /* translation_character: HYPHEN */
2625 #line 1048 "gabc/gabc-score-determination.y"
2626 {
2627 add_text(gregorio_strdup("-"));
2628 }
2629 #line 2630 "gabc/gabc-score-determination-y.c"
2630 break;
2631
2632 case 78: /* translation_character: PROTRUDING_PUNCTUATION */
2633 #line 1051 "gabc/gabc-score-determination.y"
2634 {
2635 add_text(yyvsp[0].text);
2636 }
2637 #line 2638 "gabc/gabc-score-determination-y.c"
2638 break;
2639
2640 case 81: /* translation_beginning: TRANSLATION_BEGIN */
2641 #line 1062 "gabc/gabc-score-determination.y"
2642 {
2643 start_translation(TR_NORMAL);
2644 }
2645 #line 2646 "gabc/gabc-score-determination-y.c"
2646 break;
2647
2648 case 82: /* translation: translation_beginning TRANSLATION_END */
2649 #line 1068 "gabc/gabc-score-determination.y"
2650 {
2651 end_translation();
2652 }
2653 #line 2654 "gabc/gabc-score-determination-y.c"
2654 break;
2655
2656 case 83: /* translation: translation_beginning translation_text TRANSLATION_END */
2657 #line 1071 "gabc/gabc-score-determination.y"
2658 {
2659 end_translation();
2660 }
2661 #line 2662 "gabc/gabc-score-determination-y.c"
2662 break;
2663
2664 case 84: /* translation: TRANSLATION_CENTER_END */
2665 #line 1074 "gabc/gabc-score-determination.y"
2666 {
2667 start_translation(TR_WITH_CENTER_END);
2668 end_translation();
2669 }
2670 #line 2671 "gabc/gabc-score-determination-y.c"
2671 break;
2672
2673 case 85: /* above_line_text: ALT_BEGIN CHARACTERS ALT_END */
2674 #line 1081 "gabc/gabc-score-determination.y"
2675 {
2676 abovelinestext = yyvsp[-1].text;
2677 }
2678 #line 2679 "gabc/gabc-score-determination-y.c"
2679 break;
2680
2681 case 86: /* syllable_with_notes: text OPENING_BRACKET notes */
2682 #line 1087 "gabc/gabc-score-determination.y"
2683 {
2684 save_text();
2685 close_syllable(&(yylsp[-2]));
2686 }
2687 #line 2688 "gabc/gabc-score-determination-y.c"
2688 break;
2689
2690 case 87: /* syllable_with_notes: HYPHEN OPENING_BRACKET notes */
2691 #line 1091 "gabc/gabc-score-determination.y"
2692 {
2693 add_style(ST_VERBATIM, SB_IGNORE);
2694 add_text(gregorio_strdup("\\GreForceHyphen"));
2695 end_style(ST_VERBATIM, SB_IGNORE);
2696 save_text();
2697 close_syllable(&(yylsp[-2]));
2698 }
2699 #line 2700 "gabc/gabc-score-determination-y.c"
2700 break;
2701
2702 case 88: /* syllable_with_notes: text HYPHEN OPENING_BRACKET notes */
2703 #line 1098 "gabc/gabc-score-determination.y"
2704 {
2705 add_style(ST_VERBATIM, SB_IGNORE);
2706 add_text(gregorio_strdup("\\GreForceHyphen"));
2707 end_style(ST_VERBATIM, SB_IGNORE);
2708 save_text();
2709 close_syllable(&(yylsp[-3]));
2710 }
2711 #line 2712 "gabc/gabc-score-determination-y.c"
2712 break;
2713
2714 case 89: /* syllable_with_notes: PROTRUDING_PUNCTUATION OPENING_BRACKET notes */
2715 #line 1105 "gabc/gabc-score-determination.y"
2716 {
2717 add_auto_protrusion(yyvsp[-2].text);
2718 save_text();
2719 close_syllable(&(yylsp[-2]));
2720 }
2721 #line 2722 "gabc/gabc-score-determination-y.c"
2722 break;
2723
2724 case 90: /* syllable_with_notes: text PROTRUDING_PUNCTUATION OPENING_BRACKET notes */
2725 #line 1110 "gabc/gabc-score-determination.y"
2726 {
2727 add_auto_protrusion(yyvsp[-2].text);
2728 save_text();
2729 close_syllable(&(yylsp[-3]));
2730 }
2731 #line 2732 "gabc/gabc-score-determination-y.c"
2732 break;
2733
2734 case 91: /* syllable_with_notes: text translation OPENING_BRACKET notes */
2735 #line 1115 "gabc/gabc-score-determination.y"
2736 {
2737 save_text();
2738 close_syllable(&(yylsp[-3]));
2739 }
2740 #line 2741 "gabc/gabc-score-determination-y.c"
2741 break;
2742
2743 case 92: /* syllable_with_notes: HYPHEN translation OPENING_BRACKET notes */
2744 #line 1119 "gabc/gabc-score-determination.y"
2745 {
2746 add_style(ST_VERBATIM, SB_IGNORE);
2747 add_text(gregorio_strdup("\\GreForceHyphen"));
2748 end_style(ST_VERBATIM, SB_IGNORE);
2749 save_text();
2750 close_syllable(&(yylsp[-3]));
2751 }
2752 #line 2753 "gabc/gabc-score-determination-y.c"
2753 break;
2754
2755 case 93: /* syllable_with_notes: text HYPHEN translation OPENING_BRACKET notes */
2756 #line 1126 "gabc/gabc-score-determination.y"
2757 {
2758 add_style(ST_VERBATIM, SB_IGNORE);
2759 add_text(gregorio_strdup("\\GreForceHyphen"));
2760 end_style(ST_VERBATIM, SB_IGNORE);
2761 save_text();
2762 close_syllable(&(yylsp[-4]));
2763 }
2764 #line 2765 "gabc/gabc-score-determination-y.c"
2765 break;
2766
2767 case 94: /* syllable_with_notes: PROTRUDING_PUNCTUATION translation OPENING_BRACKET notes */
2768 #line 1133 "gabc/gabc-score-determination.y"
2769 {
2770 add_auto_protrusion(yyvsp[-3].text);
2771 save_text();
2772 close_syllable(&(yylsp[-3]));
2773 }
2774 #line 2775 "gabc/gabc-score-determination-y.c"
2775 break;
2776
2777 case 95: /* syllable_with_notes: text PROTRUDING_PUNCTUATION translation OPENING_BRACKET notes */
2778 #line 1138 "gabc/gabc-score-determination.y"
2779 {
2780 add_auto_protrusion(yyvsp[-3].text);
2781 save_text();
2782 close_syllable(&(yylsp[-4]));
2783 }
2784 #line 2785 "gabc/gabc-score-determination-y.c"
2785 break;
2786
2787 case 96: /* notes_without_word: OPENING_BRACKET notes */
2788 #line 1146 "gabc/gabc-score-determination.y"
2789 {
2790 close_syllable(NULL);
2791 }
2792 #line 2793 "gabc/gabc-score-determination-y.c"
2793 break;
2794
2795 case 97: /* notes_without_word: translation OPENING_BRACKET notes */
2796 #line 1149 "gabc/gabc-score-determination.y"
2797 {
2798 close_syllable(NULL);
2799 }
2800 #line 2801 "gabc/gabc-score-determination-y.c"
2801 break;
2802
2803
2804 #line 2805 "gabc/gabc-score-determination-y.c"
2805
2806 default: break;
2807 }
2808 /* User semantic actions sometimes alter yychar, and that requires
2809 that yytoken be updated with the new translation. We take the
2810 approach of translating immediately before every use of yytoken.
2811 One alternative is translating here after every semantic action,
2812 but that translation would be missed if the semantic action invokes
2813 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2814 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2815 incorrect destructor might then be invoked immediately. In the
2816 case of YYERROR or YYBACKUP, subsequent parser actions might lead
2817 to an incorrect destructor call or verbose syntax error message
2818 before the lookahead is translated. */
2819 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
2820
2821 YYPOPSTACK (yylen);
2822 yylen = 0;
2823
2824 *++yyvsp = yyval;
2825 *++yylsp = yyloc;
2826
2827 /* Now 'shift' the result of the reduction. Determine what state
2828 that goes to, based on the state we popped back to and the rule
2829 number reduced by. */
2830 {
2831 const int yylhs = yyr1[yyn] - YYNTOKENS;
2832 const int yyi = yypgoto[yylhs] + *yyssp;
2833 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
2834 ? yytable[yyi]
2835 : yydefgoto[yylhs]);
2836 }
2837
2838 goto yynewstate;
2839
2840
2841 /*--------------------------------------.
2842 | yyerrlab -- here on detecting error. |
2843 `--------------------------------------*/
2844 yyerrlab:
2845 /* Make sure we have latest lookahead translation. See comments at
2846 user semantic actions for why this is necessary. */
2847 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
2848 /* If not already recovering from an error, report this error. */
2849 if (!yyerrstatus)
2850 {
2851 ++yynerrs;
2852 yyerror (YY_("syntax error"));
2853 }
2854
2855 yyerror_range[1] = yylloc;
2856 if (yyerrstatus == 3)
2857 {
2858 /* If just tried and failed to reuse lookahead token after an
2859 error, discard it. */
2860
2861 if (yychar <= YYEOF)
2862 {
2863 /* Return failure if at end of input. */
2864 if (yychar == YYEOF)
2865 YYABORT;
2866 }
2867 else
2868 {
2869 yydestruct ("Error: discarding",
2870 yytoken, &yylval, &yylloc);
2871 yychar = YYEMPTY;
2872 }
2873 }
2874
2875 /* Else will try to reuse lookahead token after shifting the error
2876 token. */
2877 goto yyerrlab1;
2878
2879
2880 /*---------------------------------------------------.
2881 | yyerrorlab -- error raised explicitly by YYERROR. |
2882 `---------------------------------------------------*/
2883 yyerrorlab:
2884 /* Pacify compilers when the user code never invokes YYERROR and the
2885 label yyerrorlab therefore never appears in user code. */
2886 if (0)
2887 YYERROR;
2888 ++yynerrs;
2889
2890 /* Do not reclaim the symbols of the rule whose action triggered
2891 this YYERROR. */
2892 YYPOPSTACK (yylen);
2893 yylen = 0;
2894 YY_STACK_PRINT (yyss, yyssp);
2895 yystate = *yyssp;
2896 goto yyerrlab1;
2897
2898
2899 /*-------------------------------------------------------------.
2900 | yyerrlab1 -- common code for both syntax error and YYERROR. |
2901 `-------------------------------------------------------------*/
2902 yyerrlab1:
2903 yyerrstatus = 3; /* Each real token shifted decrements this. */
2904
2905 /* Pop stack until we find a state that shifts the error token. */
2906 for (;;)
2907 {
2908 yyn = yypact[yystate];
2909 if (!yypact_value_is_default (yyn))
2910 {
2911 yyn += YYSYMBOL_YYerror;
2912 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
2913 {
2914 yyn = yytable[yyn];
2915 if (0 < yyn)
2916 break;
2917 }
2918 }
2919
2920 /* Pop the current state because it cannot handle the error token. */
2921 if (yyssp == yyss)
2922 YYABORT;
2923
2924 yyerror_range[1] = *yylsp;
2925 yydestruct ("Error: popping",
2926 YY_ACCESSING_SYMBOL (yystate), yyvsp, yylsp);
2927 YYPOPSTACK (1);
2928 yystate = *yyssp;
2929 YY_STACK_PRINT (yyss, yyssp);
2930 }
2931
2932 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2933 *++yyvsp = yylval;
2934 YY_IGNORE_MAYBE_UNINITIALIZED_END
2935
2936 yyerror_range[2] = yylloc;
2937 ++yylsp;
2938 YYLLOC_DEFAULT (*yylsp, yyerror_range, 2);
2939
2940 /* Shift the error token. */
2941 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
2942
2943 yystate = yyn;
2944 goto yynewstate;
2945
2946
2947 /*-------------------------------------.
2948 | yyacceptlab -- YYACCEPT comes here. |
2949 `-------------------------------------*/
2950 yyacceptlab:
2951 yyresult = 0;
2952 goto yyreturnlab;
2953
2954
2955 /*-----------------------------------.
2956 | yyabortlab -- YYABORT comes here. |
2957 `-----------------------------------*/
2958 yyabortlab:
2959 yyresult = 1;
2960 goto yyreturnlab;
2961
2962
2963 /*-----------------------------------------------------------.
2964 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
2965 `-----------------------------------------------------------*/
2966 yyexhaustedlab:
2967 yyerror (YY_("memory exhausted"));
2968 yyresult = 2;
2969 goto yyreturnlab;
2970
2971
2972 /*----------------------------------------------------------.
2973 | yyreturnlab -- parsing is finished, clean up and return. |
2974 `----------------------------------------------------------*/
2975 yyreturnlab:
2976 if (yychar != YYEMPTY)
2977 {
2978 /* Make sure we have latest lookahead translation. See comments at
2979 user semantic actions for why this is necessary. */
2980 yytoken = YYTRANSLATE (yychar);
2981 yydestruct ("Cleanup: discarding lookahead",
2982 yytoken, &yylval, &yylloc);
2983 }
2984 /* Do not reclaim the symbols of the rule whose action triggered
2985 this YYABORT or YYACCEPT. */
2986 YYPOPSTACK (yylen);
2987 YY_STACK_PRINT (yyss, yyssp);
2988 while (yyssp != yyss)
2989 {
2990 yydestruct ("Cleanup: popping",
2991 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yylsp);
2992 YYPOPSTACK (1);
2993 }
2994 #ifndef yyoverflow
2995 if (yyss != yyssa)
2996 YYSTACK_FREE (yyss);
2997 #endif
2998
2999 return yyresult;
3000 }
3001