X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fparser.yy;h=61cf45a73190088bcbe2389cd5624f3531f41797;hb=8d42f330d9a6ca0111ef66ce349a42751d686582;hp=a0f7a7ab99027e60002d811e02a04ec7ed781550;hpb=3ebb10db0704fb5c4674a59ec2e827ba4476792c;p=lilypond.git diff --git a/lily/parser.yy b/lily/parser.yy index a0f7a7ab99..61cf45a731 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -53,6 +53,14 @@ Music *context_spec_music (SCM type, SCM id, Music *m, SCM ops); SCM get_next_unique_context_id (); SCM get_next_unique_lyrics_context_id (); +#undef _ +#if !HAVE_GETTEXT +#define _(x) x +#else +#include +#define _(x) gettext (x) +#endif + #define YYERROR_VERBOSE 1 #define YYPARSE_PARAM my_lily_parser @@ -249,111 +257,135 @@ or %pure_parser %locations -%token ACCEPTS -%token ADDQUOTE -%token LYRICSTO -%token ALIAS -%token ALTERNATIVE -%token BAR -%token BOOK -%token CHANGE +/* FIXME: The third option is an alias that will be used to display + the syntax error. There's a bug (reported with patch) in bison CVS + that prints double backslashes + + bison.ly:1:5: error: syntax error, unexpected \\book", expecting '{' + \book + \book %expect \book error here + +/* Keyword tokens with plain escaped name. */ +%token ACCEPTS "\\accepts" +%token ADDLYRICS "\\addlyrics" +%token ADDQUOTE "\\addquote" +%token ALIAS "\\alias" +%token ALTERNATIVE "\\alternative" +%token BAR "\\bar" +%token BOOK "\\book" +%token CHANGE "\\change" +%token CHORDMODE "\\chordmode" +%token CHORDS "\\chords" +%token CLEF "\\clef" +%token CONSISTS "\\consists" +%token CONTEXT "\\context" +%token DEFAULT "\\default" +%token DENIES "\\denies" +%token DESCRIPTION "\\description" +%token DRUMMODE "\\drummode" +%token DRUMS "\\drums" +%token FIGUREMODE "\\figuremode" +%token FIGURES "\\figures" +%token GROBDESCRIPTIONS "\\grobdescriptions" +%token HEADER "\\header" +%token INVALID "\\invalid" +%token KEY "\\key" +%token LAYOUT "\\layout" +%token LYRICMODE "\\lyricmode" +%token LYRICS "\\lyrics" +%token LYRICSTO "\\lyricsto" +%token MARK "\\mark" +%token MARKUP "\\markup" +%token MIDI "\\midi" +%token NAME "\\name" +%token NOTEMODE "\\notemode" +%token OBJECTID "\\objectid" +%token OCTAVE "\\octave" +%token ONCE "\\once" +%token OVERRIDE "\\override" +%token PAPER "\\paper" +%token PARTIAL "\\partial" +%token RELATIVE "\\relative" +%token REMOVE "\\remove" +%token REPEAT "\\repeat" +%token REST "\\rest" +%token REVERT "\\revert" +%token SCORE "\\score" +%token SEQUENTIAL "\\sequential" +%token SET "\\set" +%token SIMULTANEOUS "\\simultaneous" +%token SKIP "\\skip" +%token TAG "\\tag" +%token TEMPO "\\tempo" +%token TIMES "\\times" +%token TRANSPOSE "\\transpose" +%token TRANSPOSITION "\\transposition" +%token TYPE "\\type" +%token UNSET "\\unset" +%token WITH "\\with" + +/* Keyword token exceptions. */ +%token TIME_T "\\time" +%token NEWCONTEXT "\\new" + + +/* Other string tokens. */ + +%token CHORD_BASS "/+" +%token CHORD_CARET "^" +%token CHORD_COLON ":" +%token CHORD_MINUS "-" +%token CHORD_SLASH "/" +%token DOUBLE_ANGLE_CLOSE ">>" +%token DOUBLE_ANGLE_OPEN "<<" +%token E_BACKSLASH "\\" +%token E_ANGLE_CLOSE "\\>" +%token E_CHAR "\\C[haracter]" +%token E_CLOSE "\\)" +%token E_EXCLAMATION "\\!" +%token E_BRACKET_OPEN "\\[" +%token E_OPEN "\\(" +%token E_BRACKET_CLOSE "\\]" +%token E_ANGLE_OPEN "\\<" +%token E_TILDE "\\~" +%token EXTENDER "__" +/* These used at all? + %token FIGURE_BRACKET_CLOSE + %token FIGURE_BRACKET_OPEN + +parser.yy:348.8-25: warning: symbol `"\\>"' used more than once as a literal string +parser.yy:352.8-24: warning: symbol `"\\<"' used more than once as a literal string + +*/ +%token FIGURE_CLOSE /* "\\>" */ +%token FIGURE_OPEN /* "\\<" */ +%token FIGURE_SPACE "_" +%token HYPHEN "--" + %token CHORDMODIFIERS -%token CHORDS -%token CHORDMODE -%token DOUBLE_ANGLE_OPEN -%token DOUBLE_ANGLE_CLOSE -%token CLEF %token COMMANDSPANREQUEST -%token CONSISTS -%token CONTEXT -%token DEFAULT -%token DENIES -%token DESCRIPTION -%token EXTENDER -%token FIGURES -%token FIGUREMODE -%token FIGURE_OPEN FIGURE_CLOSE -%token FIGURE_BRACKET_CLOSE FIGURE_BRACKET_OPEN -%token GROBDESCRIPTIONS -%token HEADER -%token HYPHEN -%token INVALID -%token KEY -%token LAYOUT -%token LYRICS %token LYRIC_MARKUP -%token LYRICMODE -%token MARK -%token MIDI %token MULTI_MEASURE_REST -%token NAME -%token NEWCONTEXT -%token NOTEMODE -%token OBJECTID -%token OCTAVE -%token ONCE -%token OVERRIDE SET REVERT -%token PAPER -%token PARTIAL -%token QUOTE -%token RELATIVE -%token REMOVE -%token REPEAT -%token REST %token SCM_T -%token SCORE -%token SEQUENTIAL -%token ADDLYRICS -%token SIMULTANEOUS -%token SKIP -%token SPANREQUEST -%token TAG -%token TEMPO -%token TIMES -%token TIME_T -%token TRANSPOSE -%token TRANSPOSITION -%token TYPE -%token UNSET -%token WITH -%token MARKUP - -/* escaped */ -/* FIXME: this sucks. The user will get to see these names: - syntax error, unexpected E_CHAR: - \ - %% - */ - -%token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE -%token E_LEFTSQUARE E_RIGHTSQUARE E_TILDE -%token E_BACKSLASH -%token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET CHORD_SLASH -%token FIGURE_SPACE - -%token DIGIT -%token UNSIGNED + + +%token DIGIT %token E_UNSIGNED -%token IDENTIFIER -%token CHORDMODIFIER_PITCH -%token DRUM_PITCH -%token DURATION_IDENTIFIER -%token EVENT_IDENTIFIER -%token MUSIC_IDENTIFIER CONTEXT_DEF_IDENTIFIER -%token NOTENAME_PITCH -%token NUMBER_IDENTIFIER -%token OUTPUT_DEF_IDENTIFIER -%token RESTNAME +%token UNSIGNED + +%token IDENTIFIER + +%token CHORDMODIFIER_PITCH +%token CHORD_MODIFIER +%token CONTEXT_DEF_IDENTIFIER +%token DRUM_PITCH +%token DURATION_IDENTIFIER +%token EVENT_IDENTIFIER +%token FRACTION %token LYRICS_STRING -%token SCM_T -%token SCORE_IDENTIFIER -%token STRING -%token STRING_IDENTIFIER SCM_IDENTIFIER -%token TONICNAME_PITCH -%token CHORD_MODIFIER -%token FRACTION -%token REAL +%token LYRIC_MARKUP_IDENTIFIER %token MARKUP_HEAD_EMPTY +%token MARKUP_HEAD_LIST0 %token MARKUP_HEAD_MARKUP0 %token MARKUP_HEAD_MARKUP0_MARKUP1 %token MARKUP_HEAD_SCM0 @@ -361,87 +393,151 @@ or %token MARKUP_HEAD_SCM0_SCM1 %token MARKUP_HEAD_SCM0_SCM1_MARKUP2 %token MARKUP_HEAD_SCM0_SCM1_SCM2 -%token LYRIC_MARKUP_IDENTIFIER MARKUP_IDENTIFIER MARKUP_HEAD_LIST0 +%token MARKUP_IDENTIFIER %token MUSIC_FUNCTION +%token MUSIC_FUNCTION_MARKUP +%token MUSIC_FUNCTION_MARKUP_MARKUP +%token MUSIC_FUNCTION_MARKUP_MARKUP_MUSIC +%token MUSIC_FUNCTION_MARKUP_MUSIC +%token MUSIC_FUNCTION_MARKUP_MUSIC_MUSIC %token MUSIC_FUNCTION_MUSIC %token MUSIC_FUNCTION_MUSIC_MUSIC %token MUSIC_FUNCTION_SCM -%token MUSIC_FUNCTION_SCM_SCM %token MUSIC_FUNCTION_SCM_MUSIC %token MUSIC_FUNCTION_SCM_MUSIC_MUSIC +%token MUSIC_FUNCTION_SCM_SCM %token MUSIC_FUNCTION_SCM_SCM_MUSIC -%token MUSIC_FUNCTION_MARKUP -%token MUSIC_FUNCTION_MARKUP_MARKUP -%token MUSIC_FUNCTION_MARKUP_MUSIC -%token MUSIC_FUNCTION_MARKUP_MUSIC_MUSIC -%token MUSIC_FUNCTION_MARKUP_MARKUP_MUSIC - -%token DRUMS -%token DRUMMODE - - -%type book_block book_body -%type bare_int bare_unsigned -%type exclamations questions dots optional_rest -%type script_dir -%type sub_quotes sup_quotes -%type tremolo_type -%type bass_mod - -%type Composite_music Simple_music Prefix_composite_music Generic_prefix_music -%type Grouped_music_list -%type Music Sequential_music Simultaneous_music -%type Repeated_music -%type command_req -%type gen_text_def direction_less_event direction_reqd_event -%type music_property_def context_change -%type note_chord_element chord_body chord_body_element -%type post_event tagged_post_event -%type relative_music re_rhythmed_music -%type simple_element event_chord command_element -%type string_number_event -%type toplevel_music -%type tempo_event - -%type output_def_body output_def_head -%type output_def paper_block - -%type assignment_id -%type Music_list -%type chord_body_elements -%type chord_item chord_items chord_separator new_chord -%type context_def_spec_block context_def_spec_body -%type context_mod context_def_mod optional_context_mod -%type context_prop_spec -%type direction_less_char -%type duration_length fraction -%type embedded_scm scalar -%type identifier_init -%type lilypond_header lilypond_header_body -%type new_lyrics -%type post_events -%type property_operation -%type script_abbreviation -%type simple_string -%type steno_pitch pitch absolute_pitch pitch_also_in_chords -%type steno_tonic_pitch -%type step_number step_numbers -%type string bare_number number_expression number_term number_factor -%type bass_number br_bass_figure bass_figure figure_list figure_spec -%type context_mod_list -%type octave_check -%type steno_duration optional_notemode_duration multiplied_duration -%type Generic_prefix_music_scm -%type lyric_element -%type Alternative_music -%type full_markup lyric_markup -%type markup_list markup_composed_list markup_braced_list markup_braced_list_body -%type markup_head_1_item markup_head_1_list markup simple_markup markup_top -%type mode_changing_head -%type mode_changing_head_with_context -%type object_id_setting - -%type score_block score_body +%token MUSIC_IDENTIFIER +%token NOTENAME_PITCH +%token NUMBER_IDENTIFIER +%token OUTPUT_DEF_IDENTIFIER +%token REAL +%token RESTNAME +%token SCM_IDENTIFIER +%token SCM_T +%token SCORE_IDENTIFIER +%token STRING +%token STRING_IDENTIFIER +%token TONICNAME_PITCH + + +%type book_block +%type book_body + +%type bare_int +%type bare_unsigned +%type bass_mod +%type dots +%type exclamations +%type optional_rest +%type questions +%type script_dir +%type sub_quotes +%type sup_quotes +%type tremolo_type + +%type Composite_music +%type Generic_prefix_music +%type Grouped_music_list +%type Music +%type Prefix_composite_music +%type Repeated_music +%type Sequential_music +%type Simple_music +%type Simultaneous_music +%type chord_body +%type chord_body_element +%type command_element +%type command_req +%type context_change +%type direction_less_event +%type direction_reqd_event +%type event_chord +%type gen_text_def +%type music_property_def +%type note_chord_element +%type post_event +%type re_rhythmed_music +%type relative_music +%type simple_element +%type string_number_event +%type tagged_post_event +%type tempo_event +%type toplevel_music + +%type output_def_body +%type output_def_head +%type output_def +%type paper_block + +%type Alternative_music +%type Generic_prefix_music_scm +%type Music_list +%type absolute_pitch +%type assignment_id +%type bare_number +%type bass_figure +%type bass_number +%type br_bass_figure +%type chord_body_elements +%type chord_item +%type chord_items +%type chord_separator +%type context_def_mod +%type context_def_spec_block +%type context_def_spec_body +%type context_mod +%type context_mod_list +%type context_prop_spec +%type direction_less_char +%type duration_length +%type embedded_scm +%type figure_list +%type figure_spec +%type fraction +%type full_markup +%type identifier_init +%type lilypond_header +%type lilypond_header_body +%type lyric_element +%type lyric_markup +%type markup +%type markup_braced_list +%type markup_braced_list_body +%type markup_composed_list +%type markup_head_1_item +%type markup_head_1_list +%type markup_list +%type markup_top +%type mode_changing_head +%type mode_changing_head_with_context +%type multiplied_duration +%type new_chord +%type new_lyrics +%type number_expression +%type number_factor +%type number_term +%type object_id_setting +%type octave_check +%type optional_context_mod +%type optional_notemode_duration +%type pitch +%type pitch_also_in_chords +%type post_events +%type property_operation +%type scalar +%type script_abbreviation +%type simple_markup +%type simple_string +%type steno_duration +%type steno_pitch +%type steno_tonic_pitch +%type step_number +%type step_numbers +%type string + +%type score_block +%type score_body %left '-' '+' @@ -1598,7 +1694,7 @@ command_element: $$->set_spot (@$); $$->set_property ("pitch", $2); } - | E_LEFTSQUARE { + | E_BRACKET_OPEN { Music *m = MY_MAKE_MUSIC ("LigatureEvent"); m->set_property ("span-direction", scm_int2num (START)); m->set_spot (@$); @@ -1608,7 +1704,7 @@ command_element: scm_gc_unprotect_object (m->self_scm ()); $$->set_spot (@$); } - | E_RIGHTSQUARE { + | E_BRACKET_CLOSE { Music *m = MY_MAKE_MUSIC ("LigatureEvent"); m->set_property ("span-direction", scm_int2num (STOP)); m->set_spot (@$); @@ -1801,10 +1897,10 @@ direction_less_char: | E_CLOSE { $$ = ly_symbol2scm ("escapedParenthesisCloseSymbol"); } - | E_BIGGER { + | E_ANGLE_CLOSE { $$ = ly_symbol2scm ("escapedBiggerSymbol"); } - | E_SMALLER { + | E_ANGLE_OPEN { $$ = ly_symbol2scm ("escapedSmallerSymbol"); } ;