I do a lot of programming in the IDL (Interactive Data Language). It is an interpreted language that is very good for scientific programming and data visualization. I've been using Emacs and the idlwave mode for editing. I'm trying TextMate to avoid the overhead that comes with emacs.
At this point I've developed a language grammar that works for styling the text. I'm having trouble, however, with indentation rules. A typical IDL construct looks like
if a gt b then begin y = sin(z) endif else begin y = sin(x) endelse
or, alternatively, if a gt b then y = sin(z) else y = sin(x)
The keyword begin starts an indented block, the keyword end... ends a block.
I've tried /* preferences */ { decreaseIndentPattern = '\bend(if|else|for|while|case|repeat)?/b'; increaseIndentPattern = '\b(begin|case|function|pro)\b'; }
Which results in indenting: if a gt b then begin y = sin(z) endif else begin y = sin(x) endelse
You can probably tell I'm a regular expression neophyte, so any help would be greatly appreciated.
Thanks
----------------------------------------------------------- David A. Gell, Ph.D. David.A.Gell@umich.edu
University of Michigan Space Physics Research Lab 2129B Space Research Building phone: 734.763.6221 2455 Hayward Street fax: 734.615.9723 Ann Arbor, MI 48109-2143 mobile: 734.657.6824
On 26/5/2006, at 15:02, David Gell wrote:
[...] At this point I've developed a language grammar that works for styling the text. I'm having trouble, however, with indentation rules [...]
Currently TextMate use only the first pattern which match. I.e. your “end … begin” line is matched by the increaseIndentPattern and TM will treat it as such, even though it also matches the decreaseIndentPattern.
There is no workaround for this -- but I do plan to change it so that lines matched by both the increase and decrease indent pattern will work as having the actual line matched be decreased relative to the line above, but increase the indent for lines below.
Then your rule should work.