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
16 posts Page 1 of 2
Is it my imagination or is the Line Comment Alt case sensitive even if Nocase marked for the language?

Can anyone confirm this, before I report the bug?

TIA,

Paolo
There is no such thing as an inconsistently correct system...
Therefore, aim for consistency; in the expectation of reaching correctness!
Yes, the alternate line comment is case-sensitive as all other comment specifications, too. For an explanation read the ultimate test for invalid words macro which I posted today.

Update 1: This was changed in UltraEdit for Windows v21.20.0.1009 and UEStudio v14.30.0.1008. Case-sensitivity of line and block comment strings depends on existence of keyword Nocase in first line of the syntax highlighting wordfile since these versions of UE/UES.

Update 2: A case-insensitive alternate line comment highlighting depending on Nocase in first line of the syntax highlighting wordfile works since UltraEdit for Windows v24.00 and UEStudio v17.00.
Best regards from Austria
Hi Mofi,
I searched the post and could NOT find:

1) Specific mention of the case sensitivity of Comment specifications
2) A reason for why this is so (in the case of a Nocase language specification)

Thanks for confirming the observation. However, why is it NOT a bug? It seems inconsistent to me.

(BTW: Great posting!)
Paolo
There is no such thing as an inconsistently correct system...
Therefore, aim for consistency; in the expectation of reaching correctness!
A text file is parsed first for lines, then comments, then strings and then words with the delimiter set which are always not case-sensitive. Then the words are compared according to Nocase with strcmp or stricmp (or whatever the C++ function names are for those string comparisons) or each word is converted to lowercase before comparing strings which I think UE really does.

The line termination, comments, strings and delimiter characters are normally not letters and so case-sensitivity is not important.

When Nocase should be also active before splitting the files into comments, strings and words then a program like UE has according to this setting convert all its strings in its buffers to lowercase and also the content of the file while parsing it.

Well, that would be possible, but is currently not the case. You can interpret it as a bug. That's up to you. Sent a bug report email to IDM support. If the developers share your point of view, they will maybe change it.

Update 1: This was changed in UltraEdit for Windows v21.20.0.1009 and UEStudio v14.30.0.1008. Case-sensitivity of line and block comment strings depends on existence of keyword Nocase in first line of the syntax highlighting wordfile since these versions of UE/UES.

Update 2: A case-insensitive alternate line comment highlighting depending on Nocase in first line of the syntax highlighting wordfile works since UltraEdit for Windows v24.00 and UEStudio v17.00.
Best regards from Austria
Mofi wrote: The line termination, comments, strings and delimiter characters are normally not letters and so case sensitivity is not important.

This isn't true of the various Basic dialects also many SQL dialects.

I will report a bug and hope for the best...

Thanks again Mofi,
Paolo
There is no such thing as an inconsistently correct system...
Therefore, aim for consistency; in the expectation of reaching correctness!
Hi,
I wonder why I don't get SQL lines beginning with REM (or Rem or rem) highlighted as comments the same way as lines with --.

My PLSQL.uew starts with:

Code: Select all
/L1"Oracle SQL" Nocase Line Comment = -- Line Comment Alt = rem Block Comment On = /* Block Comment Off = */ Block Comment On Alt = /* Block Comment Off Alt = */ String Chars = ' DisableMLS File Extensions = SQL TQL PAK PKS PKG

UltraEdit Professioneller Text-/HEX-Editor (x64) Version 23.20.0.28, German, Win7

Any help is appreciated

BR, Miklos / Vienna
Regards from Vienna
Miklos, the alternate line comment definition is absolutely correct if really copied exactly as shown here from the wordfile.

Absolutely useless is specifying /* and */ as block comment and as alternate block comment. If you want to highlight block comments different to line comments, remove Block Comment On = /* Block Comment Off = */ otherwise remove Block Comment On Alt = /* Block Comment Off Alt = */.

If you want to highlight line comments starting with -- and block comments with same color, but highlight line comments starting with rem with a different color, replace Block Comment On Alt = /* Block Comment Off Alt = */ by just Block Comment On Alt = rem. That results in using the color and font style settings configured for alternate block comments for the line comments starting with rem.

I think the reason for not getting line comments starting with rem highlighted as comments in your *.sql files is using more than 1 wordfile which lists SQL after File Extensions =. For example there is pre-installed the wordfile mysql.uew with language name MySQL 5.1 containing as first line

Code: Select all
/L13"MySQL 5.1" SQL_LANG Nocase Line Comment = # String Chars = `' Line Comment Alt = -- Block Comment On = /* Block Comment Off = */ Escape Char = \ File Extensions = SQL

So if MySQL 5.1 is displayed in the status bar at bottom of the main window for active SQL file and not Oracle SQL as defined in the wordfile you edited, the highlighting is according to wordfile mysql.uew. On not using basic status bar it is possible to click on syntax language name in status bar and select Oracle SQL as highlighting for active file.

You should remove wordfile mysql.uew from directory displayed after opening Advanced - Settings/Configuration - Editor Display - Syntax Highlighting if you never want to use this SQL highlighting which speeds up startup time of UltraEdit and avoids the highlighting confusion.

You could alternatively also just remove SQL from first line of mysql.uew opened via the button Open in configuration dialog Advanced - Settings/Configuration - Editor Display - Syntax Highlighting to get by default *.sql files highlighted with your Oracle SQL wordfile, but giving you nevertheless the opportunity to manually select MySQL 5.1 for an opened *.sql file.

In general it is advisable to delete all *.uew files in directory displayed in Syntax Highlighting configuration dialog never used by you. The less *.uew files are in this directory, the faster is the startup of UltraEdit as less wordfiles must be read in. The installer of UltraEdit for Windows and UEStudio installs the standard *.uew files into a subdirectory wordfiles in the program files directory of UE/UES. So it is always easy to get a deleted wordfile in usually used wordfiles directory in application data directory of UltraEdit/UEStudio back by copying the wordfile manually from wordfiles directory in program files folder of UE/UES into wordfiles directory of application data directory of UE/UES.
Best regards from Austria
Thanks a lot, Mofi, but the problem is somewhere else.
I have no more than 1 wordfile which lists SQL after File Extensions =.
The highlighting problem could be solved by exchanging Line Comment and Line Comment Alt:

Code: Select all
/L1"Oracle SQL" Nocase Line Comment = rem Line Comment Alt = -- Block Comment On = /* Block Comment Off = */ String Chars = ' DisableMLS File Extensions = SQL TQL PAK PKS PKG

This way, lines beginning with REM or -- are highlighted as comments. Weird, isn't it?
This trick unfortunately has a flow: "Comment out lines" in the context menu will prepend "rem" instead of "--", which is not allowed in PLSQL blocks and packages.
Anyone able to reproduce it?
Regards from Vienna
I could reproduce this definite bug and have just reported it to IDM support by following email:

Mofi wrote: I looked on an issue reported by a user who failed to use rem as alternate line comment in a wordfile for syntax highlighting SQL files containing keyword Nocase in first line.

The issue reported below could be reproduced with UE v23.20.0.40 on Windows 7 SP1 x64.

I copied into a Test.sql file the following 5 lines:

Code: Select all
--  line comment 1
rem line comment 2
REM line comment 3
Rem line comment 4
rEM line comment 5

Next I opened %APPDATA%\IDMComp\UltraEdit\wordfiles\mysql.uew and made the line comment highlighting tests by replacing always just the first line, saving the wordfile and looking on highlighting of Test.sql.

The results are:

Highlighting all 5 lines as line comments works with:

Code: Select all
/L13"MySQL 5.1" SQL_LANG Nocase Line Comment = -- Block Comment On Alt = REM Block Comment On = /* Block Comment Off = */ Escape Char = \ String Chars = `' File Extensions = SQL
/L13"MySQL 5.1" SQL_LANG Nocase Line Comment = -- Block Comment On Alt = rem Block Comment On = /* Block Comment Off = */ Escape Char = \ String Chars = `' File Extensions = SQL
/L13"MySQL 5.1" SQL_LANG Nocase Line Comment = -- Block Comment On = REM Block Comment On Alt = /* Block Comment Off Alt = */ Escape Char = \ String Chars = `' File Extensions = SQL
/L13"MySQL 5.1" SQL_LANG Nocase Line Comment = -- Block Comment On = rem Block Comment On Alt = /* Block Comment Off Alt = */ Escape Char = \ String Chars = `' File Extensions = SQL

So using block comment or alternate block comment as case-insensitive line comment works well.


Just the lines 1, 3 and 4 are highlighted as line comments with:

Code: Select all
/L13"MySQL 5.1" SQL_LANG Line Comment = -- Block Comment On Alt = REM Block Comment On = /* Block Comment Off = */ Escape Char = \ String Chars = `' File Extensions = SQL
/L13"MySQL 5.1" SQL_LANG Line Comment = -- Block Comment On = REM Block Comment On Alt = /* Block Comment Off Alt = */ Escape Char = \ String Chars = `' File Extensions = SQL

And just the lines 1, 2 and 5 are highlighted as line comments with:

Code: Select all
/L13"MySQL 5.1" SQL_LANG Line Comment = -- Block Comment On Alt = rem Block Comment On = /* Block Comment Off = */ Escape Char = \ String Chars = `' File Extensions = SQL
/L13"MySQL 5.1" SQL_LANG Line Comment = -- Block Comment On = rem Block Comment On Alt = /* Block Comment Off Alt = */ Escape Char = \ String Chars = `' File Extensions = SQL

So using block comment or alternate block comment as case-sensitive line comment works also with the strange side effect that just the first character of the case-sensitive line comment starting string must match. In practice this should not matter as I suppose there is either REM or rem in SQL files, but never rEM, rEm, reM, REm, ReM or Rem.


Just the lines 1 and 2 are highlighted as line comments with:

Code: Select all
/L13"MySQL 5.1" SQL_LANG Line Comment = -- Line Comment Alt = rem Block Comment On = /* Block Comment Off = */ Escape Char = \ String Chars = `' File Extensions = SQL

And just the lines 1 and 3 are highlighted as line comments with:

Code: Select all
/L13"MySQL 5.1" SQL_LANG Line Comment = -- Line Comment Alt = REM  Block Comment On = /* Block Comment Off = */ Escape Char = \ String Chars = `' File Extensions = SQL

That is the absolutely correct behavior for case-sensitive alternate line comment.


But highlighted is only the line 1 as line comment with:

Code: Select all
/L13"MySQL 5.1" SQL_LANG Nocase Line Comment = -- Line Comment Alt = rem Block Comment On = /* Block Comment Off = */ Escape Char = \ String Chars = `' File Extensions = SQL

That is completely wrong and a definite bug. The alternate line comment highlighting is not working at all if the alternate line comment is of letters and the language is defined as being case-insensitive.

Miklos, the solution for you is using one of the following two lines as first line in your wordfile:

Code: Select all
/L1"Oracle SQL" SQL_LANG Nocase Line Comment = -- Block Comment On = /* Block Comment Off = */ Block Comment On Alt = rem String Chars = ' DisableMLS File Extensions = SQL TQL PAK PKS PKG
/L1"Oracle SQL" SQL_LANG Nocase Line Comment = -- Block Comment On = rem Block Comment On Alt = /* Block Comment Off Alt = */ String Chars = ' DisableMLS File Extensions = SQL TQL PAK PKS PKG

The color and font style settings for Alternate Block Comments used to highlight either line comments starting with rem in any case (first line) or for real block comments (second line) can be configured identical to color and font style settings for Comments or different, whatever you like.
Best regards from Austria
Thanks a lot, Mofi!
The workaround is sufficient at the moment. Still I am thankful for the bug report, since it will allow us to display SQL Hints differently than normal block comments.
Regards from Vienna
A case-insensitive alternate line comment highlighting depending on Nocase in first line of the syntax highlighting wordfile works since UltraEdit for Windows v24.00 and UEStudio v17.00.
Best regards from Austria
Great, Mofi, thanks for the effort!

Note 1:
If you select the word "rem", the rest of the line remains highlighted as comments.
If you select the word "Rem" or "REM", the rest of the line gets highlighted as normal code.
I've tested it witch the Glitch color scheme with these lines:

Code: Select all
rem 1234567890 abcdefghij
Rem 1234567890 abcdefghij
REM 1234567890 abcdefghij

Note 2: Can you display Alternate Block Comments in different color than Block Comments?

It seems to me, my UltraEdit Professioneller Text-/HEX-Editor (x64) Version 24.00.0.53, German ignores it when I set a different text color for alternative Blockkommentare. Even after UE restart.

/* normal multiline
comment */

SELECT /*+ this_is_an_Oracle_SQL_HINT */ * FROM dual
;

My PLSQL.uew starts with:

Code: Select all
/L1"Oracle SQL" Nocase Line Comment = -- Line Comment Alt = rem Block Comment On = /* Block Comment Off = */ Block Comment On Alt = /*+ Block Comment Off Alt = */ String Chars = ' DisableMLS File Extensions = SQL TQL PAK PKS PKG FNC VW PRC TRG AWF OOD INS TAB SYN SQS IND
Regards from Vienna
Regarding your first note I have just sent an email to IDM support with subject UE - Highlighting of case-insensitive line comment changes on selecting line comment string with following text:

Mofi wrote: There is a syntax highlighting issue with UE v24.00.0.53 with line comments starting with a string containing letters of a case-insensitive language on selecting the line comment starting string.

For reproducing this issue do following:

Open "%APPDATA%\IDMComp\UltraEdit\wordfiles\batch.uew" and change the first line from

Code: Select all
/L15"Batch" Nocase Line Comment Num = 4rem  Line Comment Alt = :: Line Comment Valid Columns Alt = [1] String Chars = " DisableMLS File Extensions = BAT CMD SYS

to

Code: Select all
/L15"Batch" Nocase Line Comment = rem String Chars = " DisableMLS File Extensions = BAT CMD SYS

Next copy and paste into a new file the following 3 lines:

rem Comment with command REM in lower case
REM Comment with command REM in upper case
Rem Comment with command REM with just first character in upper case

Save the file as Test.bat which activates case-insensitive highlighting.

Select now in first line the line comment starting string rem. The rest of the first line is still highlighted as comment as expected.

Select next in second line REM respectively in third line Rem. The rest of the second/third line is wrongly highlighted as normal text.

This happens also with using Line Comment Alt = rem in the wordfile. It does not matter if the wordfile contains rem, or REM or Rem.

But if Nocase keyword is removed and using line comment with then case-sensitive rem or REM or Rem there is no wrongly highlighting of rest of the line as normal text when selecting line comment string.

This issue does also not occur when using a block comment as line comment, i.e. use one of the two lines below in the wordfile.

Code: Select all
/L15"Batch" Nocase Block Comment On = rem String Chars = " DisableMLS File Extensions = BAT CMD SYS
/L15"Batch" Nocase Block Comment On Alt = rem String Chars = " DisableMLS File Extensions = BAT CMD SYS

So the issue with highlighting rest of the line comment as normal text on selecting line comment starting string containing letters occurs only with line comment or alternate line comment being defined in a case-insensitive syntax highlighting wordfile and selected line comment starting string in highlighted file is not completely written in lower case.

This issue was detected by forum member Miklos and reported with a post, see http://forums.ultraedit.com/topic4653.html#p58416

Regarding your second note UltraEdit will never find an alternate block comment to highlight as the block comment starting string is /* and the alternate block comment starting string is /*+ which means the difference between block comment and alternate block comment is the first character in block comment.

UltraEdit does not additionally check if a longer line/block comment string is also matched when a shorter line/comment string was already found in the active file. So it is with UltraEdit up to v24.00.0.53 impossible to get anything within /*+ and +*/ highlighted as alternate block comment as long as block comment starts with /* and ends with */.

It is not possible to define a block comment containing a space character as it is possible for line comments. And a Perl regular expression like /\*(?!\+) also can't be used as block comment starting string definition as UltraEdit/Perl regular expressions are supported only for function, member and variable strings.

In other words the alternate block comment highlighting wanted by you is not possible with UE v24.00.0.53 or any former version of UltraEdit.

Update: The reported issue was fixed with UE v24.00.0.73 released on 2017-04-18.
Best regards from Austria
Mofi wrote: ... impossible to get anything within /*+ and +*/ highlighted as alternate block comment as long as block comment starts with /* and ends with */.

Hi Mofi!

Have you tried to select the first slash of the alternate block comment (alone, or including arbitrary number of characters BEFORE it)?

To my surprise, the color for alternate block comments shows up!
Regards from Vienna
Hi Miklos!

I have just reported this issue with following email to IDM support with subject:
UE - Selecting first character of block comment changes highlighting of first line of block comment

Mofi wrote: I'm using currently 32-bit UE v24.00.0.56 on Windows 7 SP1.

UltraEdit changes the syntax highlighting of first line of a block comment on having selected the first character of the block comment with a specific combination of block comment and alternate block comment as forum member Miklos reported and I could also reproduce, see the forum post http://forums.ultraedit.com/topic4653.html#p58576

Following steps are necessary to reproduce this issue:

  1. Start UltraEdit with default settings.

  2. Copy and paste the following to block comments into the new file.

    Code: Select all
    /* C/C++ block comment */

    /*! Doxygen comment
    over multiple lines. !*/

  3. Save the new file with Test.c as file name.

  4. Open "Advanced - Settings - Editor Display - Syntax Highlighting", open the wordfile for C/C++ and close the configuration dialog with Cancel.

  5. Replace in first line of c_cplusplus.uew the block comment definition

    Code: Select all
    Block Comment On = /* Block Comment Off = */

    by

    Code: Select all
    Block Comment On = /*! Block Comment Off = !*/ Block Comment On Alt = /* Block Comment Off Alt = */

  6. Save modified wordfile c_cplusplus.uew and switch back to file Test.c.

  7. Open Manage Themes dialog, switch to tab Syntax, select language C/C++ and change the settings for alternate block comment for example to dark blue as foreground color, yellow as background color and bold as font style to have a very clear difference to line and block comments.

  8. The two block comments are highlighted now (with Slate theme) as it can be seen also on upper half of the attached image.

    Select now only the slash character at beginning of the Doxygen block comment highlighted with line/block comment color and style settings.
The first line of this block comment is displayed now with the settings set for alternate block comment as it can be seen also on lower half of the attached image BlockCommentHighlighting.png (not anymore attached to this post).

This strange effect disappears on increasing the selection to next character of the block comment. And this strange syntax highlighting effect occurs only on selecting just the first character of the block comment, not on selecting anything else within block comment.

Update: The reported issue was fixed with UE v24.00.0.73 released on 2017-04-18.
Best regards from Austria
16 posts Page 1 of 2
cron