Syntax highlighting spans where the end condition depends on the begin condition #330
-
Hi, I'm using AvalonEdit for a Lua editor. I want to properly highlight multiline comments, but the end condition can depend on the begining condition. I've tried using a span like so:
but this does not work. Is it possible to use a group captured in the "begin" in the "end"? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The grammar you are working with is too complex for regular expressions. You will have to implement your own lexer-based highlighting based on See https://github.com/icsharpcode/SharpDevelop/blob/master/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpSemanticHighlighter.cs for an example of a semantic highlighter for C#. Hope this helps! |
Beta Was this translation helpful? Give feedback.
The grammar you are working with is too complex for regular expressions. You will have to implement your own lexer-based highlighting based on
IHighlighter
.See https://github.com/icsharpcode/SharpDevelop/blob/master/src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpSemanticHighlighter.cs for an example of a semantic highlighter for C#.
Hope this helps!