diff --git a/CoffeeScript.sublime-syntax b/CoffeeScript.sublime-syntax index 094d41c..7107b67 100644 --- a/CoffeeScript.sublime-syntax +++ b/CoffeeScript.sublime-syntax @@ -148,8 +148,8 @@ contexts: - match: (?=\() branch_point: anonymous branch: - - anonymous-parameter-list - group + - anonymous-parameter-list # named functions - match: (?=(?:(?!and=|or=)|@){{identifier}}\s*[:=][^>]) branch_point: function @@ -173,13 +173,23 @@ contexts: - match: '[=-]>' scope: meta.function.coffee keyword.declaration.function.coffee pop: 1 - - match: (?=\S) - fail: anonymous group: - match: \( scope: punctuation.section.group.begin.coffee - pop: 1 + set: group-body + + group-body: + - meta_scope: meta.group.coffee + - match: \) + scope: punctuation.section.group.end.coffee + set: group-check + - include: expressions + + group-check: + - match: (?=[=-]>) + fail: anonymous + - include: else-pop function-name: - meta_include_prototype: false diff --git a/tests/syntax_test_scope.coffee b/tests/syntax_test_scope.coffee index a70c2dd..131bc80 100644 --- a/tests/syntax_test_scope.coffee +++ b/tests/syntax_test_scope.coffee @@ -267,6 +267,16 @@ class App.Router extends Snakeskin.Router -> # ^^ keyword.declaration.function.coffee + (a : "group") +# ^^^^^^^^^^^^^ meta.group.coffee +# ^ punctuation.section.group.begin.coffee +# ^ variable.other.readwrite.coffee +# ^ keyword.operator.assignment.coffee +# ^^^^^^^ meta.string.coffee string.quoted.double.coffee +# ^ punctuation.definition.string.begin.coffee +# ^ punctuation.definition.string.end.coffee +# ^ punctuation.section.group.end.coffee + geometry = new Class(); # ^^^^^^^^ variable.other.readwrite.coffee # ^ keyword.operator.assignment.coffee