b-g / processing-sublime

A Sublime Text package for the programming language Processing
MIT License
447 stars 60 forks source link

add a separate case for enum definitions #100

Closed kylefleming closed 9 years ago

kylefleming commented 9 years ago

Addresses #99

Basically the problem is that an uppercase constructor is treated like an enum definition because definitions of type class, enum, and interface are all treated the same inside the body of the definition.

Example 13 here gives an example of what the syntax highlighter is looking for when it looks for an enum definition.

To fix this issue, I separated out class and enum definitions. The code is almost the same, class is just missing the 1 cases that looks for that uppercase definition.

Here is a side by side:

Before: screen shot 2015-11-12 at 3 02 20 pm After: screen shot 2015-11-12 at 3 02 05 pm

There would still be an issue if you had an enum whose name was uppercase like so:

enum TEST {
    TEST1, TEST2;
    TEST(int value) {}
}

But I believe this to be a very rare case not worth worrying about

ybakos commented 9 years ago

Dude, awesome.

b-g commented 9 years ago

Merged

@kylefleming Many thanks for the quick fix!! Could you also have a look here: https://github.com/b-g/processing-sublime/issues/92, this is another open small syntax highlight issue.