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

Issue 5295054: parser.yy: make Scheme and music expressions equivalent as function arguments. (Closed)

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

Description

parser.yy: make Scheme and music expressions equivalent as function arguments. This is on top of the work committed to dev/staging. It makes music and Scheme expressions equivalent as function arguments. That means you can write something like \void \displayLilyMusic <c' d'>4 and have the music displayed, but not interpreted. Or you do something like music = #(define-music-function (parser location m) (ly:music?) m) And then use \music #(make-music 'EventChord ...) to integrate Scheme-written music into a music expression (this is not yet the default: Scheme expressions get ignored outside of constructs asking for them). There is one snag in \lyricsmode: strings are indistinguishable from music consisting of lyric events. So a string is first interpreted as music. If a music argument is rejected by a function predicate, Lilypond looks whether it is a lyric-event, and in case that it is, extracts the text and tries passing it off to the predicate again. Since there is no reliable way to distinguish a lyric-event with default duration and one with explicit duration, this means that a duration might silently disappear when a function expecting a string is called in lyrics mode and gets a string followed by a duration. Ugly. But apart from that, this was quite smooth to do. Error reporting for bad arguments has been improved somewhat. Bad arguments without specified defaults keep the function from being called at all. Instead a defining-function specific default (like a void music function or a #f Scheme expression, or a (begin) void expression) is substituted. The only argument predicates special in music now are durations and pitches. All the rest is interchangeable at will.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+98 lines, -85 lines) Patch
M lily/lexer.ll View 1 chunk +1 line, -3 lines 0 comments Download
M lily/parser.yy View 15 chunks +75 lines, -63 lines 0 comments Download
M scm/lily.scm View 1 chunk +0 lines, -12 lines 0 comments Download
M scm/ly-syntax-constructors.scm View 1 chunk +21 lines, -6 lines 0 comments Download
M scm/music-functions.scm View 1 chunk +1 line, -1 line 0 comments Download

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