Skip to content

Commit

Permalink
chore: split functions section into sub-sections for user/built-ins
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-semenov committed Apr 22, 2024
1 parent 8a8c8d7 commit 70afa23
Showing 1 changed file with 39 additions and 34 deletions.
73 changes: 39 additions & 34 deletions src/functions.YAML-tmLanguage.j2
Original file line number Diff line number Diff line change
@@ -1,40 +1,45 @@
# yamllint disable rule:line-length
---
repository:
functions:
patterns:
-
# yamllint disable-line rule:line-length
match: '\b({{ scopes["entity.name.function"] | join("|") }})\b\s*(?={|\()'
captures:
1:
name: entity.name.function.builtins
-
# yamllint disable-line rule:line-length
match: '\b({{ scopes["constant.language"] | join("|") }})\b\s*(\(\)|\{\}|\(\{\}\)|\{\(\)\})?'
captures:
1:
name: constant.language
-
match: '\b({{ scopes["keyword.control"] | join("|") }})\b'
captures:
1:
name: keyword.control
-
# yamllint disable-line rule:line-length
match: '\.({{ scopes["entity.name.function.member"] | join("|") }})\b'
captures:
1:
name: entity.name.function.member.builtins
- include: "#builtins"
- include: "#user-defined"

-
match: '([[:alpha:]][[:alnum:]_]*)\b\s*(\(|\(\s*\{|\{\s*\()'
captures:
1:
name: entity.name.function.user
repository:
builtins:
patterns:
-
match: '\b({{ scopes["entity.name.function"] | join("|") }})\b\s*(?={|\()'
captures:
1:
name: entity.name.function.builtins
-
match: '\b({{ scopes["constant.language"] | join("|") }})\b\s*(\(\)|\{\}|\(\{\}\)|\{\(\)\})?'
captures:
1:
name: constant.language
-
match: '\b({{ scopes["keyword.control"] | join("|") }})\b'
captures:
1:
name: keyword.control
-
match: '\.({{ scopes["entity.name.function.member"] | join("|") }})\b'
captures:
1:
name: entity.name.function.member.builtins

-
# yamllint disable-line rule:line-length
match: '([[:alpha:]][[:alnum:]_]*)\b\s*=\s*\{?\s*(\([^\(]+\)|[[:alpha:]][[:alnum:]_]*)\s*-\s*>'
captures:
1:
name: entity.name.function.user.lambda
user-defined:
patterns:
-
match: '([[:alpha:]][[:alnum:]_]*)\b\s*(\(|\(\s*\{|\{\s*\()'
captures:
1:
name: entity.name.function.user

-
match: '([[:alpha:]][[:alnum:]_]*)\b\s*=\s*\{?\s*(\([^\(]+\)|[[:alpha:]][[:alnum:]_]*)\s*-\s*>'
captures:
1:
name: entity.name.function.user.lambda

0 comments on commit 70afa23

Please sign in to comment.