Skip to content

Commit 8c368c3

Browse files
committed
add version to each released grammar file
1 parent 06fd689 commit 8c368c3

File tree

4 files changed

+85
-74
lines changed

4 files changed

+85
-74
lines changed

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ jobs:
1919
with:
2020
body: Release tag ${{ github.ref_name }}
2121
files: |
22-
rascript.tmLanguage.json
22+
gen/rascript.tmLanguage.json
2323
gen/rascript.tmLanguage

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ clean:
1010
rm -f ~/.config/sublime-text/Packages/User/rascript.tmLanguage
1111

1212
generate: clean
13-
plistutil -f xml -i rascript.tmLanguage.json -o gen/rascript.tmLanguage
13+
./scripts/generate.sh
1414

1515
sublime: generate
1616
cd gen && zip -r RAScript.sublime-package rascript.tmLanguage

rascript.tmLanguage.json

Lines changed: 73 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3+
"$version": "<GRAMMAR_VERSION>",
34
"name": "RAScript",
45
"patterns": [
56
{
@@ -47,55 +48,35 @@
4748
}
4849
]
4950
},
50-
"comments": {
51+
"controls": {
5152
"patterns": [
5253
{
53-
"begin": "/\\*",
54-
"captures": {
55-
"0": {
56-
"name": "punctuation.definition.comment.block.rascript"
57-
}
58-
},
59-
"end": "\\*/",
60-
"name": "comment.block.rascript"
61-
},
62-
{
63-
"begin": "//",
64-
"beginCaptures": {
65-
"0": {
66-
"name": "punctuation.definition.comment.single.rascript"
67-
}
68-
},
69-
"end": "$",
70-
"name": "comment.line.double-slash.rascript"
54+
"name": "keyword.control.rascript",
55+
"match": "\\b(if|else|for|in|return)\\b"
7156
}
7257
]
7358
},
74-
"header": {
59+
"booleans": {
60+
"patterns": [{
61+
"name": "constant.language.boolean.rascript",
62+
"match": "\\b(true|false)\\b"
63+
}]
64+
},
65+
"strings": {
66+
"patterns": [{
67+
"name": "string.quoted.double.rascript",
68+
"match": "(?:\".*?\")"
69+
}]
70+
},
71+
"numbers": {
7572
"patterns": [
7673
{
77-
"name": "comment.line.double-slash.rascript",
78-
"match": "^//\\s*(#ID)\\s*=\\s*(\\d+)$",
79-
"captures": {
80-
"1": {
81-
"name": "keyword.other.id.rascript"
82-
},
83-
"2": {
84-
"name": "constant.numeric.id.rascript"
85-
}
86-
}
74+
"name": "constant.numeric.decimal.rascript",
75+
"match": "\\b[0-9]+\\b"
8776
},
8877
{
89-
"name": "comment.line.double-slash.rascript",
90-
"match": "^//\\s*(#MinimumVersion)\\s*=\\s*(\\d+(\\.\\d)?)$",
91-
"captures": {
92-
"1": {
93-
"name": "keyword.other.version.rascript"
94-
},
95-
"2": {
96-
"name": "constant.numeric.version.rascript"
97-
}
98-
}
78+
"name": "constant.numeric.hexadecimal.rascript",
79+
"match": "(?i)\\$\\b\\h+\\b|\\b0x\\h+\\b"
9980
}
10081
]
10182
},
@@ -154,14 +135,6 @@
154135
}
155136
]
156137
},
157-
"controls": {
158-
"patterns": [
159-
{
160-
"name": "keyword.control.rascript",
161-
"match": "\\b(if|else|for|in|return)\\b"
162-
}
163-
]
164-
},
165138
"function-names": {
166139
"patterns": [
167140
{
@@ -177,6 +150,58 @@
177150
}
178151
]
179152
},
153+
"header": {
154+
"patterns": [
155+
{
156+
"name": "comment.line.double-slash.rascript",
157+
"match": "^//\\s*(#ID)\\s*=\\s*(\\d+)$",
158+
"captures": {
159+
"1": {
160+
"name": "keyword.other.id.rascript"
161+
},
162+
"2": {
163+
"name": "constant.numeric.id.rascript"
164+
}
165+
}
166+
},
167+
{
168+
"name": "comment.line.double-slash.rascript",
169+
"match": "^//\\s*(#MinimumVersion)\\s*=\\s*(\\d+(\\.\\d)?)$",
170+
"captures": {
171+
"1": {
172+
"name": "keyword.other.version.rascript"
173+
},
174+
"2": {
175+
"name": "constant.numeric.version.rascript"
176+
}
177+
}
178+
}
179+
]
180+
},
181+
"comments": {
182+
"patterns": [
183+
{
184+
"begin": "/\\*",
185+
"captures": {
186+
"0": {
187+
"name": "punctuation.definition.comment.block.rascript"
188+
}
189+
},
190+
"end": "\\*/",
191+
"name": "comment.block.rascript"
192+
},
193+
{
194+
"begin": "//",
195+
"beginCaptures": {
196+
"0": {
197+
"name": "punctuation.definition.comment.single.rascript"
198+
}
199+
},
200+
"end": "$",
201+
"name": "comment.line.double-slash.rascript"
202+
}
203+
]
204+
},
180205
"variable-language-this": {
181206
"patterns": [
182207
{
@@ -210,30 +235,6 @@
210235
}
211236
}
212237
]
213-
},
214-
"numbers": {
215-
"patterns": [
216-
{
217-
"name": "constant.numeric.decimal.rascript",
218-
"match": "\\b[0-9]+\\b"
219-
},
220-
{
221-
"name": "constant.numeric.hexadecimal.rascript",
222-
"match": "(?i)\\$\\b\\h+\\b|\\b0x\\h+\\b"
223-
}
224-
]
225-
},
226-
"booleans": {
227-
"patterns": [{
228-
"name": "constant.language.boolean.rascript",
229-
"match": "\\b(true|false)\\b"
230-
}]
231-
},
232-
"strings": {
233-
"patterns": [{
234-
"name": "string.quoted.double.rascript",
235-
"match": "(?:\".*?\")"
236-
}]
237238
}
238239
},
239240
"scopeName": "source.rascript"

scripts/generate.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
export VERSION="$(git describe --always --dirty)"
4+
5+
if [[ ${GITHUB_REF_NAME} != "" ]]; then
6+
VERSION="$GITHUB_REF_NAME"
7+
fi
8+
9+
sed "s/<GRAMMAR_VERSION>/$VERSION/g" rascript.tmLanguage.json > gen/rascript.tmLanguage.json
10+
plistutil -f xml -i gen/rascript.tmLanguage.json -o gen/rascript.tmLanguage

0 commit comments

Comments
 (0)