[SVN] Problem with negative look-behind in syntax pattern

Allan Odgaard allan at macromates.com
Fri Jun 3 05:53:32 UTC 2005


On Jun 3, 2005, at 2:21, Paulo Moura wrote:

> The negative look-behind is needed because Prolog/Logtalk defines  
> the syntax 0'Character to get the numeric code of a (single)  
> character. This syntax is covered by the pattern (which appears  
> after the above ones):
>         {
>             match = "\\b(0'.|0b[0-1]+|0o[0-7]+|0x\\h+)\\b";
>             name = "constant.numeric";
>         },
> Am I doing something wrong here?

Yes, since you put \\b last for the above rule, it won't match e.g.  
0'', since there's no word-boundary after those 3 characters.

Probably you want this instead:
    match = "\\b(0'.|0b[0-1]+|0o[0-7]+|0x\\h+)(?=\\s|$)";

And you don't need the look-behind for the first two rules.




More information about the textmate-dev mailing list