[TxMt] Parameter-list RE in a grammar
Fritz Anderson
fritza at manoverboard.org
Fri Sep 5 21:10:03 UTC 2008
I'm building up a grammar for the Confluence wiki markup, and I'm
having trouble with tags that take a list of parameters.
Tags look like this (all strings are examples only):
{noparams}
{oneparam:key=10}
{twoparams:keyOne=value|keyTwo=2%}
{threeparams:keyA=a value|keyB=another value|keyC=a third value}
So the tag name can stand alone, or if it is followed by ':', it takes
a '|'-delimited list of key=value pairs.
When I use the grammar fragment at the end of this message, noparams,
oneparam, and twoparams are highlighted as I expect. When there are
three or more parameters, the first and last parameters are
highlighted as I expect, but the middle ones are highlighted as plain
entity.confluence.
I'm sure this is a defect in my match= regular expression, but I'm not
seeing it. Could someone enlighten me, please?
— F
{ name = 'entity.confluence';
match = '(?x:
\{
([-[:alnum:]]+)
(:(\w+)=([^|}]+)
(
\|(\w+)=([^|}]+)
)*
)?
\}
)';
captures = {
1 = { name = 'keyword.confluence'; };
3 = { name = 'support.confluence'; };
4 = { name = 'string.confluence'; };
6 = { name = 'support.confluence'; };
7 = { name = 'string.confluence'; };
};
},
More information about the textmate
mailing list