Author Topic: Problem with syntax highlighting in Bourne shell script file  (Read 3427 times)

skilleter

  • Community Member
  • Posts: 14
  • Hero Points: 0
Greetings folks,

I've come across a problem with the syntax highlighting of comments in shell script files in that the '#' character is both used as a comment delimiter and an operator (not really a good idea IMHO, but we're stuck with it).

This means that in the following code fragment:

    #
    #This is also a comment
    a=1 # This is a comment
    w=${#j}
    x=${k#word}
    y=${m##word}

lines 1, 2, & 3 contain comments but the following lines do not (# is a string length operator in line 4, and a pattern matching operator in lines 5 and 6).

My problem is that I can't work out any way of configuring Slickedit so that will correctly recognize the comment-ness or otherwise of all of these examples - to be fair, other editors have similar problems, with the exception of Emacs which seems to cope. The result is that I either have bits of code that are highlighted as comments, or some comments that get highlighted as if they were code, and the bracket matching can get mis-aligned as well.

As a side issue, on the color coding setup window in Slickedit, on the 'comments' tab, when setting up a line comment, there's an option labelled 'End column is end of line' which can be turned on or off, but appears to be ignored - it isn't saved and doesn't appear to have any effect. Is this a bug or reserved for future use?

As a tertiary, potentially related, side issue, I use a background colour on comments - is there any way of specifying that the background colour highlighting should stop at the end of the last character of a line comment, rather than continuing off to column infinity as it currently does?

This is with Slickedit 12.0.2 on Linux and 12.0.1 on Windows

John Skilleter
« Last Edit: July 31, 2007, 11:28:46 am by skilleter »

jbhurst

  • Senior Community Member
  • Posts: 405
  • Hero Points: 33
Re: Problem with syntax highlighting in Bourne shell script file
« Reply #1 on: July 31, 2007, 08:58:13 pm »
Try checking the "Only if preceded by blank" option in Color Coding Setup, Comments tab. It works for me, even with the comments where # is at the start of the line.

John Hurst
Wellington, New Zealand


skilleter

  • Community Member
  • Posts: 14
  • Hero Points: 0
Re: Problem with syntax highlighting in Bourne shell script file
« Reply #2 on: August 01, 2007, 09:19:37 am »
Thanks, that seems to work perfectly!

John