Author Topic: syntax coloring confusion  (Read 6599 times)

Steve Black

  • Community Member
  • Posts: 57
  • Hero Points: 4
syntax coloring confusion
« on: March 30, 2007, 12:24:40 am »
I have seen two syntax coloring behaviors in SE 2007 that don't seem right.

1) My setup for COBOL (hey, it's MY life) includes a line comment definition of "73+" (After Column: 73).  If any text, including whitespace, appears in or after column 73 then column 73 gets my comment color but all text to the right is left uncolored.

2) I've added to new line comment delims to the bat extension setup, "::" and ":*".  If I select "Only if first non-blank..." these delims will only work if they are followed by whitespace.  If I uncheck that option, then they work...

...well crud, I give up.  I was trying to experiment with the behavior while I typed, but it's too confusing and not even consistent.  I'm not even sure what I already said is accurate.  I'll just have to say, "It doesn't work," and leave it at that.  Play around with it yourselves if you're curious enough.  If I get a better handle on it later, I'll come back with an update.

So, for item 1, at least, is this a flaw, or have I just failed to get it?

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: syntax coloring confusion
« Reply #1 on: March 30, 2007, 03:12:45 pm »
It sounds like a flaw to me. Can you attach some sample files we can use to reproduce this? We have limited COBOL samples. None of us are COBOL gurus, so I'd appreciate any additional insights you have on how we can improve our support for this language.

Never feel bad about working in COBOL. The spam industry may depend on web languages, but the financial world still runs on COBOL!  ;)

Steve Black

  • Community Member
  • Posts: 57
  • Hero Points: 4
Re: syntax coloring confusion
« Reply #2 on: March 31, 2007, 04:18:20 am »
Thank you for the sage advice Dr. Scott.  I feel so much freer now!   ;D

Thanks also for the invitation to bug you with more COBOL requests.  I'll definitely take you up on it.  By the by, I just finally broke down and upgraded to SE after waiting for about 8 years since the last time CodeWright had an upgrade that was actually useful.  Borland has now gobbled up and spit out my favorite text editor, TWICE.  (I hope you don't take that as a bad omen!)

Ok, here's a little shell of COBOL that exhibits the symptoms I mentioned.  Line 11 has a line number in columns 73-80 where only the 0 in 73 gets colored.  You can also see on line 56 what happens to text after 73 when the line is also commented out in column 7.  When the line content ends, the extended comment coloring takes over once again.  (Of course this is bogus code and I would never actually have content beyond 80.)

As an aside, a nice little enhancement would be to allow a 'between columns' comment style.  I would apply this to columns 1-6 where I place eye-catchers.

Thanks again,
« Last Edit: March 31, 2007, 04:21:48 am by StephenBlack »

Steve Black

  • Community Member
  • Posts: 57
  • Hero Points: 4
Re: syntax coloring confusion
« Reply #3 on: April 02, 2007, 11:16:05 pm »
FYI, I just realized that I never mentioned that I color comments with a background color.  This helps to delineate sections of code, and it also make the coloring problems more obvious.  Without it, you might be scratching your head trying to find some of the things I described.

Oops.

Steve Black

  • Community Member
  • Posts: 57
  • Hero Points: 4
Re: syntax coloring confusion
« Reply #4 on: July 31, 2007, 04:37:04 pm »
Ok, back to item 2: Batch file comments (from my original post).  As of 12.0.2 07/27, this seems to have changed a bit, and is simpler to see and describe now.

My two added line comment delimiters (:: and :*) now behave exactly as the two predefined ones (rem and @rem).  When defined with no options checked they are colored when they are followed by at least one whitespace character, no matter where they appear on the line.  When the "first non-blank" option is checked, they are never colored.

Syntactically, the rem command does require terminating whitespace, and begins a line comment only when it is the first non-blank text on the line.  The '::', and ':*' comment delimiters, however, is a logical overloading (abuse, really) of the label delimiter, ':'.  They are again only recognized as labels ('comments') when the first non-blank, but they do not require trailing whitespace, since the interpreter is expecting to use the trailing non-blank text as a label for goto commands.  (Sample file attached.)

So there are 3 problems here:
1) The "first non-blank" option does not work, when in reality it should forced on.
2) Common abuse of the label delimiter to create comments is not correctly supported.

These are minor issues and I can live with the status quo, but it would be nice to have them addressed at some point.

Thanks,



« Last Edit: July 31, 2007, 05:38:13 pm by Steve Black »

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1299
  • Hero Points: 130
Re: syntax coloring confusion
« Reply #5 on: August 03, 2007, 03:05:38 pm »
With regards to the comment problem in Batch lexer, I think that the problem lies in Color Coding Setup.  If you look on the Tokens tab for the setup, in the Identifiers, "ID follow characters" has the ':' defined.  In the lexer, it sees "::echo" as valid identifier rather than the beginning of line comment.  It's probably not necessary that the ':' be defined there, but may have been added to fix some color coding problem with labels at one point.

Steve Black

  • Community Member
  • Posts: 57
  • Hero Points: 4
Re: syntax coloring confusion
« Reply #6 on: August 03, 2007, 03:36:27 pm »
Thanks Lee.  That solves the biggest part of the problem, although not all of it.

With this setting, I seem to see all the proper coloring characteristics, including ':Identifier' with the ':' in punctuation color which helps mark it as a label.

The one remaining problem (from those I reported) is that the 'first non-blank' option results in no comments being recognized at all (for the specified delimiter).

But this is a big improvement.  Thangs again.

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1299
  • Hero Points: 130
Re: syntax coloring confusion
« Reply #7 on: August 03, 2007, 05:40:18 pm »
I may have just identified an issue when checking for leading blanks in line comments.  I still have to do more testing, but I'll do my best to try to get it in the upcoming 12.0.3 update that we are preparing.  I'll also update the default SlickEdit color coding definition to remove the ':' from the identfiers id in the Batch color coding section.

Steve Black

  • Community Member
  • Posts: 57
  • Hero Points: 4
Re: syntax coloring confusion
« Reply #8 on: August 04, 2007, 05:10:51 am »
Sounds good Lee, I'll be looking for it.

Thanks.