I'm trying to create a syntax file for a config file format used internally
by our code - we use the files as GUI templates, so I spend a lot of time
editing the metadata.  I've hacked existing syntax definitions before, but
I'm missing some of the subtleties of region matching.  The syntax itself is
relatively simple, e.g.:

runtime_options
  # this is a comment
  .short_caption = Program runtime behavior
{
  verbose = False
    .type = bool
    .short_caption = Verbose output
    .expert_level = 0
}

Basically, it functions like XML but it's much easier to edit.

The metadata only has a few keywords (e.g. ".type", ".short_caption"), and
each attribute must be at the beginning of the line (ignoring spaces).  So,
I can do this:

  syn keyword confAttribute type short_caption expert_level

which works, or:

  syn match confAttribute "^[\ *]\.[a-z][a-z0-9_]*[\ ]*="

which also works.  But what I eventually want is to highlight the attribute,
and then have everything on the other side of the '=' be treated as a
string, whether or not it is enclosed in quotes.  Nothing I've tried has
worked; if I try to define a string as a region starting with the pattern
above, the attribute loses its highlighting.  The catch is that these
attribute names and '=' are not reserved, and can be used anywhere in a
string - it's the ordering of these elements that is important.
 ('contained' helped with some problems, but didn't entirely do what I
needed.)

Any suggestions?  I'm sure Vim can deal with this, but I'm stumped, even
after looking at other syntax files for clues.

thanks,
Nat

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to