So I have the following code sample:
function "mod"(Left : Float; Right : Float) return Float with Inline, Pre
=> Right /= 0.0;
"mod" is obviously a string. Highlighting for this is easy.
Types (float here) I'll deal with later.
"function", "return", and "with" are keywords.
The "with Inline, Pre => Right /= 0.0" part is an aspect declaration. This is
also currently where I'm having problems.
If I completely ignore trying to highlight the aspects, highlighting the
keyword "with" is easy. Of course, highlighting "Inline" and "Pre" as keywords
would be an easy, but flawed solution, as they would highlight anywhere, even
though they are valid identifiers elsewhere. As such, they should only be
highlighted as aspects in this context.
I'm currently using the following definition in .lang:
<context id="aspect-directive"> <start>with</start>
<end>(is|;)</end> <include> <context id="aspect-keyword"
style-ref="keyword" extend-parent="false"> <keyword>with</keyword>
<keyword>is</keyword> </context> <context id="aspect-name"
style-ref="aspect" extend-parent="false"> <keyword>address</keyword>
... ... </context> </include> </context>
The ordering of the language context is:
<context ref="aspect-directive"/> <context ref="keyword"/>
This causes "Pre" and "Inline" to highlight properly, but removes the
highlighting of "with".
Chaning the ordering to:
<context ref="keyword"/> <context ref="aspect-directive"/>
causes "with" to highlight properly, but removes the highlighting of "Pre" and
"Inline".
How do I get this working properly? _______________________________________________
gnome-devtools mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gnome-devtools