[TextMate] OCaml bundle + observations

Allan Odgaard allan at macromates.com
Sat Oct 9 06:29:20 UTC 2004


On 7. Oct 2004, at 23:31, William Douglas Neumann wrote:

> 4: Does anyone know how to handle nested comments?  In OCaml, the 
> following is a valid comment Note: the (* and *) are comment 
> delimiters:

Currently we do not support recursive definitions in the syntax files 
(i.e. arbitrary nesting), though it _will_ be added in the future!

> [...] If I try to swallow the internal comment with this pattern:
> 	"\\(\\*.*\\*\\)"; <snip> }, then the comment coloring does not end 
> with the comment.  I'm a bit of a regex schnook, so any help here 
> would be appreciated...

The problem is that .* is a greedy match, so it'll match from the start 
of the nested comment till the end of the entire comment (skipping over 
the nested '*)').

You can add ? to the repeat to make it non-greedy, and then it'll work. 
I.e. the pattern becomes (with escapes):
    "\\(\\*.*?\\*\\)"

> 5: Not sure if this was mentioned yet, but code inserted via Snippets 
> is not indented according to the syntax rules.

Can you give an example? I don't think there should be any syntax aware 
indenting when inserting snippets, but maybe I've overlooked something.


Kind regards Allan




More information about the textmate mailing list