lilypond-devel
[Top][All Lists]
Advanced

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

Re: Markup parsing question


From: Bertalan Fodor (LilyPondTool)
Subject: Re: Markup parsing question
Date: Wed, 26 Oct 2011 08:28:49 +0200

Thank you David, this explains me what I didn't understand.
It turned out that somehow I was looking at a bad parser.yy.

Actually I'm not running/debugging the C code, but instead only reading it (and porting some of the parsing code to Java).

Bertalan

On Wed, Oct 26, 2011 at 7:26 AM, David Kastrup <address@hidden> wrote:
"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


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


reply via email to

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