%{ // -*-Fundamental-*- /* parser.yy -- Bison/C++ parser for mudela source file of the GNU LilyPond music typesetter (c) 1997 Han-Wen Nienhuys Jan Nieuwenhuizen */ #include #include "notename-table.hh" #include "scalar.hh" #include "translation-property.hh" #include "script-def.hh" #include "symtable.hh" #include "lookup.hh" #include "misc.hh" #include "my-lily-lexer.hh" #include "paper-def.hh" #include "midi-def.hh" #include "main.hh" #include "file-path.hh" #include "keyword.hh" #include "debug.hh" #include "parseconstruct.hh" #include "dimension.hh" #include "identifier.hh" #include "command-request.hh" #include "musical-request.hh" #include "my-lily-parser.hh" #include "text-def.hh" #include "translator-group.hh" #include "score.hh" #include "music-list.hh" #include "header.hh" #include "duration-convert.hh" #include "change-translator.hh" #include "file-results.hh" #include "mudela-version.hh" #include "scope.hh" #include "relative-music.hh" // mmm Mudela_version oldest_version ("1.0.3"); Mudela_version version ("1.0.4"); // needed for bison.simple's malloc() and free() #include int const GUESS_PLET = 5; int guess_plet_a[GUESS_PLET] = { 1, 3, 2, 3, 4 }; Paper_def* current_paper = 0; #ifndef NDEBUG #define YYDEBUG 1 #endif #define YYERROR_VERBOSE 1 #define YYPARSE_PARAM my_lily_parser_l #define YYLEX_PARAM my_lily_parser_l #define THIS ((My_lily_parser *) my_lily_parser_l) #define yyerror THIS->parser_error #define ARRAY_SIZE(a,s) if (a.size () != s) THIS->parser_error (_f("expecting %d arguments", s)) %} %union { Array* intarr; Array *pitch_arr; Array * strvec; Array *intvec; Box *box; Simultaneous_music *chord; Duration *duration; Identifier *id; Translator* trans; Music *music; Music_list *music_list; Score *score; Header *header; Interval *interval; Lookup*lookup; Musical_req* musreq; Music_output_def * outputdef; Musical_pitch * pitch; Midi_def* midi; Moment *moment; Note_req *notereq; Notename_table *notenametab; Paper_def *paper; Real real; Request * request; General_script_def * script; Scalar *scalar; String *string; Atom * symbol; Symtable * symtable; Symtables * symtables; Text_def * textdef; Tempo_req *tempo; char c; const char *consstr; int i; int pair[2]; int ii[10]; } %{ int yylex (YYSTYPE *s, void * v_l) { My_lily_parser *pars_l = (My_lily_parser*) v_l; My_lily_lexer * lex_l = pars_l->lexer_p_; lex_l->lexval_l = (void*) s; return lex_l->yylex (); } %} %pure_parser /* tokens which are not keywords */ %token ABSDYNAMIC %token ACCEPTS %token BAR %token BEAMPLET %token CADENZA %token CLEF %token CM_T %token CONSISTS %token DURATION %token END %token FONT %token GROUPING %token HEADER %token IN_T %token KEY %token KEYSIGNATURE %token LYRIC %token MAEBTELP %token MARK %token MEASURES %token MIDI %token MM_T %token MUSIC %token MUSICAL_PITCH %token NOTENAMES %token NOTES %token OCTAVE %token OUTPUT %token PAPER %token PARTIAL %token PENALTY %token PLET %token PROPERTY %token PT_T %token RELATIVE %token SCORE %token SCRIPT %token SHAPE %token SKIP %token SPANDYNAMIC %token SYMBOLTABLES %token TABLE %token TELP %token TEMPO %token TIME_T %token TRANSLATOR %token TRANSPOSE %token TYPE %token VERSION /* escaped */ %token E_EXCLAMATION E_SMALLER E_BIGGER E_CHAR %type dots %token DIGIT %token NOTENAME_PITCH %token DURATION_IDENTIFIER %token IDENTIFIER %token NOTENAME_TABLE_IDENTIFIER %token MUSIC_IDENTIFIER %token POST_REQUEST_IDENTIFIER %token SCRIPT_IDENTIFIER %token COMMAND_IDENTIFIER %token REAL_IDENTIFIER %token STRING_IDENTIFIER %token TRANS_IDENTIFIER %token INT_IDENTIFIER %token SCORE_IDENTIFIER %token MIDI_IDENTIFIER %token PAPER_IDENTIFIER %token REQUEST_IDENTIFIER %token REAL %token DURATION RESTNAME %token STRING %token UNSIGNED %type output_def %type
mudela_header mudela_header_body %type box %type open_request_parens close_request_parens %type open_abbrev_parens %type open_plet_parens close_plet_parens %type sub_quotes sup_quotes %type simple_element request_chord command_element %type abbrev_type %type int unsigned %type script_dir %type identifier_init simple_identifier_init %type steno_duration notemode_duration %type entered_notemode_duration explicit_duration %type dinterval %type intastint_list int_list %type symtables symtables_body %type explicit_musical_pitch steno_musical_pitch musical_pitch absolute_musical_pitch %type steno_notepitch %type pitch_list %type midi_block midi_body %type duration_length %type scalar %type Music relative_music Sequential_music Simultaneous_music %type property_def translator_change %type Music_list %type paper_block paper_body %type dim real %type real_mult_expression real_primary %type unit %type abbrev_command_req %type post_request structured_post_request %type plet_fraction %type command_req verbose_command_req %type script_req dynamic_req %type string %type string_primary %type score_block score_body %type shape_array %type