Skip to content

Commit

Permalink
update syntax grammar
Browse files Browse the repository at this point in the history
- add embedded yaml
  • Loading branch information
rouzwelt committed Feb 13, 2024
1 parent 047734a commit 596d0ce
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 11 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,10 @@
{
"language": "rainlang",
"scopeName": "source.rainlang",
"path": "./syntaxes/rainlang-syntax.json"
"path": "./syntaxes/rainlang-syntax.json",
"embeddedLanguages": {
"meta.embedded.frontmatter.rainlang": "yaml"
}
},
{
"path": "./syntaxes/rainlang-injection.json",
Expand Down
7 changes: 5 additions & 2 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 30 additions & 8 deletions syntaxes/rainlang-syntax.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"fileTypes": ["rain"],
"name": "Rain Language",
"patterns": [
{
"include": "#frontmatter"
},
{
"include": "#comment"
},
Expand All @@ -26,14 +29,30 @@
{
"include": "#alias"
},
{
"include": "#string-literal"
},
{
"include": "#number"
},
{
"include": "#sub-parser"
},
{
"include": "#punctuation"
}
],
"repository": {
"frontmatter": {
"begin": "\\A",
"end": "---",
"contentName": "meta.embedded.frontmatter.rainlang",
"patterns": [
{
"include": "source.yaml"
}
]
},
"comment": {
"patterns": [
{
Expand All @@ -58,7 +77,7 @@
"name": "keyword.operator.assignment.rainlang"
},
"reserved": {
"match": "infinity|max-uint-256|max-uint256",
"match": "using-words-from",
"name": "keyword.reserved.rainlang"
},
"import": {
Expand Down Expand Up @@ -90,6 +109,11 @@
"match": "'[a-zA-Z0-9-_.]*",
"name": "string.quoted.single.rainlang"
},
"string-literal": {
"begin": "\"",
"end": "\"",
"name": "string.quoted.double.rainlang"
},
"number": {
"patterns": [
{
Expand All @@ -100,9 +124,6 @@
},
{
"include": "#number-hex"
},
{
"include": "#number-binary"
}
]
},
Expand All @@ -118,10 +139,6 @@
"match": "\\b(0x[a-fA-F0-9]+)\\b",
"name": "constant.numeric.hexadecimal.rainlang"
},
"number-binary": {
"match": "\\b(0b[0-1]+)\\b",
"name": "constant.numeric.binary.rainlang"
},
"opcode": {
"match": "\\b([a-z][a-z0-9\\-]*(?=[\\(\\<]))",
"captures": {
Expand All @@ -130,6 +147,11 @@
}
}
},
"sub-parser": {
"begin": "\\[",
"end": "\\]",
"contentName": "string.quoted.double.rainlang"
},
"alias": {
"patterns": [
{
Expand Down

0 comments on commit 596d0ce

Please sign in to comment.