Help with code folding in custom syntax?
Posted: 08 May 2010 16:35
Can't quite get this to work, so I was wondering if anybody here had any suggestions 
I'm trying to create a custom syntax file for a language called Envision Basic - I work for a University that uses a system called Datatel Colleague for all of their record-keeping purposes, and this is the language used to make any customizations we want to the basic system that Datatel sells. If anyone here is familiar with IBM's Unidata database and it's UniBasic language, EB is very similar.
I think part of my problem is that EB doesn't use braces to define blocks; it only uses the keywords themselves. So, for an 'IF' statement, you could have:
OR
OR
The 1st example doesn't need to be folded; it's all on one line. The 2nd should fold between 'IF' and 'END', and the 3rd should fold (A) between 'IF' and 'END ELSE' and (B) between 'END ELSE' and 'END'.
On a single level these all work, and even 'nesting' works as long as you stick with IF/END or IF/END ELSE/END blocks. But a nested, single-line 'IF' statement like this:
will throw everything beneath it off, as far as folding is concerned - in that example, the fold starts at the 2nd 'IF', and ends at 'END', when it *should* start at the 1st 'IF'. Any suggestions?
I have a similar problem trying to fold CASE statements:
I can collapse the entire CASE structure between 'BEGIN CASE' and 'END CASE', but not the individual 'CASE' statements themselves.
Any suggestions on either of these would be greatly appreciated
Thanks!
Nathan

I'm trying to create a custom syntax file for a language called Envision Basic - I work for a University that uses a system called Datatel Colleague for all of their record-keeping purposes, and this is the language used to make any customizations we want to the basic system that Datatel sells. If anyone here is familiar with IBM's Unidata database and it's UniBasic language, EB is very similar.
I think part of my problem is that EB doesn't use braces to define blocks; it only uses the keywords themselves. So, for an 'IF' statement, you could have:
Code: Select all
IF X GT Y THEN Y = X
Code: Select all
IF X GT Y THEN
*
*Code to execute
*
END
Code: Select all
IF X GT Y THEN
*
*Do one thing
*
END ELSE
*
*Do something else
*
END
On a single level these all work, and even 'nesting' works as long as you stick with IF/END or IF/END ELSE/END blocks. But a nested, single-line 'IF' statement like this:
Code: Select all
IF X GT Y THEN
IF Y EQ 0 THEN
END
I have a similar problem trying to fold CASE statements:
Code: Select all
BEGIN CASE
CASE 1
*
*code
*
CASE 2
*
*code
*
CASE 3
*
*code
*
END CASE
Any suggestions on either of these would be greatly appreciated

Thanks!
Nathan