From c4f33bc583e21f49761992660f8403606922da66 Mon Sep 17 00:00:00 2001 From: Melissa Geels Date: Thu, 12 Dec 2019 12:14:04 +0100 Subject: [PATCH] Fixed anonymous functions not pushing to code scope --- AngelScript.sublime-syntax | 18 ++++++++++++++++++ syntax_test_stuff.as | 12 ++++++++++++ 2 files changed, 30 insertions(+) diff --git a/AngelScript.sublime-syntax b/AngelScript.sublime-syntax index 4549ee1..9d49d3d 100644 --- a/AngelScript.sublime-syntax +++ b/AngelScript.sublime-syntax @@ -260,6 +260,24 @@ contexts: - match: '\b{{operators_words}}\b' scope: keyword.operator.word + - match: '\b(function)(?=\()' + scope: storage.type.function + push: + - include: global + - match: '\(' + scope: punctuation.section.parens.begin + push: + - match: '{{identifier}}' + scope: variable.parameter + - match: ',' + scope: punctuation.separator + - match: '\)' + scope: punctuation.section.parens.end + pop: true + - match: '{' + scope: punctuation.section.block.begin + set: code-scope + - include: expression-has-functioncall - match: '\b{{number}}\b' diff --git a/syntax_test_stuff.as b/syntax_test_stuff.as index 006221e..8e5df43 100644 --- a/syntax_test_stuff.as +++ b/syntax_test_stuff.as @@ -139,6 +139,18 @@ void bitstuff() this.x = 1; // <- variable.language + r.sort(function(a, b) { return true; }); + // ^^^^^^^^ storage.type.function + // ^ punctuation.section.parens.begin + // ^ variable.parameter + // ^ punctuation.separator + // ^ variable.parameter + // ^ punctuation.section.parens.end + // ^ punctuation.section.block.begin + // ^ punctuation.section.block.end + // ^ punctuation.section.parens.end + // ^ punctuation.terminator + for (uint i = 0; i < m_skills.length(); i++) stuff(); // <- entity.name.function