lilypond-devel
[Top][All Lists]
Advanced

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

Re: LilyPond strings and \markup


From: Patrick McCarty
Subject: Re: LilyPond strings and \markup
Date: Sun, 16 Aug 2009 14:53:36 -0700
User-agent: Mutt/1.5.20 (2009-06-14)

Hi Mark,

I'm not very familiar with LilyPond's parser/lexer, so I can't provide
any specifics.  But here are some guesses.

On 2009-08-16, Mark Polesky wrote:
> \version "2.13.4"
> 
> %%%%%%%%%%%%
> % QUESTION 1
> 
> % "quoted string" is STRING
> strA = "quoted string"
> 
> % #"hash-quoted string" is SCM_TOKEN
> strB = #"hash-quoted string"
> 
> % these are both 'unexpected STRING_IDENTIFIER's:
> % \strA \strB
> 
> % Why isn't \strB an 'unexpected SCM_IDENTIFIER'?

I suspect this is because LilyPond treats "foo" and #"foo" the same in
this isolated context.

Lily_lexer::try_special_identifiers() might be where the "exceptions"
to the rule are handled.

> %%%%%%%%%%%%
> % QUESTION 2
> 
> % A valid LilyPond unquoted 'STRING':
> % 1) must be entirely alphabetic, and
> % 2) cannot be interpreted as a number, pitch, rest, or operator.
> 
> % So, without quotes, these are all invalid LilyPond 'STRING's:
> % 3 f r + big-pr0bl3m!
> 
> % but \markup accepts all of these seamlessly:
> \markup { 3 f r + n0-pr0bl3m! }
> 
> % It's as if, behind the scenes, the parser silently adds quotes.
> % So how exactly does that happen? And does the parser read
> % them as LilyPond 'STRING's or as a Scheme strings?

My guess is that they are interpreted as Scheme strings.  You can try
following the nonterminals in parser.yy (starting at line 2309) if you
want the full story.  :-)


-Patrick




reply via email to

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