Re: Advise for syntax highlighting
On 2015-03-27 11:34, 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. What about #line? -- /Jacob Carlborg
Re: Advise for syntax highlighting
On Saturday, 28 March 2015 at 00:01:48 UTC, Jesse Phillips wrote: Probably should be Identifier for consistency [e.g. _arugments, __vptr, _ctor] Isn't __ctor just a DMD thing? I don't think we should be highlighting symbols which aren't guaranteed to even exist for a particular implementation.
Re: Advise for syntax highlighting
On 2015-03-28 01:01, Jesse Phillips wrote: Statement [e.g. debug, return, function, with] (that needs fixed) Not sure what you mean. Probably should be Identifier for consistency [e.g. _arugments, __vptr, _ctor] I completely forgot about these. Should these be the same as __ctfe? Which I guess is your third (special recognized built-in), though __LINE__ is a constant in Vim's highlighting [e.g. null, __VERSION__]. Yeah, both null and __LINE__ are constants in TextMate as well. I probably didn't use the correct name for describing it. * __traits identifiers __traits(allMembers, Foo); In this case "allMembers". Basically the same question and alternatives as for the "__ctfe" variable. Identifier Same as __LINE__ or? -- /Jacob Carlborg
Re: Advise for syntax highlighting
On Friday, 27 March 2015 at 15:23:56 UTC, Jacob Carlborg wrote: On 2015-03-27 16:04, Dicebot wrote: not at all. The fact it is reserved is already denoted by __, otherwise it is just another vairable/symbol. Doesn't this symbol also have special semantics? Not really. It has special value (true within ctfe, false in normal code generation) but otherwise it is just a normal variable.
Re: Advise for syntax highlighting
Vim is setup as: 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 () {} Keyword (function should be fine, vim doesn't highlight those) In TextMate functions/methods are highlighted, should this be highlighted as a keyword or as a method? * "this" in copy constructor this (this) {} Keyword 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 Statement [e.g. debug, return, function, with] (that needs fixed) Probably should be Identifier for consistency [e.g. _arugments, __vptr, _ctor] Which I guess is your third (special recognized built-in), though __LINE__ is a constant in Vim's highlighting [e.g. null, __VERSION__]. * __traits identifiers __traits(allMembers, Foo); In this case "allMembers". Basically the same question and alternatives as for the "__ctfe" variable. Identifier * Predefined version identifiers version (OSX) {} Again, same a question and alternatives as for the "__ctfe" variable. Identifier * Extern identifiers extern (C) Again, same a question and alternatives as for the "__ctfe" variable. Identifier
Re: Advise for syntax highlighting
On Friday, 27 March 2015 at 15:23:56 UTC, Jacob Carlborg wrote: On 2015-03-27 16:04, Dicebot wrote: not at all. The fact it is reserved is already denoted by __, otherwise it is just another vairable/symbol. Doesn't this symbol also have special semantics? A more pragmatical view would be: if(__ctf ... Was it __ctfe or __ctfe__? Easily answered if it has special highlighting.
Re: Advise for syntax highlighting
On 2015-03-27 16:04, Dicebot wrote: not at all. The fact it is reserved is already denoted by __, otherwise it is just another vairable/symbol. Doesn't this symbol also have special semantics? -- /Jacob Carlborg
Re: Advise for syntax highlighting
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"
Re: Advise for syntax highlighting
On 2015-03-27 13:33, Chris wrote: Am using Textadept, the highlighting is as follows: highlighted as keyword: this() Why is this highlighted as a keyword? I was more leaning to highlight it as a method. What about the parameter in a copy constructor? __traits What about the identifiers/keywords used as the first argument to "__traits"? -- /Jacob Carlborg
Re: Advise for syntax highlighting
On Friday, 27 March 2015 at 14:10:22 UTC, Jacob Carlborg wrote: On 2015-03-27 15:03, Chris wrote: Well, it _is_ a keyword. You cannot write a function called "this", nor can you use it as a variable name. So yes, it's a keyword = reserved. It depends on how you see it. It's also a special method that just happens to use a keyword as its name. It doesn't have the same meaning as "this" instead a regular method. Either way, it should be highlighted somehow.
Re: Advise for syntax highlighting
On Friday, 27 March 2015 at 13:58:03 UTC, Jacob Carlborg wrote: On 2015-03-27 13:33, Chris wrote: Am using Textadept, the highlighting is as follows: highlighted as keyword: this() Why is this highlighted as a keyword? I was more leaning to highlight it as a method. Well, it _is_ a keyword. You cannot write a function called "this", nor can you use it as a variable name. So yes, it's a keyword = reserved. What about the parameter in a copy constructor? __traits What about the identifiers/keywords used as the first argument to "__traits"? Not highlighted.
Re: Advise for syntax highlighting
On 2015-03-27 15:03, Chris wrote: Well, it _is_ a keyword. You cannot write a function called "this", nor can you use it as a variable name. So yes, it's a keyword = reserved. It depends on how you see it. It's also a special method that just happens to use a keyword as its name. It doesn't have the same meaning as "this" instead a regular method. -- /Jacob Carlborg
Re: Advise for syntax highlighting
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