Skip to content

Commit

Permalink
chore: update list of operators + enrich tests
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-semenov committed Apr 25, 2024
1 parent 35553be commit ba4e7bd
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/general.YAML-tmLanguage
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
repository:
general:
patterns:
-
match: '\b[[:alpha:]][[:alnum:]_]*'
name: variable.name
-
match: '[,;\.\[\]\(\)\{\}]'
name: markup.punctuation
-
match: '\s'
name: constant.character.whitespace
1 change: 1 addition & 0 deletions src/main.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ repository:
- include: "#functions"
- include: "#literals"
- include: "#operators"
- include: "#general"
scopeName: source.parigp
$schema: >-
https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json
5 changes: 4 additions & 1 deletion src/operators.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repository:
match: '(<=|>=|<|>)'
name: keyword.operator.comparison
-
match: '[^<>](=)'
match: '(=)'
name: keyword.operator.assignment
-
match: '(<<|>>)'
Expand All @@ -37,3 +37,6 @@ repository:
-
match: "(\\')"
name: keyword.operator.derivative
-
match: '(\#)\b'
name: keyword.operator.cardinality
15 changes: 15 additions & 0 deletions tests/functions.test.gp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@

Col([])
##^^^ source.parigp entity.name.function.builtins
## ^^^^ source.parigp markup.punctuation

x = Mod(4, 5);
##^ source.parigp variable.name
## ^ source.parigp keyword.operator.assignment
## ^^^ source.parigp entity.name.function.builtins
## ^ ^ ^^ source.parigp markup.punctuation
## ^ ^ source.parigp constant.numeric.int
x.mod
##^ source.parigp variable.name
## ^^^ source.parigp entity.name.function.member.builtins

ellinit([0, 0, 0, -1, 0]).b2
Expand All @@ -19,10 +26,18 @@
##^^^^^^^^^^ source.parigp entity.name.function.user
my(counts = vector(1+upper-lower));
## ^^ source.parigp keyword.control
## ^^^^^^ source.parigp variable.name
## ^^^^^^ source.parigp entity.name.function.builtins

for(i=1, #v, counts[1+v[i]-lower]++);
## ^^^ source.parigp keyword.control
## ^ ^ ^^^^^^ ^ ^ ^^^^^ source.parigp variable.name
## ^ source.parigp keyword.operator.assignment
## ^ ^ source.parigp constant.numeric.int
## ^ ^ ^ ^ ^ ^ ^ source.parigp markup.punctuation
## ^ source.parigp keyword.operator.cardinality
## ^ ^ source.parigp keyword.operator.arithmetic
## ^^ source.parigp keyword.operator.increment-decrement
vector(#counts, i, [i-1, counts[i]])
## ^^^^^^ source.parigp entity.name.function.builtins
};
Expand Down

0 comments on commit ba4e7bd

Please sign in to comment.