Skip to content

Commit

Permalink
Fixed anonymous functions not pushing to code scope
Browse files Browse the repository at this point in the history
  • Loading branch information
codecat committed Dec 12, 2019
1 parent 52409a4 commit c4f33bc
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
18 changes: 18 additions & 0 deletions AngelScript.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
12 changes: 12 additions & 0 deletions syntax_test_stuff.as
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c4f33bc

Please sign in to comment.