Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2035)

Issue 4815052: parser.yy: rearrange to allow more lenient use of music arguments for music functions. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 9 months ago by dak
Modified:
12 years, 8 months ago
Reviewers:
MikeSol, Reinhold, reinhold
CC:
lilypond-devel_gnu.org
Visibility:
Public.

Description

parser.yy: rearrange to allow more lenient use of music arguments for music functions. This change may be somewhat contentious: it removes a lot of opportunities for syntax errors by allowing a lot of music functions to work that did not do so previously. For one thing, you can use a ly:music? style signature as often as you want to in all music functions. There are some cases where it will only be accepted in "closed form", namely as a music identifier or a music expression enclosed in { ... } or << ... >>. Those cases are before a post-event not belonging to the music argument, or a duration argument. Music functions can be used in a number of places with different semantics, not necessarily the cleanest thing. When they are used as post-events and have a music argument last, they will actually try getting a post-event as that music argument. What is new (and probably less than fabulous) that they will instead accept a closed form music expression. However, when such a function is used as a primary music event, its last argument will be a regular music expression anyway. So it is not like this argument dichotomy was really all that novel. In a similar vein, as a chord constituent, a music function will accept a chord constituent in the place of a prospective last music argument. It does not seem overly satisfactory that only the last such component will be syntactically warped according to the surrounding. Perhaps one should use different signatures in the first place. Suggestions welcome.

Patch Set 1 #

Patch Set 2 : This makes for a more consistent syntax. Docs now included. #

Total comments: 6

Patch Set 3 : Format the docs more nicely. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+119 lines, -70 lines) Patch
M Documentation/extending/programming-interface.itely View 1 2 5 chunks +61 lines, -18 lines 0 comments Download
M lily/parser.yy View 1 10 chunks +58 lines, -52 lines 0 comments Download

Messages

Total messages: 9
dak
I should point out that I consider this a merge candidate. AFAICT, it passes the ...
12 years, 9 months ago (2011-07-29 05:51:35 UTC) #1
MikeSol
http://codereview.appspot.com/4815052/diff/2001/Documentation/extending/programming-interface.itely File Documentation/extending/programming-interface.itely (right): http://codereview.appspot.com/4815052/diff/2001/Documentation/extending/programming-interface.itely#newcode146 Documentation/extending/programming-interface.itely:146: Can you give a more lilypond examples as you ...
12 years, 9 months ago (2011-07-29 07:17:19 UTC) #2
dak
http://codereview.appspot.com/4815052/diff/2001/Documentation/extending/programming-interface.itely File Documentation/extending/programming-interface.itely (right): http://codereview.appspot.com/4815052/diff/2001/Documentation/extending/programming-interface.itely#newcode146 Documentation/extending/programming-interface.itely:146: On 2011/07/29 07:17:19, MikeSol wrote: > Can you give ...
12 years, 9 months ago (2011-07-29 07:51:08 UTC) #3
Reinhold
First, I have to say that I don't really understand the fine details of the ...
12 years, 9 months ago (2011-07-29 08:55:24 UTC) #4
dak
On 2011/07/29 08:55:24, Reinhold wrote: > First, I have to say that I don't really ...
12 years, 9 months ago (2011-07-29 10:24:42 UTC) #5
dak
http://codereview.appspot.com/4815052/diff/2001/Documentation/extending/programming-interface.itely File Documentation/extending/programming-interface.itely (right): http://codereview.appspot.com/4815052/diff/2001/Documentation/extending/programming-interface.itely#newcode122 Documentation/extending/programming-interface.itely:122: @item On 2011/07/29 08:55:26, Reinhold wrote: > Please leave ...
12 years, 9 months ago (2011-07-29 10:25:17 UTC) #6
dak
I decided to push this since it forms a reasonably capsulated piece of work. I ...
12 years, 9 months ago (2011-07-29 14:42:08 UTC) #7
reinhold_kainhofer.com
Am Freitag, 29. Juli 2011, 12:24:43 schrieb dak@gnu.org: > On 2011/07/29 08:55:24, Reinhold wrote: > ...
12 years, 9 months ago (2011-07-29 16:40:50 UTC) #8
dak
12 years, 9 months ago (2011-07-29 17:24:29 UTC) #9
Reinhold Kainhofer <reinhold@kainhofer.com> writes:

> Am Freitag, 29. Juli 2011, 12:24:43 schrieb dak@gnu.org:
>> On 2011/07/29 08:55:24, Reinhold wrote:
>> > Can you give some explicit examples that your patch now allows that
>> > didn't work before (preferrably as a regtest, so we notice when a future
>> > parser change breaks it)?
>> 
>> Well, one could now move a few things like \relative and \transpose into
>> music functions (and Scheme-callable functions for the hard work, for
>> efficiency's sake).
>> 
>> That would be a quite reliable regtest...
>
> Actually, I think we should add a really simple test case to the regtests, 
> like your example of \staffposition-at d' below.
>
>> \tweak still works just the same.  But you could, for example, write
>> something like
>> \staffposition-at d'
>> that resulted in a tweak of the next element to have it land in the
>> position of a d'.
>
> Can you turn that "could" into real lilypond code in a regtest, so
> that (1) we have a simple test case to check whether future parser
> changes affect this and (2) people like me, who easier understand
> things by examples, see what this patch achieves?
>
> Quite often, I have found that trying to create a very simple regtest,
> I found several problems in my patches, because when thinking
> theoretically I might have missed how people would actually use the
> features.

Straightforward to do (I did it but did not keep the code): take the
code for \tweak in music-functions.ly and tweak it in the
straightforward way.  Works.

But that is not a readable example.  So I want to modify #{...#} first
so that I can use it for wrapping \tweak insteak of copying its code.

-- 
David Kastrup
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b