Author Topic: Kermit attacks 7280! or hilighting rules are highlighting words it shouldn't...  (Read 14771 times)

Offline ouch

  • Almost regular
  • **
  • Posts: 223
words like "size", "erase" and "function"

wxWidgets commands uses some of these words. for example with wxstrings:

test.erase();

the word erase is green.

the word erase is a valid standard highlighting term yes, but not in this context.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Yes, that is right. This member is one of the "STL compatibility" functions or whatever wxWidgets calls them.

As of revision 7263/7264, most (hopefully all) of STL, C++03, and C++0x has been added to the lexer.

Obviously the downside is that if something looks like STL, it is highlighted as such.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline ouch

  • Almost regular
  • **
  • Posts: 223
are there any plans to fix this?

just checking if its surrounded by a space between the keyword and other stuff would help greatly.

Offline GeO

  • Multiple posting newcomer
  • *
  • Posts: 51
are there any plans to fix this?

Just set "User keyword" to black and uncheck bold, and you're done.

Greets GeO

[attachment deleted by admin]

Offline ouch

  • Almost regular
  • **
  • Posts: 223
Well that would mean they (and other stuff) wouldn't get highlighted at all. STL commands should get highlighted but not if the words are actually members and variables in a specific context.

But I think just checking for spaces would stop most of the highlighting errors.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Syntax highlighting is not context sensitive (at least not in this sense), unluckily. That's not how it works. It matches some control structures, such as comments, and it can distinguish balanced and unbalanced braces, but other than that it simply matches substrings.

So unluckily, I see no way how one could fix this, other than rewriting SciTE's syntax highlighter entirely and combining it with a parser that is superior to the one we currently use for code completion. In one word: no.

(of course removing all of the STL highlighting would be another option)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline ouch

  • Almost regular
  • **
  • Posts: 223
How about just distributing 2 different lexers? one with the STL stuff and one without. Best of both worlds. ;)

or put them in a different set. That would work too.
« Last Edit: July 07, 2011, 09:12:27 pm by ouch »

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5496
@Thomas : I just noted some missing : cbegin, cend, crbegin, crend .

Could you add them ?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
/off
killerbot: are you using c++-0x in production or in personal test projects?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5496
in production :-)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
@Thomas : I just noted some missing
rev 7282
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5496
Thomas, could you also add the atomic types ? I noticed they are not colored yet.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Thomas:
After using newer C::Bs having this feature for a while, I think that this feature should be removed
or you should provide a way to disable it.
At the moment it makes the code really unreadable, because random words are made bold and highlighted.
It is just noise, no real added value.

This is my view of course :)

p.s. I'm OK with compile time only disable mechanism :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Feel free to revert, I find it useful... but tastes surely differ. I can always keep my local copy, no problem.

Compile-time option is harsh, since the lexers aren't compiled, they're just xml files.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5496
it is ok, but it would be really nice it it was more smart begin() on container is ok to have coloured, but then int begin = 10; here begin should not be coloured.

I guess the best is a regular setting to please everyone, then one can select.