Skip to content

Commit

Permalink
Add short function definition syntax
Browse files Browse the repository at this point in the history
The short function definition syntax was introduced with DMD 2.101.0 and replaces an ordinary block statement function body with a lambda-like construct (`int foo(int x) => x + 1;`).
  • Loading branch information
s-ludwig authored Dec 9, 2023
1 parent 65dde23 commit 54888b9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions D/D.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,8 @@ contexts:
function-definition-after-arguments:
- meta_scope: meta.function.d
- include: function-attribute-in
- match: '=>'
set: [expect-end-of-line, value]
- match: '='
scope: keyword.operator.assignment.d
set: [meta-function, expect-end-of-line, value]
Expand All @@ -925,6 +927,8 @@ contexts:
- match: '(?=\S)'
set: [meta-function, function-definition-after-condition]
function-definition-after-condition:
- match: '=>'
set: [expect-end-of-line, value]
- match: '\bin\b'
scope: keyword.control.conditional.d
set:
Expand Down

0 comments on commit 54888b9

Please sign in to comment.