[TxMt] Help with indentation rules for IDL

David Gell gellda at umich.edu
Fri May 26 13:02:14 UTC 2006


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 at 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





More information about the textmate mailing list