From: fred Date: Tue, 26 Mar 2002 23:23:03 +0000 (+0000) Subject: lilypond-1.3.60 X-Git-Tag: release/1.5.59~1576 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=060ae892fbaeeb10d5db70bb392bf23ba89e37bf;p=lilypond.git lilypond-1.3.60 --- diff --git a/lily/lexer.ll b/lily/lexer.ll index 23692d60d7..57d9537bf1 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -188,18 +188,12 @@ HYPHEN -- if (s.length_i () && (s[s.length_i () - 1] == ';')) s = s.left_str (s.length_i () - 1); DEBUG_OUT << "#include `\\" << s << "'\n"; - Identifier * id = lookup_identifier (s); - if (id) - { - String* s_l = id->access_content_String (false); - DEBUG_OUT << "#include `" << *s_l << "'\n"; - new_input (*s_l, source_global_l); - - yy_pop_state (); - } - else - { - String msg (_f ("undefined identifier: `%s'", s )); + SCM sid = lookup_identifier (s); + if (gh_string_p (sid)) { + new_input (ly_scm2string (sid), source_global_l); + yy_pop_state (); + } else { + String msg (_f ("wrong or undefined identifier: `%s'", s )); LexerError (msg.ch_C ()); } } @@ -475,11 +469,21 @@ My_lily_lexer::scan_escaped_word (String str) if (l != -1) { return l; } - Identifier * id = lookup_identifier (str); + SCM sid = lookup_identifier (str); + if (gh_string_p (sid)) { + yylval.scm = sid; + return STRING_IDENTIFIER; + } + + Identifier * id = unsmob_identifier (sid); if (id) { yylval.id = id; return id->token_code_i_; + } else if (sid != SCM_UNDEFINED) { + yylval.scm = sid; + return SCM_IDENTIFIER; } + if ((YYSTATE != notes) && (YYSTATE != chords)) { SCM pitch = scm_hashq_ref (pitchname_tab_, sym, SCM_BOOL_F); diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 9f5b91fa93..6336f7dd11 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -373,6 +373,10 @@ ly_number2string (SCM s) return gh_str02scm (str); } +/* + Undef this to see if GUILE GC is causing too many swaps. + */ + // #define TEST_GC #ifdef TEST_GC diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index a547335081..adfde15530 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -92,15 +92,15 @@ My_lily_lexer::lookup_keyword (String s) return keytable_p_->lookup (s.ch_C ()); } -Identifier* +SCM My_lily_lexer::lookup_identifier (String s) { SCM sym = ly_symbol2scm (s.ch_C()); for (int i = scope_l_arr_.size (); i--; ) if (scope_l_arr_[i]->elem_b (sym)) - return scope_l_arr_[i]->elem(sym); - return 0; + return scope_l_arr_[i]->scm_elem(sym); + return SCM_UNDEFINED; } void @@ -111,23 +111,14 @@ My_lily_lexer::start_main_input () } void -My_lily_lexer::set_identifier (String name_str, Identifier* i, bool ) +My_lily_lexer::set_identifier (String name_str, SCM s) { - Identifier *old =0; - if (scope_l_arr_.top ()->elem_b (name_str)) - old = scope_l_arr_.top ()->elem(name_str); - - - if (old) - { - delete old; - } if (lookup_keyword (name_str) >= 0) { warning ( _f ("Identifier name is a keyword: `%s'", name_str)); } - scope_l_arr_.top ()->elem (name_str) = i; + scope_l_arr_.top ()->set (name_str, s); } My_lily_lexer::~My_lily_lexer()