[Mono-dev] Revamped Syntax Highlighting System

Mike Krüger mkrueger at xamarin.com
Sat Apr 27 14:06:19 UTC 2013


Hi

I went through the code related to syntax highlighting and semantic
> highlighting. Got to know how syntax highlighting happens using <Begin>,
> <End> and <Word> constructs written in XML file. But had little difficulty
> understanding the semantic highlighting.
>
>
CSharpSyntaxMode.cs - but it basically uses the one in NRefactory which is
a kind of code analysis.


>   Syntax highlighting : As soon as the word is entered, it will be matched
> by suitable regular expression.
>

Y It's possible to use regexes for that - but try to make some speed
measuers for it. If you want you can alter/extend the XML grammar.

  Semantic highlighting : Another thread will be running asynchronously and
> parses the words together to give semantic meaning, [ a suitable efficient
> parser has to be written for this]
>
>
That's how it's done - but an API would be nice for that. C# semantic
highlighting is implemented, but an API for that would be better. That part
isn't hard to implement but requires understanding of what I do there :)


> I've pretty good knowledge about parsers, regular expression and I had
> implemented LALR parser as mini-project last semester. [ Github link<https://github.com/akshayhebbarys/lalr-parser>
>  ]
>
> Please tell me whether I'm going in right path, and please guide me
> through this project.
>
>
Y the direction is good - if you can base all on regular expressions not
much can go wrong - but make speed tests. One thing that is important is
that the highlighter is lazy. Atm there is a highlighter background thread
I would like to get rid of that. Or at least make a task based approach.

The spans are atm written in the line splitter - they should use a own tree
- that saves some memory & should be faster.

Regards
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20130427/6dcbff93/attachment.html>


More information about the Mono-devel-list mailing list