Skip to content

Commit 46650d6

Browse files
authored
Enhance const expressions resolution (#43)
* Enhance const expressions resolution * Changelog * Allow numbers in first capturing group
1 parent a650fdc commit 46650d6

File tree

4 files changed

+39
-19
lines changed

4 files changed

+39
-19
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,7 @@ All notable changes to the "nwscript-ee-language-server" extension will be docum
4444

4545
- Eslint has been configured along with prettier and the project will be linted from now on.
4646
- File handling is now done with their uri instead of their path.
47+
48+
## [1.5.2]
49+
50+
- `const` expressions resolution has been enhanced.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"url": "https://github.com/PhilippeChab/nwscript-ee-language-server"
99
},
1010
"license": "MIT",
11-
"version": "1.5.1",
11+
"version": "1.5.2",
1212
"author": {
1313
"name": "Philippe Chabot"
1414
},

syntaxes/nwscript-ee.tmLanguage

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,7 @@
4040
</dict>
4141
<dict>
4242
<key>match</key>
43-
<string>\b(const|static)\b</string>
44-
<key>name</key>
45-
<string>storage.modifier.nss</string>
46-
</dict>
47-
<dict>
48-
<key>match</key>
49-
<string>\b[A-Z]+(_[A-Z]+)*(_[a-zA-Z0-9]+){0,1}(?!\()\b</string>
43+
<string>\b_{0,1}[A-Z0-9]+(_[A-Z0-9]+)*(_[a-zA-Z0-9]+){0,1}_{0,1}(?!\()\b</string>
5044
<key>name</key>
5145
<string>constant.language.nss</string>
5246
</dict>
@@ -3736,9 +3730,25 @@ U[a-fA-F0-9]{,8} )</string>
37363730
<array>
37373731
<dict>
37383732
<key>match</key>
3739-
<string>\b(action|effect|event|float|int|itemproperty|location|object|string|talent|vector|void|json|sqlquery|cassowary)\b</string>
3740-
<key>name</key>
3741-
<string>storage.type.built-in.nss</string>
3733+
<string>(const){0,1} *\b(action|effect|event|float|int|itemproperty|location|object|string|talent|vector|void|json|sqlquery|cassowary)\b (?(1)(\S*)|)</string>
3734+
<key>captures</key>
3735+
<dict>
3736+
<key>1</key>
3737+
<dict>
3738+
<key>name</key>
3739+
<string>storage.modifier.nss</string>
3740+
</dict>
3741+
<key>2</key>
3742+
<dict>
3743+
<key>name</key>
3744+
<string>storage.type.built-in.nss</string>
3745+
</dict>
3746+
<key>3</key>
3747+
<dict>
3748+
<key>name</key>
3749+
<string>constant.language.nss</string>
3750+
</dict>
3751+
</dict>
37423752
</dict>
37433753
<dict>
37443754
<key>match</key>
@@ -4111,4 +4121,4 @@ U[a-fA-F0-9]{,8} )</string>
41114121
</dict>
41124122
</dict>
41134123
</dict>
4114-
</plist>
4124+
</plist>

syntaxes/nwscript-ee.tmLanguage.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@
2525
"include": "#storage_types"
2626
},
2727
{
28-
"match": "\\b(const|static)\\b",
29-
"name": "storage.modifier.nss"
30-
},
31-
{
32-
"match": "\\b[A-Z]+(_[A-Z]+)*(_[a-zA-Z0-9]+){0,1}(?!\\()\\b",
28+
"match": "\\b_{0,1}[A-Z0-9]+(_[A-Z0-9]+)*(_[a-zA-Z0-9]+){0,1}_{0,1}(?!\\()\\b",
3329
"name": "constant.language.nss"
3430
},
3531
{
@@ -2406,8 +2402,18 @@
24062402
"storage_types": {
24072403
"patterns": [
24082404
{
2409-
"match": "\\b(action|effect|event|float|int|itemproperty|location|object|string|talent|vector|void|json|sqlquery|cassowary)\\b",
2410-
"name": "storage.type.built-in.nss"
2405+
"match": "(const){0,1} *\\b(action|effect|event|float|int|itemproperty|location|object|string|talent|vector|void|json|sqlquery|cassowary)\\b (?(1)(\\S*)|)",
2406+
"captures": {
2407+
"1": {
2408+
"name": "storage.modifier.nss"
2409+
},
2410+
"2": {
2411+
"name": "storage.type.built-in.nss"
2412+
},
2413+
"3": {
2414+
"name": "constant.language.nss"
2415+
}
2416+
}
24112417
},
24122418
{
24132419
"match": "\\b(struct)\\b \\b([a-zA-Z_][a-zA-Z0-9_]*\\b(?!\\s*\\())",

0 commit comments

Comments
 (0)