Skip to content

Commit

Permalink
chore: support meta-commands + add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-semenov committed May 3, 2024
1 parent 7429115 commit 3bb1121
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ $(BUILD_DIR)gp_types.tsv:
$(call get_gp_list,'Type','\\t',tail -n+2 |,)

$(BUILD_DIR)gp_support_commands.tsv:
$(call get_gp_list,'MetaCommand','?\\',tail -n+1 | cut -d'{' -f1 |,-I@ echo '\@')
$(call get_gp_list,'MetaCommand','?\\',tail -n+3 | cut -d'{' -f1 |,-I@ echo '\@')

GP_ITEMS := commands member_functions types support_commands
$(BUILD_DIR)gp_builtins.json: $(foreach item,$(GP_ITEMS),$(BUILD_DIR)gp_$(item).tsv)
Expand Down
1 change: 1 addition & 0 deletions src/main.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ repository:
- include: "#braces"
- include: "#brackets"
- include: "#functions"
- include: '#meta-commands'
- include: "#type-hints"
- include: "#literals"
- include: "#operators"
Expand Down
10 changes: 10 additions & 0 deletions src/support.YAML-tmLanguage.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# yamllint disable rule:line-length
---
repository:
meta-commands:
patterns:
-
match: '^\s*(##(?!\b)|#(?!\b)|\{{ scopes["support.function"] | join("|\\") }})'
captures:
1:
name: support.function.parigp
21 changes: 21 additions & 0 deletions tests/other.test.gp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## SYNTAX TEST "source.parigp" "Functions"

[(x) -> x, 1]
##^ source.parigp meta.brackets.parigp punctuation.section.brackets.begin.parigp
## ^ source.parigp meta.brackets.parigp meta.parens.parigp punctuation.section.parens.begin.parigp
## ^ source.parigp meta.brackets.parigp meta.parens.parigp variable.name.parigp
## ^ source.parigp meta.brackets.parigp meta.parens.parigp punctuation.section.parens.end.parigp
## ^ ^ ^ source.parigp meta.brackets.parigp constant.character.whitespace.parigp
## ^^ source.parigp meta.brackets.parigp keyword.operator.lambda
## ^ source.parigp meta.brackets.parigp variable.name.parigp
## ^ source.parigp meta.brackets.parigp markup.punctuation.separator.parigp
## ^ source.parigp meta.brackets.parigp constant.numeric.int.parigp
## ^ source.parigp meta.brackets.parigp punctuation.section.brackets.end.parigp

\q
##^^ source.parigp support.function.parigp

\w "output.txt"
##^^ source.parigp support.function.parigp
## ^ source.parigp constant.character.whitespace.parigp
## ^^^^^^^^^^^^ source.parigp constant.character.escape.parigp

0 comments on commit 3bb1121

Please sign in to comment.