Skip to content

Commit

Permalink
feat: Support operator identifiers (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
ospencer committed Mar 4, 2024
1 parent ed4b370 commit 5fb6a32
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions editor-extensions/vscode/syntaxes/grain.json
Expand Up @@ -681,7 +681,7 @@
"name": "punctuation.support.grain"
},
{
"match": "\\b(type)\\b\\s*([A-Z]\\w*)\\b",
"match": "\\b(type|exception)\\b\\s*([A-Z]\\w*)\\b",
"captures": {
"1": { "patterns": [{ "include": "#keywords" }] },
"2": { "patterns": [{ "include": "#type" }] }
Expand All @@ -694,12 +694,7 @@
"match": "\\b[A-Z]\\w*\\b",
"name": "entity.name.module.grain"
},
{
"match": "(\\b\\w+\\b)",
"captures": {
"1": { "patterns": [{ "include": "#identifier" }] }
}
}
{ "include": "#identifier" }
]
},
{
Expand Down Expand Up @@ -733,7 +728,7 @@
}
]
},
"identifier": {
"operator": {
"patterns": [
{
"match": "(==|!=|<|>|\\^|\\+|-|\\*|%|/|&|\\||\\?\\?)[$&\\*/\\+\\-=><\\^\\|\\!\\?%:\\.]*",
Expand All @@ -747,6 +742,24 @@
"match": "\\bis(nt)?\\b",
"name": "keyword.operator.grain"
},
{
"begin": "(\\()",
"end": "(\\))",
"beginCaptures": {
"1": { "name": "punctuation.definition.parameters.begin.grain" }
},
"endCaptures": {
"1": { "name": "punctuation.definition.parameters.end.grain" }
},
"patterns": [{ "include": "#operator" }]
}
]
},
"identifier": {
"patterns": [
{
"include": "#operator"
},
{
"match": "(\\.\\.\\.|\\.)",
"name": "keyword.operator.grain"
Expand Down

0 comments on commit 5fb6a32

Please sign in to comment.