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

Commit

Permalink
✅ Add specs
Browse files Browse the repository at this point in the history
In addition, make sure comments are captured properly
  • Loading branch information
winstliu committed Aug 2, 2015
1 parent f4728be commit e7065c4
Show file tree
Hide file tree
Showing 4 changed files with 252 additions and 103 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ notifications:
on_failure: change

script: 'curl -s https://raw.githubusercontent.com/atom/ci/master/build-package.sh | sh'

branches:
only:
- master
95 changes: 75 additions & 20 deletions grammars/javascript.cson
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@
]
}
{
<<<<<<< HEAD
'begin': '^\\s*(?=@\\s*[A-Za-z_][A-Za-z0-9_]*(?:\\.[a-zA-Z_][a-zA-Z_0-9]*)*\\s*\\()'
'end': '(\\))'
'endCaptures':
Expand All @@ -285,6 +286,9 @@
{
'include': '#function-params'
}
{
'include': '#comments'
}
{
'include': '$self'
}
Expand All @@ -294,16 +298,38 @@
}
{
'begin': '^\\s*(?=@\\s*[A-Za-z_][A-Za-z0-9_]*(?:\\.[a-zA-Z_][a-zA-Z_0-9]*)*)'
'contentName': 'entity.name.function.decorator.js'
'end': '(?=\\s|$\\n?|#)'
'name': 'meta.function.decorator.js'
'contentName': 'entity.name.function.annotation.js'
'end': '(?=\\s|$\\n?|//)'
'name': 'meta.function.annotation.js'
'patterns': [
{
'begin': '(?=(@)\\s*[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)*)'
'beginCaptures':
'1':
'name': 'punctuation.definition.decorator.js'
'end': '(?=\\s|$\\n?|#)'
'name': 'punctuation.definition.annotation.js'
'end': '(?=\\s|$\\n?|//)'
'patterns': [
{
'include': '#comments'
}
]
}
]
}
{
'begin': '\\b(constructor)\\s*(\\()'
'beginCaptures':
'1':
'name': 'entity.name.constructor.js'
'2':
'name': 'punctuation.definition.parameters.begin.js'
'end': '(\\))'
'endCaptures':
'1':
'name': 'punctuation.definition.parameters.end.js'
'patterns': [
{
'include': '#function-params'
}
]
}
Expand Down Expand Up @@ -364,8 +390,7 @@
'name': 'support.function.js.console'
}
{
'match': '\\b((0(x|X)[0-9a-fA-F]+)|(0(b|B)[01]+)|(0(o|O)[0-7]+)|([0-9]+(\\.[0-9]+)?)((e|E)[+-]?[0-9]+)?)\\b'
'name': 'constant.numeric.js'
'include': '#numbers'
}
{
'include': '#strings'
Expand Down Expand Up @@ -412,14 +437,16 @@
'name': 'storage.modifier.js'
}
{
'begin': '(?<!\\.)\\b(const)(?!\\s*:)\\b\\s+'
'begin': '(?<!\\.)\\b(const)(?!\\s*:)\\b'
'beginCaptures':
'1':
'name': 'storage.modifier.js'
'end': '(=)'
'end': '(=|of|in)|(;)|(?<!,)\\n'
'endCaptures':
'1':
'name': 'keyword.operator.js'
'2':
'name': 'punctuation.terminator.statement.js'
'patterns': [
{
'match': '([$_a-zA-Z][$_a-zA-Z0-9]*)\\s*(:)\\s*([$_a-zA-Z][$_a-zA-Z0-9]*)?'
Expand All @@ -443,6 +470,10 @@
'match': ','
'name': 'meta.delimiter.object.comma.js'
}
{
'match': '\\(|\\)'
'name': 'meta.brace.round.js'
}
{
'match': '\\{|\\}'
'name': 'meta.brace.curly.js'
Expand All @@ -451,9 +482,6 @@
'match': '\\[|\\]'
'name': 'meta.brace.square.js'
}
{
'match': '\\s+'
}
]
}
{
Expand Down Expand Up @@ -601,6 +629,13 @@
}
]
'repository':
'numbers':
'patterns': [
{
'match': '(\\+|\\-)?\\b((0(x|X)[0-9a-fA-F]+)|(0(b|B)[01]+)|(0(o|O)[0-7]+)|([0-9]+(\\.[0-9]+)?)((e|E)[+-]?[0-9]+)?)\\b'
'name': 'constant.numeric.js'
}
]
'strings':
'patterns': [
{
Expand Down Expand Up @@ -689,18 +724,38 @@
'function-params':
'patterns': [
{
'begin': '(?=[\\p{L}\\p{Nl}$_])'
'end': '(?=[,)\\/])'
'patterns': [
{
'match': '\\G[\\p{L}\\p{Nl}$_][\\p{L}\\p{Nl}$\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\x{200C}\\x{200D}]*'
'name': 'variable.parameter.function.js'
}
]
'include': '#numbers'
}
{
'include': '#strings'
}
{
'match': '\\(|\\)'
'name': 'meta.brace.round.js'
}
{
'match': '\\[|\\]'
'name': 'meta.brace.square.js'
}
{
'match': '\\{|\\}'
'name': 'meta.brace.curly.js'
}
{
'match': ','
'name': 'meta.object.delimiter.js'
}
{
'match': '='
'name': 'keyword.operator.js'
}
{
'include': '#comments'
}
{
'match': '[a-zA-Z_$][a-zA-Z_$0-9]*'
'name': 'variable.parameter.function.js'
}
]
'interpolated_js':
'patterns': [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "language-javascript",
"version": "0.84.0",
"version": "0.86.0",
"description": "JavaScript language support in Atom",
"engines": {
"atom": "*",
Expand Down
Loading

0 comments on commit e7065c4

Please sign in to comment.