[Monodevelop-devel] Creating SyntaxMode without regular expressions?

Mike Krüger mkrueger at novell.com
Thu Oct 21 02:00:37 EDT 2010


Hi

If you really want to make a complex syntax highlighting you need to 
write a highlighter in c#.

See:
main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSyntaxMode.cs

btw. you could create a custom chunk parser as well as a custom span parser.

Regards
Mike
> Hi,
> I have been working on MonoDevelop language binding for F# and I have
> one question regarding colorization (the SyntaxMode class). Creating
> XML based syntax mode is quite easy, so I'm using that for now, but
> there are a few things that would need to be improved (e.g. F# allows
> you to have nested multi-line comments and I'd like to eventually
> implement support for #if, etc.)
>
> The F# compiler exposes a very simple tokenizer that I could use - you
> give it a line from the source file and it parses the line returning a
> sequence of tokens (with location, color information and other
> possibly useful things). I was wondering if I could just implement
> SyntaxMode by calling the F# tokenizer, but I don't see any way of
> creating SyntaxMode that would just return e.g. a list with starting
> and ending colum&  color for each line.
>
> I found some syntax modes that create custom SpanParser which returns
> stack of Span objects, but that still marks the start/end of a span
> using Regex. Is there a more direct way of providing colorization?
>
> Thanks!
> Tomas Petricek
> _______________________________________________
> Monodevelop-devel-list mailing list
> Monodevelop-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monodevelop-devel-list



More information about the Monodevelop-devel-list mailing list