Batch syntax colorizer for the jEdit editor

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
jfl
Posts: 226
Joined: 26 Oct 2012 06:40
Location: Saint Hilaire du Touvet, France
Contact:

Batch syntax colorizer for the jEdit editor

#1 Post by jfl » 04 Dec 2016 12:24

Hi,

for those of you that use the jEdit editor, I've just made big improvements to the batch.xml edit mode definition file.
Basically this includes everything added in cmd.exe, that was not in command.com!
I've also included support for many of the tricky - I meant advanced - things done on this forum. (Ex :: or :# comments, echo(messages, etc.)

This batch.xml file goes into "C:\Program Files\jEdit\modes\". (Save the initial one there first just in case :wink: )
Then on the main jEdit menu, click 'Utilities' -> 'Troubleshooting' -> 'Reload Edit Modes'.
I intend to submit it to the jEdit team for inclusion in the next version of the editor.
But before that, I'd appreciate if other people could give it a try, and tell me how it works on their favorite scripts.
Thanks,

Jean-François
Attachments
batch.zip
jEdit batch language edit mode definition file
(5.6 KiB) Downloaded 349 times

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Batch syntax colorizer for the jEdit editor

#2 Post by penpen » 05 Dec 2016 04:26

Well colorization is a matter of taste, i think.
You should list all implemented features ("I've also included support for many of the tricky ") instead of giving only 3 examples.

Although i've new to jEdit (if i remember right this is the first time i heard of it), i think the actual implementation is better, because for example text behind ":labels" are not always comments, and easily could be executed:

Code: Select all

@echo off
:bye  ^

echo Bye. & goto :eof
call ^
:#fun & call ^
::bye & goto :eof
echo Fun with batch.
goto :eof
:bye
"%~f0"
echo off never reached
call :test param1 param2
call "%~f0" param1 param2
:: or
:# comments
echo(messages, etc
The actual colorization reflects this possibility while yours gives no hint of such a possibility.

You may change the colorization behaviour depending of "^" min the line before (and use both: old and new colorization).
You may also display red color for calls like this (crashes the CLI under Windows 10):

Code: Select all

call ^

something
(But i'm not rembering all possible "crash commands".)

In addition your colorization of "off" in "echo off never reached" is wrong.


penpen

Post Reply