lilypond-devel
[Top][All Lists]
Advanced

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

Parser error with self-defined predicate symbol-or-markup? in markup fun


From: Reinhold Kainhofer
Subject: Parser error with self-defined predicate symbol-or-markup? in markup function
Date: Wed, 26 Jan 2011 19:40:11 +0100
User-agent: KMail/1.13.5 (Linux/2.6.35-24-generic; KDE/4.5.5; i686; ; )

I'm defining my own predicate symbol-or-markup? for the argument of a markup 
function. 

    #(define-public (symbol-or-markup? x)
      (or (symbol? x) (markup? x)))

    #(define-markup-command (mytest layout props label arg)
      (symbol-or-markup? markup?)
      (let* ((s (if (symbol? label) (symbol->string label) (label))))
        (interpret-markup layout props 
                          (markup #:concat ("Label: " s " arg: " arg)))))

If I pass a symbol, then everything works fine
    \markup \mytest #'test \bold "f"

but, as soon as I try to pass a markup, the parser complains that it expects 
an SCM_IDENTIFIER or SCM_TOKEN:

    \markup \mytest "test" \bold "f"
    \markup \mytest \bold "test" \bold "f"
    \markup \mytest \markup { "test" } \bold "f"

markup-or-symbol.ly:15:21: Fehler: syntax error, unexpected STRING, expecting 
SCM_IDENTIFIER or SCM_TOKEN
\markup \mytest "test
                     " \bold "f"
markup-or-symbol.ly:16:16: Fehler: syntax error, unexpected MARKUP_FUNCTION, 
expecting SCM_IDENTIFIER or SCM_TOKEN
\markup \mytest 
                \bold "test" \bold "f"
markup-or-symbol.ly:17:16: Fehler: syntax error, unexpected \markup, expecting 
SCM_IDENTIFIER or SCM_TOKEN
\markup \mytest 
                \markup { "test" } \bold "f"


Simple test case attached. Any idea what might be wrong?

Thanks,
Reinhold
-- 
------------------------------------------------------------------
Reinhold Kainhofer, address@hidden, http://reinhold.kainhofer.com/
 * Financial & Actuarial Math., Vienna Univ. of Technology, Austria
 * http://www.fam.tuwien.ac.at/, DVR: 0005886
 * LilyPond, Music typesetting, http://www.lilypond.org

Attachment: markup-or-symbol.ly
Description: Text Data


reply via email to

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