Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

New variables structure #53

Merged
merged 2 commits into from
Jun 12, 2016
Merged

New variables structure #53

merged 2 commits into from
Jun 12, 2016

Conversation

noseglid
Copy link
Contributor

@noseglid noseglid commented Jun 10, 2016

Do not include storage modifiers in the variables matches
because it's not great to re-use them in code blocks in that
case.

This also made it possible to put #variables as an
include in #code, which removes the need for having
both #code and #variables in many blocks.

One difference here is that storage modifiers (private, final,
static, etc) will no longer be tagged with meta.definition.variable.java,
and it shouldn't be IMO. It's not part of the definition, but rather a modification to
a definition. Syntax highlighting remains the same.

This also fixes my comment in #47, but not #47 itself.

Fixes: #50

Do not include storage modifiers in the variables matches
because it's not great to re-use them in code blocks in that
case.

This also made it possible to put `#variables` as an
include in `#code`, which removes the need for having
both `#code` and `#variables` in many blocks.

Fixes: atom#50
'include': '#code'
}
]
'include': '#anonymous-block-and-instance-initializer'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No actual changes, just some splitting up code to make it more readable.

'applyEndPatternLast': 1
'begin': '''
(?x:(?=
(?:
Copy link
Contributor

@winstliu winstliu Jun 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're in a lookahead all the non-capturing groups aren't needed. We're not capturing anything anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right you are. Copied this from the previous definition, but might as well simplify!

@@ -999,50 +1001,54 @@
}
]
'variables':
'applyEndPatternLast': 1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this. To be frank, I don't know how It worked with it before, since ; is matched by #code which was included before too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surprisingly first-mate actually recognizes this. The super-sparse documentation seems to suggest that this only matters when the end patterns of a subpattern and the overarching end are exactly the same, but if everything already works, then no need to have it!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. In my manual tests it seems to work well, and the specs agrees.

@noseglid
Copy link
Contributor Author

noseglid commented Jun 12, 2016

NB. Added this to commit message

One difference here is that storage modifiers (private, final,
static, etc) will no longer be tagged with meta.definition.variable.java,
and it shouldn't be IMO. It's not part of the definition, but rather a modification to
a definition. Syntax highlighting remains the same.

@winstliu winstliu merged commit c668a1c into atom:master Jun 12, 2016
@winstliu
Copy link
Contributor

@winstliu
Copy link
Contributor

A multi-array variable still isn't highlighted correctly, eg private int stats[][];.

@noseglid
Copy link
Contributor Author

noseglid commented Jun 13, 2016

screen shot 2016-06-13 at 9 03 17 am

Looks okay to me... what do you mean?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Array variable declarations are not highlighted
2 participants