User to user discussion and support for UltraEdit, UEStudio, UltraCompare, and other IDM applications.

Syntax highlighting, code folding, brace matching, code indenting, and function list
3 posts Page 1 of 1
Hello to all UltraEdit for Windows v24.00 and UEStudio v17.00 users!

I want to inform you about updates made on the standard wordfiles installed with UltraEdit for Windows v24.00 and UEStudio v17.00 and which need a manual copying by the user for being really used after an upgrade from a previous version.

There is in program files directory of UltraEdit/UEStudio installed and also updated on installing/updating UltraEdit or UEStudio on Windows the subdirectory wordfiles with 18 *.uew files and in this directory the subdirectory legacy with 14 *.uew files. This directory is write-protected for the current by default with using default installation paths and default permission settings user according to Windows standards. Therefore write access to this directory is by default only possible during an installation with a temporary elevation to administrator level respectively using the special trusted installer account.


What is the program files directory of UltraEdit/UEStudio?

Well, this is the directory specified on installing UltraEdit/UEStudio after clicking on check mark item Advanced install. The default installation locations are:

For 32-bit UltraEdit on 32-bit Windows: "%ProgramFiles%\IDM Computer Solutions\UltraEdit"
For 32-bit UEStudio on 32-bit Windows: "%ProgramFiles%\IDM Computer Solutions\UEStudio"

For 32-bit UltraEdit on 64-bit Windows: "%ProgramFiles(x86)%\IDM Computer Solutions\UltraEdit"
For 32-bit UEStudio on 64-bit Windows: "%ProgramFiles(x86)%\IDM Computer Solutions\UEStudio"

For 64-bit UltraEdit on 64-bit Windows: "%ProgramFiles%\IDM Computer Solutions\UltraEdit"
For 64-bit UEStudio on 64-bit Windows: "%ProgramFiles%\IDM Computer Solutions\UEStudio"

In the following sections I refer this directory with the term ProgramDirectory.

%ProgramFiles% and %ProgramFiles(x86)% reference standard Windows environment variables.


Where are wordfiles stored really used by default by UltraEdit/UEStudio?

The wordfiles really used by default are stored in the directory wordfiles in the application data directory which is:

For UltraEdit: "%APPDATA%\IDMComp\UltraEdit"
For UEStudio: "%APPDATA%\IDMComp\UEStudio"

In the following sections I refer this directory with the term DataDirectory.

%APPDATA% references another standard Windows environment variable. The value of environment variable APPDATA depends on current user account. So this value changes on computers used by multiple users for each user starting UE/UES.

For details about standard Windows environments see Wikipedia article about Windows Environment Variables.
Users of 64-bit Windows should read also the Microsoft MSDN article about WOW64 Implementation Details (Windows).


How are the installed wordfiles copied for usage?

UltraEdit and UEStudio check on every start the existence of the directory "DataDirectory\wordfiles".

Everything from "ProgramDirectory\wordfiles" is copied recursive (= with subdirectories) to "DataDirectory\wordfiles" if the directory "DataDirectory\wordfiles" does not exist.

But nothing is copied if the directory "DataDirectory\wordfiles" already exists on startup of UE/UES.

It does not matter for UE/UES if "DataDirectory\wordfiles" is completely empty. It also does not matter if the "DataDirectory" is used at all for application settings because command line parameter /I= is used or environment variable UEINIDIR or UESINIDIR are defined with specifying a different directory for UE/UES INI file. And it does not matter which directory is configured in used UE/UES INI file (or Windows registry) at Advanced - Settings/Configuration - Editor Display - Syntax Highlighting.

Copying everything from "ProgramDirectory\wordfiles" to "DataDirectory\wordfiles" is done on startup of UE/UES if "DataDirectory\wordfiles" does not exist, otherwise nothing is copied. That's it.


How are the used wordfiles updated after updating program files of UltraEdit/UEStudio?

The short answer: The used wordfiles are not updated at all by UE/UES (anymore).

In Readme for the Syntax Highlighting forum it is written that the used wordfiles are not updated anymore since UltraEdit for Windows v21.00 and UEStudio v14.00. I have never asked IDM support by email why the user guided update of the wordfiles was removed from UE/UES, but it is quite easy to understand for me.

  • Most users of UE/UES don't know anything about all the configuration files installed and used by UltraEdit which can be customized by the users. So if UE/UES asks on first start after an update if the existing syntax highlighting wordfiles should be updated or not, most users most likely would need a button: I don't know what wordfiles are. I can't answer this question.
  • Every UE/UES users has the freedom to

    • add wordfiles in the used wordfiles directory,
    • delete not needed wordfiles in used wordfiles directory (recommended for a for faster startup of UE/UES)
    • modify wordfiles by adding keywords, removing keywords, adding, removing or modifying function strings, ...
    In other words every user can change really everything regarding syntax highlighting wordfiles.
  • It is possible to upgrade UltraEdit from any former version to latest version (and limited also to downgrade) which means the entire history of changes on wordfiles management would have been taken into account on startup of UltraEdit/UEStudio for an automated wordfiles update.
It is practically impossible for UE/UES to find out if an existing wordfile is from a previous version of UE/UES not modified in any way by the user and which could be perhaps updated by newly installed wordfile in "ProgramDirectory\wordfiles". Therefore whether a user guided wordfiles update process nor a completely automated wordfiles update process are really possible to implement.


How to update wordfiles after upgrading UltraEdit/UEStudio?

The simplest method on using default wordfiles directory and having never customized any wordfile or added/deleted wordfiles in default wordfiles directory is deleting "DataDirectory\wordfiles" while no instance of UE/UES is running at the moment.

Otherwise it is advisable to compare "ProgramDirectory\wordfiles" with "DataDirectory\wordfiles" and decide file by file if the latest one installed with UE/UES should be copied completely to "DataDirectory\wordfiles" or if an even more difficult merge process is needed to take over improvements from newest installed wordfile with the user customizations in currently used wordfile.


What are the differences between *.uew files in wordfiles and wordfiles\legacy?

There are 18 *.uew files in wordfiles, but only 14 *.uew files in wordfiles\legacy.

Those *.uew files existing in both directories are since UE v24.00 and UES v17.00 identical with the exception of the used regular expression strings.

The wordfiles in wordfiles\legacy use only UltraEdit regular expression strings while the wordfiles in wordfiles use nearly all Perl regular expression strings.

In general the *.uew files in wordfiles should be used, except somebody favors for some reason using 1 or more *.uew files with using legacy UltraEdit function strings from wordfiles\legacy.


Are the *.uew files in "DataDirectory\wordfiles\legacy" also used by UE/UES?

UE/UES reads just *.uew files in configured wordfiles directory. *.uew files in subdirectories are not read by UE/UES.

So the directory "DataDirectory\wordfiles\legacy" can be deleted safely to save some disk space. It is not recreated by UE/UES as long as its parent directory "DataDirectory\wordfiles" is not also deleted completely.

But the directory "ProgramDirectory\wordfiles\legacy" should be kept in case of in future it turns out a legacy wordfile would be better. Also this directory with all *.uew files is recreated on every update of UltraEdit/UEStudio. For that reason it does not make sense to delete this usually write-protected directory to save some KB of disk space.


What was changed on *.uew files installed with UE for Windows v24.00 and UES v17.00?

Nearly all *.uew files in "ProgramDirectory\wordfiles" and in subdirectory legacy have been updated in comparison to UltraEdit for Windows v23.20 and UEStudio v16.20.

Most of those improvements are just for getting pretty looking and standardized wordfiles which have no effect on syntax highlighting. But some really improve syntax highlighting, for example the updates made on batch.uew.

Following modifications were applied on many files:

  1. The order of lines at top is for all wordfiles now:

    1. Language definition
    2. /LanguageMarker if defined for the language
    3. Function strings
    4. Regular expression type if Perl is used
    5. /Delimiters
    This makes it easier to compare the wordfiles.

  2. A-Z in character classes [...] containing already a-z was removed as the function strings, variable strings and member strings are searched case-insensitive and therefore A-Za-z is equal a-z.

  3. The delimiters were sorted according to ASCII table with exception of space character being always the second delimiter and tab character being always the fourth delimiter for easier recognizing space and tab.

  4. Everything except function strings, member strings and variable strings were copied to legacy wordfiles to have the same strings highlighted on using legacy wordfiles as on using standard wordfiles.

  5. Trailing spaces were removed from all lines and made sure that the last line of wordfile has also a line termination.
The improvements in detail for each standard wordfile:

Code: Select all
legacy\c_cplusplus.uew ... 3. and 4.
legacy\csharp.uew      ... 2. and 3. and 4.
legacy\css.uew         ... 3. and 4.
legacy\html.uew        ... 1. to 4.
legacy\java.uew        ... 3. to 5.
legacy\javascript.uew  ... 1. and 3. and 4.
legacy\mysql.uew       ... 1. and 3. and 4.
legacy\perl.uew        ... 1. and 3. and 4.
legacy\php.uew         ... 3. and 4. and 5.
legacy\python.uew      ... 1. and 3. to 5.
legacy\ruby.uew        ... 1. and 3. and 4.
legacy\vbscript.uew    ... 1. and 3. and 4.
legacy\visualbasic.uew ... 1. and 3. and 4.
legacy\xml.uew         ... 1. and 3.


batch.uew

Batch files are very difficult to syntax highlight. There is no syntax highlighting anywhere which really works perfect for all batch files.
However, I think improved batch.uew makes a much better job on syntax highlighting than batch.uew installed with former versions of UltraEdit.

"Line Comment = rem" is replaced by "Line Comment Num = 4rem " as the remark comment requires a space after REM to be recognized as remark command commenting the line.

Comment Valid Columns Alt = [1] was added to recognize invalid label :: only at beginning of a line as alternate comment.

The function string was modified because a valid label requires at least one character after the colon.

The color groups were renamed.

Internal and external commands were added.

Syntax highlighting changed for environment variables with delayed expansion, i.e. !variable!.

More operators added which were previously named delimiters.

Color group 8 added with named command arguments of setlocal command mainly for easier adding them to a batch file with auto-completion.

This wordfile is still not the final version. It still needs adding more keywords in future. But it is much better than the batch.uew installed with previous versions of UltraEdit/UEStudio.


css.uew

2. general improvement applied and removed the line with /Font Style = 0,0,0,0,0,

And corrected last color group number to 10 as there were two color groups 9 which of course is an error in syntax highlighting definition.


html.uew

The tag <!doctype was added to this wordfile.

The order of some tags and special characters was fixed which is not relevant for syntax highlighting.

Color group 4 was added for en dash, em dash and a non breaking space (on last line). It is required to define a different background color than normal background color for HTML color group Dashes and NBSP for getting them good highlighted in HTML files on tab Syntax in Manage Themes dialog window. The two dashes and the non breaking space were also added to list of delimiters in html.uew, but not in legacy\html.uew. Color group 4 was added to get with appropriate background color setting those 3 characters often added to HTML files with other text copied from word processing applications (MS Word, Write) extra highlighted as those 3 characters require special encoding if HTML file is not UTF-8 encoded.


shell.uew

1. and 3. general improvement applied.

Line Comment Preceding Chars = [~!-~] was added for ignoring # not used as begin of a comment as discussed in user-to-user forum, see the topic BASH Code Folding.

** ${ was removed as just ** $ highlights already all strings starting with a dollar sign and therefore ** ${ is not really needed.


wf.uew

The file extensions UWD and uew were removed as the first one was never really existing and upper case UEW is enough to highlight all *.uew.

The function group was renamed as "Function" was definitely not good.

The regular expression was improved to find only valid color groups.

Language marker keyword RUBY_LANG was added to color group 2.


Other wordfiles

Code: Select all
c_cplusplus.uew ... 2. and 3. and 5.
csharp.uew      ... 1. and 3.
java.uew        ... 1. to 3. and 5. and removed backslashes in character
                    classes in Perl regular expressions not really needed.
javascript.uew  ... 1. and 3.
mysql.uew       ... 1. and 3. and moved String Chars = `' after the
                    comment definitions as in other wordfiles.
perl.uew        ... 1. and 3.
php.uew         ... 1. and 3.
powershell.uew  ... 1. and 3. and 5. and removed "Line Comment Alt = #"
                    as being the same as line comment definition, moved
                    EnableMLS after String Chars as in other wordfiles, and
                    slightly changed name of first function string group.
python.uew      ... 1. and 3. and 5.
ruby.uew        ... 1. and 3. and fixed String Chars definition (missing
                    spaces around equal sign and changed case-insensitive
                    file extensions to upper case as in other wordfiles.
vbscript.uew    ... 5.
visualbasic.uew ... 1.
xml.uew         ... 1. and 3.
Best regards from Austria
When I saw this line I have to disagree:

shell.uew
** ${ was removed as just ** $ highlights already all strings starting with a dollar sign and therefore ** ${ is not really needed.

I use both - in different color groups - and it allows me to quickly locate instances where a variable is referenced without the {} as well as cases where a $ is used for other reasons.

What would be useful is an option to highlight $ variables found in strings since in shell scripts the variable is resolved to its contents when the string is parsed.
Well, shell.uew installed with UltraEdit < 24.00 contained the block:

Code: Select all
/C3"Variables"
** $ ${

Here ${ does not make sense as all strings starting with $ are highlighted with color group 3.

But good would be using shell.uew with:

Code: Select all
/C3"{Variables}"
** ${

    other color groups

/C8"Variables"
** $

The longer substring ${ in color group 3 is first searched in file by UltraEdit resulting in highlighting ${Variable} with a different color than $Variable found next with the shorter substring $ in color group 8.

Do you agree? Should we send IDM a shell.uew with this modification for being published with next release of UE and with UEStudio v17.00?



I think for shell scripts it would be better to replace String Chars = "' by Noquote to disable string highlighting and add double and single quote character for example to /C6"Control Operators". It is more important to have variable references and other operators in double or single quoted strings highlighted than highlighting the entire string with one color as long as UltraEdit does not support highlighting strings within strings (and highlighting strings within comments).

What do you think about this modification for shell scripts which I don't edit because I'm using only Windows?
Best regards from Austria
3 posts Page 1 of 1