X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Flexer.ll;h=af4afebe88877b74c387ef6f786cbfff37418e73;hb=5d057e2673b75417a187d75f09023f6071a81e3e;hp=bf829eab8082b17558251ad3902bfdbf589279fc;hpb=6ac8e1b2d7640826ae251e040de5efbc36da68ab;p=lilypond.git diff --git a/lily/lexer.ll b/lily/lexer.ll index bf829eab80..af4afebe88 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -4,7 +4,7 @@ source file of the LilyPond music typesetter - (c) 1996--2003 Han-Wen Nienhuys + (c) 1996--2004 Han-Wen Nienhuys Jan Nieuwenhuizen */ @@ -63,7 +63,7 @@ SCM lookup_markup_command (String s); bool -valid_version_b (String s); +is_valid_version (String s); @@ -171,7 +171,7 @@ HYPHEN -- s = s.left_string (s.index_last ('\"')); yy_pop_state(); - if (!valid_version_b (s)) + if (!is_valid_version (s)) return INVALID; } \"[^"]*\" { /* got the version number */ @@ -180,7 +180,9 @@ HYPHEN -- yy_pop_state(); this->here_input().source_file_->name_ = s; - progress_indication (_f("\nRenamed input to `%s'", s.to_str0())); + progress_indication ("\n"); + progress_indication (_f ("input renamed to: `%s'", s.to_str0 ())); + progress_indication ("\n"); scm_module_define (gh_car (scopes_), ly_symbol2scm ("input-file-name"), scm_makfrom0str (s.to_str0())); @@ -230,7 +232,7 @@ HYPHEN -- String s (YYText ()+1); s = s.left_string (s.index_last ('"')); - new_input (s, &global_input_file->sources_ ); + new_input (s, &global_input_file->sources_); yy_pop_state (); } \\{BLACK}*;?{WHITE} { /* got the include identifier */ @@ -264,25 +266,6 @@ HYPHEN -- R { return MULTI_MEASURE_REST; } -\\\${BLACK}*{WHITE} { - String s=YYText () + 2; - s=s.left_string (s.length () - 1); - return scan_escaped_word (s); -} -\${BLACK}*{WHITE} { - String s=YYText () + 1; - s=s.left_string (s.length () - 1); - return scan_bare_word (s); -} -\\\${BLACK}* { // backup rule - error (_("white expected")); - exit (1); -} -\${BLACK}* { // backup rule - error (_("white expected")); - exit (1); -} - # { //embedded scm //char const* s = YYText () + 1; char const* s = here_str0 (); @@ -618,8 +601,9 @@ My_lily_lexer::push_figuredbass_state() yy_push_state (figures); } void -My_lily_lexer::push_chord_state () +My_lily_lexer::push_chord_state (SCM tab) { + pitchname_tab_stack_ = gh_cons (tab, pitchname_tab_stack_); yy_push_state (chords); } @@ -638,15 +622,15 @@ My_lily_lexer::push_markup_state () void My_lily_lexer::pop_state () { - if (YYSTATE == notes) + if (YYSTATE == notes || YYSTATE == chords) pitchname_tab_stack_ = gh_cdr (pitchname_tab_stack_); yy_pop_state (); } int -My_lily_lexer::identifier_type(SCM sid) +My_lily_lexer::identifier_type (SCM sid) { - int k = try_special_identifiers(&yylval.scm , sid); + int k = try_special_identifiers (&yylval.scm , sid); return k >= 0 ? k : SCM_IDENTIFIER; } @@ -682,7 +666,9 @@ My_lily_lexer::scan_bare_word (String str) { SCM sym = ly_symbol2scm (str.to_str0 ()); if ((YYSTATE == notes) || (YYSTATE == chords)) { - SCM handle = scm_hashq_get_handle (gh_car (pitchname_tab_stack_), sym); + SCM handle = SCM_BOOL_F; + if (gh_pair_p (pitchname_tab_stack_)) + handle = scm_hashq_get_handle (gh_car (pitchname_tab_stack_), sym); if (gh_pair_p (handle)) { yylval.scm = ly_cdr (handle); @@ -703,25 +689,25 @@ My_lily_lexer::scan_bare_word (String str) } bool -My_lily_lexer::note_state_b () const +My_lily_lexer::is_note_state () const { return YY_START == notes; } bool -My_lily_lexer::chord_state_b () const +My_lily_lexer::is_chord_state () const { return YY_START == chords; } bool -My_lily_lexer::lyric_state_b () const +My_lily_lexer::is_lyric_state () const { return YY_START == lyrics; } bool -My_lily_lexer::figure_state_b () const +My_lily_lexer::is_figure_state () const { return YY_START == figures; } @@ -754,12 +740,12 @@ strip_trailing_white (String&s) -/* 1.9.0 == postfix articulations */ -Lilypond_version oldest_version ("1.9.0"); +/* 2.1.2x something -> \property -> \set. */ +Lilypond_version oldest_version ("2.1.25"); bool -valid_version_b (String s) +is_valid_version (String s) { Lilypond_version current ( MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL ); Lilypond_version ver (s); @@ -774,7 +760,7 @@ valid_version_b (String s) /* - substittute _ adn \, + substitute _ and \, */ String lyric_fudge (String s) @@ -839,9 +825,7 @@ avoid_silly_flex_induced_gcc_warnings () SCM lookup_markup_command (String s) { - static SCM proc ; - if (!proc) - proc = scm_c_eval_string ("lookup-markup-command"); + SCM proc = ly_scheme_function ("lookup-markup-command"); return scm_call_1 (proc, scm_makfrom0str (s.to_str0 ())); }