Advise for syntax highlighting

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Fri Mar 27 08:04:17 PDT 2015


Personal preferences:

> * "this" in constructor
>
> this () {}
>
> In TextMate functions/methods are highlighted, should this be 
> highlighted as a keyword or as a method?

method

> * "this" in copy constructor
>
> this (this) {}
>
> The "this" parameter, should that be highlighted as a keyword 
> or as a parameter?

keyword (because, well, it is not 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

not at all. The fact it is reserved is already denoted by __, 
otherwise it is just another vairable/symbol.

> * __traits identifiers
>
> __traits(allMembers, Foo);
>
> In this case "allMembers". Basically the same question and 
> alternatives as for the "__ctfe" variable.

this is different from __ctfe as it is actual compiler built-in 
with special semantics. "special recognized built-in symbol" is 
probably best fit as it is not listed as keyword either.

> * Predefined version identifiers
>
> version (OSX) {}
>
> Again, same a question and alternatives as for the "__ctfe" 
> variable.

"special recognized built-in symbol"

> * Extern identifiers
>
> extern (C)
>
> Again, same a question and alternatives as for the "__ctfe" 
> variable.

"special recognized built-in symbol"


More information about the Digitalmars-d mailing list