Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Kermit attacks 7280! or hilighting rules are highlighting words it shouldn't...
oBFusCATed:
--- Quote from: thomas on September 01, 2011, 08:24:35 pm ---Compile-time option is harsh, since the lexers aren't compiled, they're just xml files.
--- End quote ---
Can we have 2 lexers? One with STL and one without?
Freem:
Maybe there is something that can be done.
How the compiler can know if we are using stl functions/methods when we call, by example, "cin"?
It looks if there is a "std::" before, or a "using namespace std;" previously in the file.
If the user use the stl namespace to prefix calls, just use a standard lexer. If he specified "using namespace std;" before, use another lexer, as oBFusCATed said?
I know that it is not true for the great majority of cases, where we just use a method's object. But for a few cases, maybe it is possible to do a workaround? (Something is better than nothing. BTW, we have a proberb to say what I think, but I don't know how to translate it)
I think I have read somewhere here that scintilla highlighting function can not use the context, so maybe I only said something really stupid...
oBFusCATed:
--- Quote from: Freem on September 02, 2011, 10:50:47 am ---If the user use the stl namespace to prefix calls, just use a standard lexer. If he specified "using namespace std;" before, use another lexer, as oBFusCATed said?
--- End quote ---
This is not what I've said. What you're talking about is semantic highlighting, which is not possible and hard to do at the moment.
What I've said is to have two lexer and the user can choose one or the other in the options.
Freem:
Ok, I understand. Sorry for the useless post.
thomas:
Not useless at all. What you suggested is how it should be in the first place. Unluckily, it's not how the factory-supplied lexers in Scintilla work. They match words (not even patterns) and don't have any relation to semantic analysis. And, unluckily, you can't even add begin(), so int begin = 1; will drop through because ( and ) are not "word characters", they'll just be ignored/stripped off. Though I'm not sure whether it's the code that parses the xml files (i.e. the one we wrote) or the code inside Scintilla that does this. This is actually something that might be possible to fix rather easily.
But, all in all, we would really need to write a custom Scintilla lexer (the actual lexer program, not a definition file... harsh, but possible) that is interwined with code completion for something that is truly good and nice for everyone. Then of course, disabling CC would make syntax coloring fail...
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version