Re: conditional highlight (without losing other definitions)

Federico Bruni <[email protected]> Sun, 26 Feb 2012 10:30:35 +0100
Newsgroups gmane.comp.gnu.source-highlight.general
Message-ID <[email protected]>
Il 23/02/2012 00:05, Federico Bruni ha scritto:
> I was interested in variables because I wanted to type less.
> The variable above is useless for me.
>
> And I've just realized that I can't use variables for environment
> definitions, which is what I would really need to "shorten".
> For example:
>
> environment scheme delim '#\'?\(' ")" multiline nested begin
>    environment scheme delim "(" ")" multiline nested begin
>      include "url.lang"
>    end
>    environment string delim "\"" "\"" multiline begin
>      include "url.lang"
>    end
> end
>
> I think I'll go back and use the list.

I changed my mind again: I prefer the environment, even if it gets huge 
(see below).
The only problem is: the delimiters "\markup {" and "}" are not 
highlighted: "}" should be highlighted as cbracket and "\markup" same 
colour as markup_command.

There's a workaround?

# Markup commands (any \command inside \markup{})
environment markup delim '\\markup\s*\{' "}" multiline nested begin
   # definitions I want to preserve in this environment
   cbracket = $CBRACKET
   string delim "\"" "\"" multiline
   comment delim "%{" "%}" multiline nested
   comment start "%"
   scheme_value = $SCHEME_VALUE
   environment scheme delim '#\'?\(' ")" multiline nested begin
     environment scheme delim "(" ")" multiline nested begin
       include "url.lang"
     end
     environment string delim "\"" "\"" multiline begin
       include "url.lang"
     end
   end
   # actual definition
   markup_command = '\\[[:alpha:]-]+'

   # needed for nested blocks inside \markup{}
   environment markup delim "{" "}" multiline nested begin
     cbracket = $CBRACKET
     string delim "\"" "\"" multiline
     comment delim "%{" "%}" multiline nested
     comment start "%"
     scheme_value = $SCHEME_VALUE
     environment scheme delim '#\'?\(' ")" multiline nested begin
       environment scheme delim "(" ")" multiline nested begin
         include "url.lang"
       end
       environment string delim "\"" "\"" multiline begin
         include "url.lang"
       end
     end
     markup_command = '\\[[:alpha:]-]+'
   end
end