conditional highlight (without losing other definitions)

Federico Bruni <[email protected]> Thu, 02 Feb 2012 18:09:15 +0100
Newsgroups gmane.comp.gnu.source-highlight.general
Message-ID <[email protected]>
Hi,

I'm trying to find a smarter way to highlight some strings:

All the "\strings" inside \markup{ ... } should have a different colour 
of \strings occurences in other parts of the input.
How can I achieve that in a smart way (i.e. without using a list of all 
the \strings which can occur inside a \markup{} block)?

I want to preserve all the other highlighting definitions. Maybe 
state|environment is not the right tool? Because in Doc 7.9 it says:

"When entering a state/environment, however, the definitions given 
outside the state/environment are not matched. "

Let's do an example:

\markup {
   \override #'(box-padding . 1.0) \override #'(baseline-skip . 2.7) \box
     \center-column {
       \small \line { Sheet music from \with-url 
#"http://www.MutopiaProject.org"
       \line { \teeny www. \hspace #-0.5 MutopiaProject \hspace #-0.5 
\teeny .org \hspace #0.5 }
       }
     }
}

I want to match only: \override \box \center-column \small \line 
\with-url \teeny \hspace

The following environment:

environment markup delim '\\markup\s*\{' "}" multiline nested begin
   environment markup delim "{" "}" multiline nested begin
     markup_command = '\\[[:alpha:]-]+'
   end
end

can see the relevant block and highlight the \strings correctly, but at 
the same time it breaks something, in particular some elements lose 
their highlighting (as documentations says):

1) \markup
2) {}
3) #......

So I guess that state|environment is not the solution here. Or I'm 
missing something?
Can you give me a hint?

Thanks,
Federico (really close to the final draft of lilypond.lang)