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

Add operators subscopes #225

Merged
merged 18 commits into from
Nov 4, 2015
Merged

Add operators subscopes #225

merged 18 commits into from
Nov 4, 2015

Conversation

MaximSokolov
Copy link
Contributor

Closes #188
Supersedes and closes #222

It's not correct for some cases: Has been reverted

// ':' isn't `keyword.operator.conditional.ternary`
var obj = { a: "b"}
// e.g. '+' operator can be used for concatenation
// it's `keyword.operator.arithmetic`
"str1" + "str2"
var1 + var2

@@ -461,7 +463,7 @@
}
{
'match': '(?<!\\.)\\b(delete|in|of|instanceof|new|typeof|void)(?!\\s*:)\\b'
'name': 'keyword.operator.js'
'name': 'keyword.operator.$1.js'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can I have your reasoning behind this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It makes possible to change highlighting for each of these operators.

@MaximSokolov
Copy link
Contributor Author

Changed:

  • Revert ?, : to keyword.operator
  • keyword.operator.assignment for : (when it is assignment of course)

augmented sounds really weird to me :/
Anyone have suggestions for a different name?

Python, Ruby use assignment.augmented I guess it means assignment augmented by another operator.

@MaximSokolov
Copy link
Contributor Author

Should I revert 'keyword.operator.arithmetic' -> 'keyword.operator' for *, /, -, %, + operators?

@Victorystick
Copy link
Contributor

@MaximSokolov That sounds like a good idea. We can't be sure that a + is used for arithmetic or concatenation. :)

@winstliu
Copy link
Contributor

winstliu commented Nov 1, 2015

@MaximSokolov I'd suggest to change it as well.

@MaximSokolov
Copy link
Contributor Author

Is keyword.operator.assignment.compound ok for %=, +=, -=, *= ... ?
(instead of ...assignment.augmented)

@winstliu
Copy link
Contributor

winstliu commented Nov 1, 2015

Sounds better to me 😆.
/cc @atom/feedback

@mehcode
Copy link

mehcode commented Nov 1, 2015

As a (self proclaimed) language designer, compound is more correct (as you are joining two distinct operators into a new operator, now composed of two parts). People started calling it augmented with scripting languages (C, Java, etc. always called it compound).

'name': 'keyword.operator.bitwise.js'
}
{
'match': '\\?|\\:'
Copy link
Contributor

Choose a reason for hiding this comment

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

: doesn't need to be escaped

'name': 'keyword.operator.assignment.js'
}
{
'match': '\\-\\-'
Copy link
Contributor

Choose a reason for hiding this comment

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

-- doesn't need to be escaped

@@ -857,8 +859,43 @@
'operators':
'patterns': [
{
'match': '!=|!==|<=|>=|<<=|>>=|>>>=|\\*=|(?<!\\()/=|%=|\\+=|\\-=|&=|\\^=|!|%|&|\\*|/|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|<>|<|>|!|&&|\\|\\||\\?|\\:|\\^'
'comment': 'match 2-character operator first'
'match': '%=|\\+=|\\-=|\\*=|(?<!\\()/='
Copy link
Contributor

Choose a reason for hiding this comment

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

Final nit: The - here doesn't need to be escaped either.

winstliu pushed a commit that referenced this pull request Nov 4, 2015
@winstliu winstliu merged commit 8ffbb11 into atom:master Nov 4, 2015
@winstliu
Copy link
Contributor

winstliu commented Nov 4, 2015

Woo!

@MaximSokolov MaximSokolov deleted the add-operators-subscopes branch November 4, 2015 13:46
@smaili
Copy link

smaili commented Nov 4, 2015

👍

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.

Distinguishing from comparison operators
5 participants