%{ // -*-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 "lily-guile.hh" #include "notename-table.hh" #include "scalar.hh" #include "translation-property.hh" #include "script-def.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 "dimensions.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 "duration-convert.hh" #include "change-translator.hh" #include "file-results.hh" #include "mudela-version.hh" #include "scope.hh" #include "relative-music.hh" #include "transposed-music.hh" #include "compressed-music.hh" #include "repeated-music.hh" // mmm Mudela_version oldest_version ("1.0.14"); Mudela_version version ("1.0.15"); // needed for bison.simple's malloc() and free() #include struct Assignment { String *name_p_; Identifier *id_p_; ~Assignment () { delete name_p_; delete id_p_; } Assignment () { name_p_ = 0; id_p_ =0; } Assignment (Assignment const&s) { name_p_ = new String (*s.name_p_); id_p_ = s.id_p_->clone (); } }; 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; Notename_table *chordmodifiertab; Duration *duration; General_script_def * script; Identifier *id; Music *music; Music_list *music_list; Score *score; Scope *scope; Interval *interval; 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; Scalar *scalar; Simultaneous_music *chord; String *string; Tempo_req *tempo; Text_def * textdef; Translator* trans; char c; const char *consstr; int i; 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 ALTERNATIVE %token BAR %token CADENZA %token CHORDMODIFIERS %token CHORDS %token CLEF %token CM_T %token CONSISTS %token DURATION %token EXTENDER %token FONT %token GROUPING %token HEADER %token IN_T %token KEY %token KEYSIGNATURE %token LYRICS %token MARK %token MEASURES %token MIDI %token MM_T %token MUSICAL_PITCH %token NAME %token NOTENAMES %token NOTES %token PAPER %token PARTIAL %token PENALTY %token PROPERTY %token PT_T %token RELATIVE %token REMOVE %token REPEAT %token SCM_T %token SCMFILE %token SCORE %token SCRIPT %token SHAPE %token SKIP %token SPANDYNAMIC %token TEMPO %token TIME_T %token TIMES %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 TONICNAME_PITCH %token CHORDMODIFIER_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 REAL %token DURATION RESTNAME %token STRING %token UNSIGNED %type output_def %type mudela_header mudela_header_body %type open_request_parens close_request_parens %type sub_quotes sup_quotes %type simple_element request_chord command_element Simple_music Composite_music %type Alternative_music Repeated_music %type abbrev_type %type int unsigned %type script_dir %type optional_modality %type identifier_init simple_identifier_init block_identifier %type steno_duration notemode_duration %type entered_notemode_duration explicit_duration %type intastint_list int_list %type explicit_musical_pitch steno_musical_pitch musical_pitch absolute_musical_pitch %type steno_tonic_pitch %type steno_notepitch %type pitch_list %type chord notemode_chord %type chord_additions chord_subtractions chord_notes %type chord_addsub chord_note chord_inversion notemode_chord_inversion %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_def_body %type real_expression real dimension %type abbrev_command_req %type post_request structured_post_request %type command_req verbose_command_req %type script_req dynamic_req extender_req %type string %type score_block score_body %type shape_array %type