FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[WIP] Add support for object keys, labels by MaximSokolov · Pull Request #307 · atom/language-javascript · GitHub

This repository was archived by the owner on Dec 15, 2022. It is now read-only.
/ language-javascript Public archive

[WIP] Add support for object keys, labels - #307

Open
MaximSokolov wants to merge 3 commits into
atom:masterfrom
MaximSokolov:support-for-object-keys
Open

MaximSokolov wants to merge 3 commits into
atom:masterfrom
MaximSokolov:support-for-object-keys

Conversation

Copy link
Copy Markdown
Contributor
label:

switch (foo())
{
    case 'string':
    case a:
    case a + b:
    case foo(bar):
    case CON$TANT:
    case 123:
      foo(bar)
      break;
    default:
}

? a : b
? "abc" : "abc"
? (a.b(123)) : (b("c"))
? {key: value} : b
? this : null
? 'a'.b(':c(d)') :

obj = {
  key: value,
  $abc$: value,
  'key': 'value',
  KEY: VALUE
}

obj1 = {
  name: function (){},
  'name': function (){},
  "name": function(){}
}

obj2 = {
  null: 'abc',
  module: 'abc',
  this: 'abc',
  class: 'abc',
  NaN: 'abc'
}
atom-text-editor::shadow .source.js {
  .meta.object-key {
    // * {}

    .variable {}

    .constant.numeric {}

    .string {}

    .constant.other {}
  }

  .meta.function {
    .meta.object-key {
      .entity.name.function, .string {}
    }
  }
}

Copy link
Copy Markdown
Contributor

I mean, this does seem to clear up some of the regexes. The case/default stuff is definitely something that can be improved though, and may also allow us to match labels correctly. Can you try putting that in a separate repository (maybe 'include': '#switch-case'), and only call that when we hit a switch statement?

Copy link
Copy Markdown
Contributor Author

Objects literals inside ternary expression fixed by using begin/end matching for curly brackets. Looking for the following word in key pattern allows to match labels properly. The case/default moved to a switch_statement repo.

MaximSokolov changed the title [WIP] Add support for object keys [WIP] Add support for object keys, labels Jan 21, 2016

Copy link
Copy Markdown
Contributor

@MaximSokolov So is this ready for review, or are there more edge cases that need to be addressed?

Copy link
Copy Markdown
Contributor Author

It's ready for review. However PR brings highlighting changes, so I want to add before/after info and steps to change colors before merging

Comment thread grammars/javascript.cson

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can't this be (\\basync\\b)? instead?

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants


Back | FazBrowse Home | New Git URL