News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Kermit attacks 7280! or hilighting rules are highlighting words it shouldn't...

Started by ouch, July 06, 2011, 09:06:00 PM

Previous topic - Next topic

ouch

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.

thomas

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."

ouch

are there any plans to fix this?

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

GeO

Quote from: ouch on July 07, 2011, 05:05:42 PM
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]

ouch

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.

thomas

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."

ouch

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.

killerbot

@Thomas : I just noted some missing : cbegin, cend, crbegin, crend .

Could you add them ?

oBFusCATed

/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!]

killerbot


thomas

"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

killerbot

Thomas, could you also add the atomic types ? I noticed they are not colored yet.

oBFusCATed

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!]

thomas

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."

killerbot

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.