lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Markup parsing question


From: David Kastrup
Subject: Re: Markup parsing question
Date: Wed, 26 Oct 2011 07:26:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux)

"Bertalan Fodor (LilyPondTool)" <address@hidden> writes:

> Dear LilyPond devs,
>
> I have a problem with the LilyPond markup parsing, which prevents me
> to finish my new release of LilyPondTool.
> Could you help me a bit on that?
>
> I have this ly file
> ------------------
> dot = \markup {
>   "q" \musicglyph #"accordion.dot"
> }
>
> { c^\dot }
> ------------------
>
> When the markup is parsed, it will become:
> ( "q" (musicglyph "accordion.dot"))
> through the rules: markup_braced_list -> markup_list -> markup_top ->
> full_markup -> identifier_init
>
> This really makes sense, but please correct me if I'm wrong.

You are wrong.  \markuplines (soon to become \markuplist) takes this
markup list verbatim.  \markup, however, wraps it in a line-markup.  Put
the following after your assignment:

#(begin)
#(display dot)

This produces:

(#<procedure line-markup (layout props args)> (  q (#<procedure
      musicglyph-markup (layout props glyph-name)> accordion.dot)))

> Now when I'm referring to it in c^\dot, the following code is run:
>
> if (Text_interface::is_markup (sid)) {
> ....
>         return MARKUP_IDENTIFIER;
>     } else if (Text_interface::is_markup_list (sid)) {
> ....
>         return MARKUPLINES_IDENTIFIER;
> } 
>
> The result of this must be MARKUP_IDENTIFIER (as only those can be
> used as direction_reqd_event -> gen_text_def -> full_markup
>
> But if I look in Text_interface.isMarkup, it will just do the
> following:
>
> return (scm_is_string (x)
>       || (scm_is_pair (x)
>           && SCM_BOOL_F
>           != scm_object_property (scm_car (x),
>                       ly_symbol2scm ("markup-signature"))));
> } 
> So my value, ( "q" (musicglyph "accordion.dot")) will not be
> considered as a markup, but instead a markup list, so I'm getting a
> parse error.
>
> Can you help me where I misunderstand the code?

Have you actually tried your code?  Works fine here.

-- 
David Kastrup




reply via email to

[Prev in Thread] Current Thread [Next in Thread]