[Monodevelop-devel] Creating SyntaxMode without regular expressions?

Tomas Petricek tomas.petricek at gmail.com
Wed Oct 20 08:30:54 EDT 2010


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


More information about the Monodevelop-devel-list mailing list