amehat / atom-language-d

plugins and themes for Atom
Other
16 stars 6 forks source link

Several storage types, keywords and primitives missing. #2

Open ysgard opened 10 years ago

ysgard commented 10 years ago

Storage: in out inout immutable pure impure nothrow const auto cast export shared ref @property Type/OO identification: typeid typeof this override virtual interface Primitives: string ubyte ushort uint ulong real wchar dchar wstring dstring enum union struct Testing: unittest debug enforce assert Statements/functions: foreach with asm mixin template scope Modules: module package version deprecated @safe @system @trusted

assert and some of the other keywords loses its keyword highlighting and adopts function highlighting as soon as you use parentheses, it should retain its keyword highlighting as they are base constructs of the language.

jameslzhu commented 9 years ago

In its current state a lot of the code hasn't been properly ported from the language-java repo, hence the missing keywords. I'll see what I can cook up within the next few months.

amehat commented 9 years ago

Indeed, the basic idea was to prompt a support language D Atom , which is why I used Java as reference. It is now necessary to develop it so that it fully corresponds to D.

jameslzhu commented 9 years ago

As per the spec, the keywords impure and virtual don't exist in D.

jameslzhu commented 9 years ago

The state of implementation so far:

Keywords

Testing:

Statements/functions:

Modules:

ghost commented 9 years ago

Another missing keyword is synchronized:

synchronized
{
   // Everything in this block will be synchronized
}

// Without braces...
synchronized if (some_condition)
   do_something();

// As modifier for variables...
synchronized this.some_variable = true;

It used to cause problems with syntax highlighting, that seems to be fixed in the latest release (3.2.1), but I think it's not marked as keyword.

luke5542 commented 9 years ago

I don't see the body keyword in that list either, and I have noticed some highlighting errors related to its use, or lack of use to be more accurate.

For example, in an interface where you want to add contracting to a method, leaving out the body section, as you are supposed to, leaves the rest of the file unhighlighted.

interface MyInterface {
    double fun(double arg1)
    in {
        assert(some_pre_condition);
    }
    out {
        assert(some_post_condition);
    }
    // Normal functions would have a body {...} here as well,
    // but right now the rest of the file goes unhighlighted.
}