Skip to content

Commit

Permalink
Add FSL grammar (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
macmv authored Sep 25, 2023
1 parent 1ffa5b2 commit 29487c8
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,28 @@
"light": "./icons/fauna.svg",
"dark": "./icons/fauna-light.svg"
}
},
{
"id": "fsl",
"extensions": [
".fsl"
],
"icon": {
"light": "./icons/fauna.svg",
"dark": "./icons/fauna-light.svg"
}
}
],
"grammars": [
{
"language": "fql",
"scopeName": "source.fql",
"path": "./syntax/fql.tmGrammar.json"
},
{
"language": "fsl",
"scopeName": "source.fsl",
"path": "./syntax/fsl.tmGrammar.json"
}
],
"keybindings": [
Expand Down
72 changes: 72 additions & 0 deletions syntax/fsl.tmGrammar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"name": "fsl",
"scopeName": "source.fsl",
"patterns": [
{
"comment": "Single-line comment",
"name": "comment.line.double-slash.fsl",
"begin": "//",
"end": "$"
},
{
"include": "#block_comment"
},
{
"comment": "Function body",
"name": "constant.function.fsl",
"pattern": "\\b(function)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\s*\\(",
"captures": {
"1": {
"name": "keyword.control.fsl"
},
"2": {
"name": "entity.name.function.fsl"
}
}
},
{
"comment": "Schema block",
"name": "constant.block.fsl",
"match": "\\b(collection|role|index|privileges|membership|(access\\s+provider))\\b(\\s+[a-zA-Z_][a-zA-Z0-9_]*)?",
"captures": {
"1": {
"name": "keyword.control.fsl"
},
"3": {
"name": "entity.name.type.fsl"
}
}
},
{
"comment": "Keyword",
"name": "keyword.control.fsl",
"match": "\\b(collection|function|role|access|provider|index|privileges|membership)\\b"
},
{
"comment": "Action keyword",
"name": "variable.other.constant.property",
"match": "\\b(create|delete|read|write|call|history_read|history_write|unrestricted_read)\\b"
},
{
"comment": "Field keyword",
"name": "variable.other.property",
"match": "\\b(terms|values|unique|predicate|history_days|ttl_days|issuer|jwks_uri)\\b"
},
{
"include": "source.fql"
}
],
"repository": {
"block_comment": {
"comment": "Block comment",
"name": "comment.block.fsl",
"begin": "/\\*",
"end": "\\*/",
"patterns": [
{
"include": "#block_comment"
}
]
}
}
}

0 comments on commit 29487c8

Please sign in to comment.