understanding elements

Federico Bruni <[email protected]> Sun, 18 Dec 2011 16:55:49 +0100
Newsgroups gmane.comp.gnu.source-highlight.general
Message-ID <[email protected]>
Hi,

I've finished the draft of the lilypond.lang file and I have some 
questions before asking for comments on my file in the lilypond-devel 
mailing list.

1) ELEMENTS
First of all, there's any place in the doc where each element is 
explained? I mean: some elements are straightforward (comment, string, 
function), while others (preproc, cbracket) are a bit obscure...at least 
for a non-developer.
Also, I guess that names of these elements generally work fine with all 
the programming languages. But other kind of languages may have 
different peculiarities.

For examples, in the lilypond syntax - besides strings, comments, 
operators and numbers - I have basically:

- music functions
- contexts
- layout objects
- context properties
- layout properties

Which elements should I use for each of them?
Function for music functions, that's easy.
What about all the rest?

So far I used different elements, even if not related to the meaning of 
the group, just to see them styled differently.
But I guess that's not the right way.

Should I create new elements maybe?



2) SIMILAR ELEMENTS
Let's say I want to style differently two groups of numbers.
Which elements should I use?
For example, in the lilypond syntax numbers are used in two contexts:

# Fingering and string number
specialchar = '-[1-5]\b', '\\[0-9]\b'

# Note duration
number = '(1|2|4|8|16|32|64|128)(\.+|\b)'

specialchar is ok?



3) VARIABLES
In latex.lang I found:

vardef command = '\\[[:alpha:]]+'
keyword = $command

Why not writing just one line?
keyword = '\\[[:alpha:]]+'

What's the benefit of creating a variable?

Thanks,
Federico