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

Commit 76f197a

Browse files
committed
Make sure the function name is valid
1 parent adc0537 commit 76f197a

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

grammars/javascript.cson

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -626,18 +626,13 @@
626626
'end': '(?!\\G)'
627627
'patterns': [
628628
{
629-
'begin': '\\b(\\.)(assert|clear|debug|error|info|log|profile|profileEnd|time|timeEnd|warn)\\s*(\\()'
629+
'begin': '\\b(\\.)(assert|clear|debug|error|info|log|profile|profileEnd|time|timeEnd|warn)\\s*(?=\\()'
630630
'beginCaptures':
631631
'1':
632632
'name': 'meta.delimiter.method.period.js'
633633
'2':
634634
'name': 'support.function.console.js'
635-
'3':
636-
'name': 'punctuation.definition.arguments.begin.js'
637-
'end': '\\)'
638-
'endCaptures':
639-
'0':
640-
'name': 'punctuation.definition.arguments.end.js'
635+
'end': '(?<=\\))'
641636
'name': 'meta.method-call.js'
642637
'patterns': [
643638
{
@@ -1180,14 +1175,26 @@
11801175
'arguments':
11811176
'patterns': [
11821177
{
1183-
'include': '$self'
1178+
'begin': '\\('
1179+
'beginCaptures':
1180+
'0':
1181+
'name': 'punctuation.definition.arguments.begin.js'
1182+
'end': '\\)'
1183+
'endCaptures':
1184+
'0':
1185+
'name': 'punctuation.definition.arguments.end.js'
1186+
'patterns': [
1187+
{
1188+
'include': '$self'
1189+
}
1190+
]
11841191
}
11851192
]
11861193
'method_calls':
11871194
'patterns': [
11881195
{
11891196
# .methodCall(arg1, "arg2", [...])
1190-
'begin': '(\\.)([a-zA-Z_$][\\w$]*)\\s*(\\()'
1197+
'begin': '(\\.)([\\w$]+)\\s*(?=\\()'
11911198
'beginCaptures':
11921199
'1':
11931200
'name': 'meta.delimiter.method.period.js'
@@ -1246,16 +1253,15 @@
12461253
'name': 'support.function.dom.js'
12471254
}
12481255
{
1249-
'match': ".+"
1256+
'match': "[a-zA-Z_$][\\w$]*"
12501257
'name': 'entity.name.function.js'
12511258
}
1259+
{
1260+
'match': '[\\d][\\w$]*'
1261+
'name': 'invalid.illegal.identifier.js'
1262+
}
12521263
]
1253-
'3':
1254-
'name': 'punctuation.definition.arguments.begin.js'
1255-
'end': '\\)'
1256-
'endCaptures':
1257-
'0':
1258-
'name': 'punctuation.definition.arguments.end.js'
1264+
'end': '(?<=\\))'
12591265
'name': 'meta.method-call.js'
12601266
'patterns': [
12611267
{
@@ -1268,11 +1274,9 @@
12681274
'patterns': [
12691275
{
12701276
# functionCall(arg1, "arg2", [...])
1271-
'begin': '(?:(\\d\\w*)|([a-zA-Z_$][\\w$]*))\\s*(\\()'
1277+
'begin': '([\\w$]+)\\s*(?=\\()'
12721278
'beginCaptures':
12731279
'1':
1274-
'name': 'invalid.illegal.identifier.js'
1275-
'2':
12761280
'patterns': [
12771281
{
12781282
'match': '''(?x)
@@ -1283,16 +1287,15 @@
12831287
'name': 'support.function.js'
12841288
}
12851289
{
1286-
'match': ".+"
1290+
'match': "[a-zA-Z_$][\\w$]*"
12871291
'name': 'entity.name.function.js'
12881292
}
1293+
{
1294+
'match': '[\\d][\\w$]*'
1295+
'name': 'invalid.illegal.identifier.js'
1296+
}
12891297
]
1290-
'3':
1291-
'name': 'punctuation.definition.arguments.begin.js'
1292-
'end': '\\)'
1293-
'endCaptures':
1294-
'0':
1295-
'name': 'punctuation.definition.arguments.end.js'
1298+
'end': '(?<=\\))'
12961299
'name': 'meta.function-call.js'
12971300
'patterns': [
12981301
{

0 commit comments

Comments
 (0)