Skip to content

Commit fdf7579

Browse files
author
Wliu
authored
Merge pull request atom#482 from Alhadis/dotfix
Add support for namespaced default values
2 parents 31ec605 + 3722003 commit fdf7579

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

grammars/javascript.cson

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,10 +2062,10 @@
20622062
= # [foo=bar] Default parameter value
20632063
\\s*
20642064
(?:
2065-
[\\w$\\s]* | # [foo=bar] Unquoted
2066-
"[^"]*" | # [foo="bar"] Double-quoted
2067-
'[^']*' | # [foo='bar'] Single-quoted
2068-
{[^{}]*} | # [foo={a:1}] Object literal
2065+
[\\w$.\\s]* | # [foo=bar] Unquoted
2066+
"[^"]*" | # [foo="bar"] Double-quoted
2067+
'[^']*' | # [foo='bar'] Single-quoted
2068+
{[^{}]*} | # [foo={a:1}] Object literal
20692069
\\[ [^\\[\\]]* \\] # [foo=[1,2]] Array literal
20702070
)
20712071
)?

spec/javascript-spec.coffee

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,6 +1853,11 @@ describe "JavaScript grammar", ->
18531853
expect(tokens[6]).toEqual value: '[ variable = default value ]', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
18541854
expect(tokens[8]).toEqual value: 'this is the description ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'other.description.jsdoc']
18551855
1856+
{tokens} = grammar.tokenizeLine '/** @param {object} [variable=default.value] this is the description */'
1857+
expect(tokens[4]).toEqual value: '{object}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
1858+
expect(tokens[6]).toEqual value: '[variable=default.value]', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
1859+
expect(tokens[8]).toEqual value: 'this is the description ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'other.description.jsdoc']
1860+
18561861
{tokens} = grammar.tokenizeLine('/** @param {object} [variable="default value"] this is the description */')
18571862
expect(tokens[4]).toEqual value: '{object}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
18581863
expect(tokens[6]).toEqual value: '[variable="default value"]', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']

0 commit comments

Comments
 (0)