Bug 432735 - Incorrect highlighting for context-sensitive keywords (from, where, get, select...)
Summary: Incorrect highlighting for context-sensitive keywords (from, where, get, sele...
Status: RESOLVED FIXED
: 537801 540298 (view as bug list)
Alias: None
Product: MonoDevelop
Classification: Mono
Component: texteditor (show other bugs)
Version: unspecified
Hardware: Other Other
: P5 - None : Enhancement
Target Milestone: ---
Assignee: Mike Krueger
QA Contact: MD Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-06 18:44 UTC by Marek Safar
Modified: 2011-05-23 07:30 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.