Skip to content

Commit a709895

Browse files
committed
Check that keywords aren't object keys
Add lookahead to make sure the keywords aren't following by a colon indicating that they are object keys which are allowed. Closes atom#21
1 parent 05d1db0 commit a709895

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

grammars/javascript.cson

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -285,39 +285,39 @@
285285
'name': 'comment.block.html.js'
286286
}
287287
{
288-
'match': '(?<!\\.)\\b(class|enum|function|interface|void)\\b'
288+
'match': '(?<!\\.)\\b(class|enum|function|interface|void)(?!\\s*:)\\b'
289289
'name': 'storage.type.js'
290290
}
291291
{
292-
'match': '(?<!\\.)\\b(const|export|extends|implements|let|private|protected|public|static|var)\\b'
292+
'match': '(?<!\\.)\\b(const|export|extends|implements|let|private|protected|public|static|var)(?!\\s*:)\\b'
293293
'name': 'storage.modifier.js'
294294
}
295295
{
296-
'match': '(?<!\\.)\\b(break|case|catch|continue|default|do|else|finally|for|if|import|package|return|switch|throw|try|while|yield)\\b'
296+
'match': '(?<!\\.)\\b(break|case|catch|continue|default|do|else|finally|for|if|import|package|return|switch|throw|try|while|yield)(?!\\s*:)\\b'
297297
'name': 'keyword.control.js'
298298
}
299299
{
300-
'match': '(?<!\\.)\\b(delete|in|instanceof|new|typeof|with)\\b'
300+
'match': '(?<!\\.)\\b(delete|in|instanceof|new|typeof|with)(?!\\s*:)\\b'
301301
'name': 'keyword.operator.js'
302302
}
303303
{
304-
'match': '(?<!\\.)\\btrue\\b'
304+
'match': '(?<!\\.)\\btrue(?!\\s*:)\\b'
305305
'name': 'constant.language.boolean.true.js'
306306
}
307307
{
308-
'match': '(?<!\\.)\\bfalse\\b'
308+
'match': '(?<!\\.)\\bfalse(?!\\s*:)\\b'
309309
'name': 'constant.language.boolean.false.js'
310310
}
311311
{
312-
'match': '(?<!\\.)\\bnull\\b'
312+
'match': '(?<!\\.)\\bnull(?!\\s*:)\\b'
313313
'name': 'constant.language.null.js'
314314
}
315315
{
316-
'match': '(?<!\\.)\\b(super|this)\\b'
316+
'match': '(?<!\\.)\\b(super|this)(?!\\s*:)\\b'
317317
'name': 'variable.language.js'
318318
}
319319
{
320-
'match': '(?<!\\.)\\b(debugger)\\b'
320+
'match': '(?<!\\.)\\b(debugger)(?!\\s*:)\\b'
321321
'name': 'keyword.other.js'
322322
}
323323
{

0 commit comments

Comments
 (0)