Bugzilla – Bug 432735
Incorrect highlighting for context-sensitive keywords (from, where, get, select...)
Last modified: 2011-05-23 07:30:11 UTC
"where" is context sensitive keyword, in following code is only 1 where which is keyword color class where { } delegate void D<T> () where T : where;
Thats true for all context sensitive keywords. Try: class get { } in gedit - it's the same. It's not possible to define a context sensitive keyword sheme with a context free grammar. We can fix this, when we're highlighting the parse tree and not the chars. This may *not* be soon. So long I recommend not using context keywords as class name.
Heh, that's easier said than done. Especially when the code is not yours and there is ~16 context keywords. It's clearly a bug.
no it's mimic gedit behavior :) (I suppose vi/emacs have the same problem with context sensitive keywords. Either you don't highlight them or you've something like this)
Actually, I believe that GtkSourceView could handle this, since its highlighter has the concept of a context. So they could, for instance, match on "class (.*) {" and "}" to create a context in which these are keywords. http://library.gnome.org/devel/gtksourceview-2.0/stable/lang-reference.html
There are two levels of difference in chomsky hierarchy, it's even not possible to define a context free grammar in the source editors. class Test { void TestMethod() { int where; } }
btw. "where" is not the only one, there are many more (around 16 may be right, I've not counted them). Trying to solve this with regular expressions is pointless.
*** Bug 537801 has been marked as a duplicate of this bug. ***
*** Bug 540298 has been marked as a duplicate of this bug. ***
Changing summary to make the bug more searchable (to avoid dupes).
implemented.