Advise for syntax highlighting

Chris via Digitalmars-d digitalmars-d at puremagic.com
Fri Mar 27 05:33:54 PDT 2015


On Friday, 27 March 2015 at 10:34:58 UTC, Jacob Carlborg wrote:
> I'm currently updating the TextMate D bundle for D2. I have a 
> couple of questions for how to highlighting some specific code 
> or how other editors/IDE's highlight them.
>
> * "this" in constructor
>
> this () {}
>
> In TextMate functions/methods are highlighted, should this be 
> highlighted as a keyword or as a method?
>
> * "this" in copy constructor
>
> this (this) {}
>
> The "this" parameter, should that be highlighted as a keyword 
> or as a parameter?
>
> * The "__ctfe" variable
>
> if (__ctfe) {}
>
> How should this highlighted? I see a couple of alternatives:
>
> - not at all
> - as a keyword
> - as a special recognized built-in symbol, similar to __LINE__
> - as a special recognized library symbol. For example, in the C 
> bundle many of functions in the standard library are specially 
> recognized and highlighted differently. This might not apply 
> here since it's not a library symbol
>
> * __traits identifiers
>
> __traits(allMembers, Foo);
>
> In this case "allMembers". Basically the same question and 
> alternatives as for the "__ctfe" variable.
>
> * Predefined version identifiers
>
> version (OSX) {}
>
> Again, same a question and alternatives as for the "__ctfe" 
> variable.
>
> * Extern identifiers
>
> extern (C)
>
> Again, same a question and alternatives as for the "__ctfe" 
> variable.

Am using Textadept, the highlighting is as follows:

highlighted as keyword:
this()
__traits
extern(C) // The "extern"; "C" isn't highlighted at all

highlighted as a special recognized built-in symbol, similar to 
__LINE__:
version(OSX)  // the OSX; "version" is highlighted as keyword

not highlighted at all:
__ctfe


More information about the Digitalmars-d mailing list