Suppose I want to highlight property names in EntityLang different from other identifiers.
This should be possible using the following grammar:

PropertyName ":" Type -> Property {cons("Property")}
ID -> PropertyName    %% indirection for coloring

And the following coloring rule:

PropertyName : 0 0 255 italic

This has no effect, while it would be expected that property names become blue/italic.

As a workaround, a constructor can be added to the injection:

ID -> PropertyName {cons("X")}   %% indirection for coloring

In this case the coloring works fine. (And the X node in the AST can be desugared away.)

The same thing happens with the outliner: without constructor, properties do not show up in the outline view when PropertyName is added to the outliner, while with constructor, properties do show up.

(I vaguely recall there is a FIXME in the code somewhere about this already?)

This is with Spoofax version 0.6.1.4-r23144.

Submitted by Tobi Vollebregt on 1 September 2011 at 14:22

On 8 January 2013 at 14:56 Eelco Visser tagged esv

On 8 January 2013 at 14:56 Eelco Visser tagged coloring

Log in to post comments