Sublime Forum

[Bug] syntax=Tcl, comments at the end of the line is not detected by syntax highlight function

#1
  • Behaviour of Sublime-Text:
    Steps:
  1. Color theme - “jEdit” (jEdit Color Theme).
  2. File “test.tcl”.
  3. Syntax: “Tcl”.
  4. 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: };
  1. Check, that Sublime highlight the comments does not as expected.

Correct behaviour must be:

  1. 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.
  2. 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.
0 Likes

#2

Syntax related bugs should be filed at https://github.com/sublimehq/Packages/issues to ensure they don’t get lost.

TCL is however not actively maintained, currently. A WIP branch with some improvements exists at https://github.com/deathaxe/sublime-packages/tree/wip/tcl/rewrite, but it was set on hold several years ago due to many edge cases which couldn’t be handled at that time.

0 Likes

#3

I fill bug to hte https://github.com/sublimehq/Packages/issues/2200

0 Likes