]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3237: Harmonize point-and-click information for #xxx and $xxx
authorDavid Kastrup <dak@gnu.org>
Tue, 12 Mar 2013 11:24:34 +0000 (12:24 +0100)
committerDavid Kastrup <dak@gnu.org>
Sun, 17 Mar 2013 13:09:22 +0000 (14:09 +0100)
Both #xxx and $xxx now retain any preexisting origin information when
producing a music expression.  In contrast, \xxx continues receiving
the origin information pertaining to the current location even if
previous point-and-click information exists.  This is consistent with
the point-and-click information for music functions as a whole
corresponding to the point of call, while the individual arguments, if
separate music expressions, retain any preexisting origin.

lily/lexer.ll
lily/parser.yy

index c1d3dd86a5a613ae8f78babdcc70152fb71b4ddb..0df70e20082f50bb4a6f131b00d6f55382f9b6af 100644 (file)
@@ -925,6 +925,11 @@ Lily_lexer::scan_escaped_word (string str)
                return i;
 
        SCM sid = lookup_identifier (str);
+       if (Music *m = unsmob_music (sid))
+       {
+               m->set_spot (override_input (last_input_));
+       }
+
        if (sid != SCM_UNDEFINED)
                return scan_scm_id (sid);
 
@@ -1084,19 +1089,26 @@ Lily_lexer::eval_scm (SCM readerdata, char extra_token)
                sval = scm_struct_ref (sval, SCM_INUM0);
 
                if (scm_is_pair (sval)) {
-                       for (SCM v = scm_reverse (scm_cdr (sval));
-                            scm_is_pair (v);
-                            v = scm_cdr (v))
+                       for (SCM p = scm_reverse (scm_cdr (sval));
+                            scm_is_pair (p);
+                            p = scm_cdr (p))
                        {
+                               SCM v = scm_car (p);
+                               if (Music *m = unsmob_music (v))
+                               {
+                                       if (!unsmob_input (m->get_property ("origin")))
+                                               m->set_spot (override_input (last_input_));
+                               }
+                                       
                                int token;
                                switch (extra_token) {
                                case '$':
-                                       token = scan_scm_id (scm_car (v));
+                                       token = scan_scm_id (v);
                                        if (!scm_is_eq (yylval, SCM_UNSPECIFIED))
                                                push_extra_token (token, yylval);
                                        break;
                                case '#':
-                                       push_extra_token (SCM_IDENTIFIER, scm_car (v));
+                                       push_extra_token (SCM_IDENTIFIER, v);
                                        break;
                                }
                        }
@@ -1105,6 +1117,12 @@ Lily_lexer::eval_scm (SCM readerdata, char extra_token)
                        sval = SCM_UNSPECIFIED;
        }
 
+       if (Music *m = unsmob_music (sval))
+       {
+               if (!unsmob_input (m->get_property ("origin")))
+                       m->set_spot (override_input (last_input_));
+       }
+
        return sval;
 }
 
index 478d05377540e10033d55fb569792645d35e3612..0197fe9d93e156a0a6a95feb163012f4bea7a0ad 100644 (file)
@@ -3438,10 +3438,6 @@ Lily_lexer::try_special_identifiers (SCM *destination, SCM sid)
        } else if (Music *mus = unsmob_music (sid)) {
                mus = mus->clone ();
                *destination = mus->self_scm ();
-               unsmob_music (*destination)->
-                       set_property ("origin",
-                                     make_input (override_input (last_input_)));
-
                bool is_event = mus->is_mus_type ("post-event");
                mus->unprotect ();
                return is_event ? EVENT_IDENTIFIER : MUSIC_IDENTIFIER;