Page 1 of 1

Code folding for the Winbatch (WIL) Language

Posted: Wed Apr 05, 2006 1:53 pm
by kevin.bell62
Hello!

Hopefully I am posting this in the right place. I am requesting code folding for the Winbatch (Windows Interface Language). The info is as below:

Extensions: .wbt, .web, .wil, .wdl
Line Comment: ;
Block Comment: none
Begin: if
End: endif
Begin: switch
End: endswitch
Begin: gosub
End: return
Begin: for
End: next
Begin: while
End: endwhile
Begin: #definefunction
End: #endfunction
Begin: #definesubroutine
End: #endsubroutine
Begin: foreach
End: next
Sample Code:

if x==y then
_do_true_stuff
else
_do_false_stuff
endif

;--------------------------------------------------

; "select" may be used interchangably with "switch"

switch (integer_value)
case 1
case 2
_do_for_one ; will process both 1 and 2 condition
break
case 3
_do_for_two ; will process if integer_value = 3
break
case (integer_value)
_fall_through_processing
break
endswitch

;--------------------------------------------------

gosub _a_subroutine

:_a_subroutine ; subroutines start with the ':' character

_sub_routine_code

return ; returns processing back to line after gosub call

;--------------------------------------------------

for x = 0 to 100

_do_something_here

break ;; this would exit the loop early
continue ;; this causes the loop to start over at next iteration

next

;--------------------------------------------------

while (@true)

_do_something_here

break ;; this would exit the loop early
continue ;; this causes the loop to start over with condition re-test

endwhile

;--------------------------------------------------

result = _test_function(3)

#definefunction _test_function(_an_integer)

_a_value_defined = 1 ;; this is local to function

_an_integer = _an_integer + 1

return _an_integer

#endfunction

;--------------------------------------------------

result = _test_sub(3)

#definesubroutine _test_sub(_an_integer)

_a_value_defined = 1 ;; this is global to entire program

_an_integer = _an_integer + 1

return _an_integer

#endsubroutine

;--------------------------------------------------

foreach objPrinter in colInstalledPrinters

sPrinterInfo = strcat(sPrinterInfo, "Name: ", objPrinterName, @crlf)

next


Thanks a lot! KDB

Posted: Thu Apr 06, 2006 8:18 am
by jussij
This is definitely the correct place to post this code folding request ;)

The WinBatch code folding changes have been made and the new xFolder.dll can be found here:

http://www.zeusedit.com/z300/xFolder.zip

To install this new dll backup the current dll and replace it with the one contained in the zip file.

To complete the install you will need to create a WinBatch document type and enable the code folding option.

If you find any problems with the folding, just post a bug report to the end of this thread.

Cheers Jussi

Posted: Thu Apr 06, 2006 5:44 pm
by kevin.bell62
Thank you Jussi!

Seems to be working great. The only problem I can see is that I forgot to mention that "if" statements can be 1 liners:

if x == y then goto spork

with no "endif". I don't know how you would trap that one anyway, so my thanks yet again!

I have been using Zeus for my Ruby scripts and will now use it for my winbatch scripting as well.

Thanks for a fine product! KDB

Posted: Thu Apr 06, 2006 9:42 pm
by jussij
A new xFolder.zip file has just been uploaded and it should fix the problem with these one line if statements.

Cheers Jussi