Am 24.04.2018 um 21:16 schrieb David Kastrup:


\version "2.21.0"

\score{ { c'2     } \addlyrics                      { Hi there }   \layout {}}
\score{ { c'2     } \addlyrics   \displayLilyMusic  { Hi there }   \layout {}}
\score{ { c'2     } \addlyrics { \displayLilyMusic  { Hi there } } \layout {}}
\score{ { c'2 2   } \addlyrics                      { Hi there }   \layout {}}
\score{ { c'2 2   } \addlyrics   \displayLilyMusic  { Hi there }   \layout {}}
\score{ { c'2 2   } \addlyrics { \displayLilyMusic  { Hi there } } \layout {}}
\score{ { c'2 2 2 } \addlyrics                      { Hi there }   \layout {}}
\score{ { c'2 2 2 } \addlyrics   \displayLilyMusic  { Hi there }   \layout {}}
\score{ { c'2 2 2 } \addlyrics { \displayLilyMusic  { Hi there } } \layout {}}
Uh what?  How is the output correct?


One, two, or three notes, lyrics as expected. See attached pdfs.

To make things clear:

 * \displayLilyMusic is  a music function, it never is acceptable to \addlyrics 
in the current version of lilypond
 * { \displayLilyMusic ... }  is always acceptable because it is a 
grouped_music_list (but the current parser does not automatically force lyric 
state)

Some more examples:

Correct syntax for both original and patched versions:

   \score{ { c'2 2 2 } \addlyrics                                { Hi there }   
\layout {}}
   \score{ { c'2 2 2 } \addlyrics {                   \lyricmode { Hi there } } 
\layout {}}
   \score{ { c'2 2 2 } \addlyrics { \displayLilyMusic { Hi there } } \layout {}}
   \score{ { c'2 2 2 } \addlyrics { \displayLilyMusic \lyricmode { Hi there } } 
\layout {}}

Bad syntax for old version (bad output), correct syntax for patched version:

   \score{ { c'2 2 2 } \addlyrics   \displayLilyMusic \lyricmode { Hi there }   
\layout {}}

Bad syntax for both versions (bad output for the original version, good output 
for the patched version):

   \score{ { c'2 2 2 } \addlyrics \displayLilyMusic            { Hi there }   
\layout {}}

Attached is a 2nd version of the patch. With that extended version _all_ 
examples above
 compile without warnings/errors and give the desired result.

Knut

Attachment: ptest.patched.pdf
Description: Adobe PDF document

Attachment: ptest.orig.pdf
Description: Adobe PDF document

>From 7d6fc17cdfd765bea8491d9df12d09f472c8215d Mon Sep 17 00:00:00 2001
From: Knut Petersen <knut_peter...@t-online.de>
Date: Tue, 24 Apr 2018 12:14:03 +0200
Subject: [PATCH] lyric_mode_music: allow music_function_call

Version 2: also push/pop lyric state to allow easier
handling of \displayLilyMusic

Signed-off-by: Knut Petersen <knut_peter...@t-online.de>
---
 lily/parser.yy | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lily/parser.yy b/lily/parser.yy
index 6422f5586b..b127641c41 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -2624,6 +2624,13 @@ lyric_mode_music:
 		parser->lexer_->pop_state ();
 		$$ = $2;
 	}
+	| {
+		parser->lexer_->push_lyric_state ();
+	} music_function_call
+	{
+		parser->lexer_->pop_state ();
+		$$ = $2;
+	}
 	| MUSIC_IDENTIFIER
 	;
 
-- 
2.16.3

_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to