Bug 432735

Summary: Incorrect highlighting for context-sensitive keywords (from, where, get, select...)
Product: [Mono] MonoDevelop Reporter: Marek Safar <msafar>
Component: texteditorAssignee: Mike Krueger <mkrueger>
Status: RESOLVED FIXED QA Contact: MD Bugs <monodevelop-bugs>
Severity: Enhancement    
Priority: P5 - None CC: andreventuravale
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Marek Safar 2008-10-06 18:44:41 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;
Comment 1 Mike Krueger 2008-10-07 08:43:58 UTC
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.
Comment 2 Marek Safar 2008-10-07 08:54:43 UTC
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.
Comment 3 Mike Krueger 2008-10-07 14:36:46 UTC
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)
Comment 4 Michael Hutchinson 2008-10-07 16:41:43 UTC
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
Comment 5 Mike Krueger 2008-10-08 07:48:37 UTC
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;

  }
}
Comment 6 Mike Krueger 2008-10-08 07:55:59 UTC
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.
Comment 7 Mike Krueger 2009-09-09 17:39:21 UTC
*** Bug 537801 has been marked as a duplicate of this bug. ***
Comment 8 Mike Krueger 2009-09-18 19:26:29 UTC
*** Bug 540298 has been marked as a duplicate of this bug. ***
Comment 9 Andres Aragoneses 2009-09-21 14:16:13 UTC
Changing summary to make the bug more searchable (to avoid dupes).
Comment 10 Mike Krueger 2011-05-23 07:30:11 UTC
implemented.