- Behaviour of Sublime-Text:
Steps:
- Color theme - “jEdit” (jEdit Color Theme).
- File “test.tcl”.
- Syntax: “Tcl”.
- Code example:
32: proc ::_buttontoggleHandler { cbox args } { 33: # Foreground of this comment is green. 34: if {$args eq "invoke"} { # Foreground of this comment is black. 35: $cbox invert; # Foreground of this comment is black too 36: }; 37: $cbox {*}$args; 38: };
- Check, that Sublime highlight the comments does not as expected.
Correct behaviour must be:
- Lines after the first symbol “#”, which is not backslashed (backslashed symbols “#” - is not an indicator of start of comment), to the end of the line - must be highlighted as a comment (foreground=green, like in line 33).
Syntax checker of the Tcl interpreter can detect, which words with “#” symbol is a part of argument, or is a comment, but in simple case (as in most editors, which I used, and which has the Tcl syntax highlight function), the line from the first un-backslashed symbol “#” - highlighted as comment.
Line 34 shows, that syntax highlight function is bugged. - Lines after the un-backslashed symbol “;” - is a new Tcl command. And all Tcl commands, which first printable symbol is a un-backslashed “#” - is a comment. So, comment at the end of line 35 must be highlighted as a comment (style foreground=greed, like in line 33).
Line 35 show, that syntax highlight function is bugged.
- Behaviour of Eclipse:
- line 33 - is highlighted as a normal comment;
- line 34 - comment at the end of the line is not highlighted (Eclipse can’t detect comments at the end of the command);
- line 35 - comment at the end of the line is highlighted (the symbol “;”, which placed before the symbol “#”, allows Eclipse to handle next words as a new command, which interpreted as comment, because this command has first printable symbol “#”).
- Behaviour of Geany:
Geany editor correctly highlight comments at all lines as a comments: 33, 34 and 35.