Skip to content

Commit 910b702

Browse files
Fix case sensitive highlighting of END
1 parent eaf52e7 commit 910b702

File tree

4 files changed

+169
-27
lines changed

4 files changed

+169
-27
lines changed

.vscode/launch.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Run Redcode VSCode Extension",
6+
"type": "extensionHost",
7+
"request": "launch",
8+
"runtimeExecutable": "${execPath}",
9+
"preLaunchTask": "npm: build - redcode",
10+
"args": [
11+
"--disable-extensions",
12+
"--extensionDevelopmentPath=${workspaceFolder}/redcode",
13+
],
14+
"outFiles": [],
15+
},
16+
{
17+
"type": "lldb",
18+
"request": "launch",
19+
"name": "Cargo test: all",
20+
"cargo": {
21+
"args": [
22+
"test",
23+
"--no-run",
24+
"--lib"
25+
],
26+
},
27+
"args": [
28+
"--nocapture",
29+
"--test-threads=1"
30+
],
31+
"env": {
32+
"PYENV_VERSION": "system"
33+
},
34+
"console": "internalConsole",
35+
"terminal": "console",
36+
},
37+
{
38+
"type": "lldb",
39+
"request": "launch",
40+
"name": "Cargo test: by name",
41+
"cargo": {
42+
"args": [
43+
"test",
44+
"--no-run",
45+
"--lib",
46+
],
47+
},
48+
"args": [
49+
"${input:cargoTest}",
50+
"--nocapture",
51+
"--test-threads=1",
52+
],
53+
"env": {
54+
"PYENV_VERSION": "system"
55+
},
56+
"console": "internalConsole",
57+
"terminal": "console",
58+
}
59+
],
60+
"inputs": [
61+
{
62+
"id": "cargoTest",
63+
"type": "promptString",
64+
"description": "A cargo test name or name substring"
65+
}
66+
]
67+
}

.vscode/tasks.json

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"tasks": [
3+
{
4+
"label": "rust: cargo doc",
5+
"detail": "Build and open Cargo documentation for the workspace",
6+
"command": "cargo",
7+
"args": [
8+
"doc",
9+
"--document-private-items",
10+
"--workspace",
11+
"--open"
12+
],
13+
"group": "build",
14+
"isBackground": true,
15+
"presentation": {
16+
"clear": true,
17+
"reveal": "silent"
18+
},
19+
"problemMatcher": [],
20+
"type": "shell"
21+
},
22+
{
23+
"label": "rust: cargo clippy",
24+
"detail": "Check build and run linting on the workspace",
25+
"command": "clippy",
26+
"args": [
27+
"--all-features",
28+
"--workspace"
29+
],
30+
"group": {
31+
"kind": "build",
32+
"isDefault": true
33+
},
34+
"presentation": {
35+
"clear": true
36+
},
37+
"problemMatcher": [
38+
"$rustc"
39+
],
40+
"type": "cargo"
41+
},
42+
{
43+
"label": "rust: cargo test",
44+
"detail": "Build and run unit and integration tests for the workspace",
45+
"command": "test",
46+
"args": [
47+
"--all-features",
48+
"--workspace"
49+
],
50+
"group": "test",
51+
"env": {
52+
"RUST_BACKTRACE": "1"
53+
},
54+
"presentation": {
55+
"clear": true
56+
},
57+
"problemMatcher": [
58+
"$rustc"
59+
],
60+
"type": "cargo"
61+
},
62+
{
63+
"type": "npm",
64+
"script": "build",
65+
"path": "redcode/",
66+
"problemMatcher": [
67+
"$tsc"
68+
],
69+
"group": "build",
70+
"label": "npm: build - redcode",
71+
"detail": "npx js-yaml syntaxes/redcode.tmLanguage.yaml > syntaxes/redcode.tmLanguage.json"
72+
}
73+
],
74+
"version": "2.0.0"
75+
}

redcode/syntaxes/redcode.tmLanguage.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@
111111
},
112112
"eof": {
113113
"name": "comment.block.end.redcode",
114-
"begin": "\\b(END)\\b(.*)",
114+
"begin": "(?i)\\b(END)\\b(.*)",
115115
"captures": {
116116
"1": {
117-
"name": "keyword.operator.control.psuedo-opcode.88.end.redcode"
117+
"name": "keyword.operator.control.pseudo-opcode.88.end.redcode"
118118
},
119119
"2": {
120120
"patterns": [
@@ -196,15 +196,15 @@
196196
"match": "(?i)\\b(LDP|STP)\\b"
197197
},
198198
{
199-
"name": "keyword.operator.control.psuedo-opcode.88.redcode",
199+
"name": "keyword.operator.control.pseudo-opcode.88.redcode",
200200
"match": "(?i)\\b(EQU|FOR|ROF)\\b"
201201
},
202202
{
203-
"name": "keyword.operator.control.psuedo-opcode.94.redcode",
203+
"name": "keyword.operator.control.pseudo-opcode.94.redcode",
204204
"match": "(?i)\\b(ORG)\\b"
205205
},
206206
{
207-
"name": "keyword.operator.control.psuedo-opcode.p-space.redcode",
207+
"name": "keyword.operator.control.pseudo-opcode.p-space.redcode",
208208
"match": "(?i)\\b(PIN)\\b"
209209
}
210210
]

redcode/syntaxes/redcode.tmLanguage.yaml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ repository:
1212
builtin:
1313
patterns:
1414
- name: constant.language.88.redcode
15-
match: \b(CORESIZE|MAXPROCESSES|MAXCYCLES|MAXLENGTH)\b
15+
match: '\b(CORESIZE|MAXPROCESSES|MAXCYCLES|MAXLENGTH)\b'
1616
- name: constant.language.94.redcode
17-
match: \b(MINDISTANCE|ROUNDS|CURLINE|VERSION|WARRIORS)\b
17+
match: '\b(MINDISTANCE|ROUNDS|CURLINE|VERSION|WARRIORS)\b'
1818
- name: constant.language.p-space.redcode
19-
match: \b(PSPACESIZE)\b
19+
match: '\b(PSPACESIZE)\b'
2020

2121
directive:
2222
begin: '(;)'
@@ -27,46 +27,46 @@ repository:
2727
patterns:
2828
- include: '#directive_with_argument'
2929
- name: keyword.operator.directive.main.redcode
30-
match: (?i)(redcode)(?!-)
30+
match: '(?i)(redcode)(?!-)'
3131
- name: keyword.operator.directive.koth.main.redcode
32-
match: (?i)(redcode-[a-zA-Z0-9]+)
32+
match: '(?i)(redcode-[a-zA-Z0-9]+)'
3333
- name: keyword.operator.directive.debug.redcode
34-
match: (?i)(debug)[[:blank:]]+(off|static)
34+
match: '(?i)(debug)[[:blank:]]+(off|static)'
3535
- name: keyword.operator.directive.trace.redcode
36-
match: (?i)(trace)[[:blank:]]+(off)
36+
match: '(?i)(trace)[[:blank:]]+(off)'
3737
- name: comment.line.semicolon.redcode
3838
match: '.*'
3939

4040
directive_with_argument:
4141
patterns:
42-
- match: (?i)(assert)\b(.*)
42+
- match: '(?i)(assert)\b(.*)'
4343
captures:
4444
'1':
4545
name: keyword.operator.directive.redcode
4646
'2':
4747
patterns:
4848
- include: '#expression'
4949

50-
- match: (?i)(author|break|name)\b(.*)
50+
- match: '(?i)(author|break|name)\b(.*)'
5151
captures:
5252
'1':
5353
name: keyword.operator.directive.redcode
5454
'2':
5555
name: string.unquoted.directive.argument.redcode
5656

57-
- match: (?i)(help|kill|status|strategy|test|password|newpasswd|newredcode|url|version|date)\b(.*)
57+
- match: '(?i)(help|kill|status|strategy|test|password|newpasswd|newredcode|url|version|date)\b(.*)'
5858
name: keyword.operator.directive.koth.redcode
5959
captures:
6060
'2':
6161
name: string.unquoted.directive.koth.argument.redcode
6262

6363
eof:
6464
name: comment.block.end.redcode
65-
begin: '\b(END)\b(.*)'
65+
begin: '(?i)\b(END)\b(.*)'
6666
# no end defined, the rest of the file should be treated as a comment
6767
captures:
6868
'1':
69-
name: keyword.operator.control.psuedo-opcode.88.end.redcode
69+
name: keyword.operator.control.pseudo-opcode.88.end.redcode
7070
'2':
7171
# Allow comments + expression on the same line
7272
patterns:
@@ -81,7 +81,7 @@ repository:
8181
- name: keyword.operator.logical.redcode
8282
match: '[=<>&|!]'
8383
- name: constant.numeric.redcode
84-
match: \b\d+\b
84+
match: '\b\d+\b'
8585
- include: '#builtin'
8686
- include: '#label'
8787
- include: '#paren_expression'
@@ -104,17 +104,17 @@ repository:
104104
opcode:
105105
patterns:
106106
- name: keyword.operator.control.opcode.88.redcode
107-
match: (?i)\b(DAT|MOV|ADD|SUB|JMP|JMZ|JMN|DJN|SLT|CMP|SPL)\b
107+
match: '(?i)\b(DAT|MOV|ADD|SUB|JMP|JMZ|JMN|DJN|SLT|CMP|SPL)\b'
108108
- name: keyword.operator.control.opcode.94.redcode
109-
match: (?i)\b(MUL|DIV|MOD|SEQ|SNE|NOP)\b
109+
match: '(?i)\b(MUL|DIV|MOD|SEQ|SNE|NOP)\b'
110110
- name: keyword.operator.control.opcode.p-space.redcode
111-
match: (?i)\b(LDP|STP)\b
112-
- name: keyword.operator.control.psuedo-opcode.88.redcode
113-
match: (?i)\b(EQU|FOR|ROF)\b
114-
- name: keyword.operator.control.psuedo-opcode.94.redcode
115-
match: (?i)\b(ORG)\b
116-
- name: keyword.operator.control.psuedo-opcode.p-space.redcode
117-
match: (?i)\b(PIN)\b
111+
match: '(?i)\b(LDP|STP)\b'
112+
- name: keyword.operator.control.pseudo-opcode.88.redcode
113+
match: '(?i)\b(EQU|FOR|ROF)\b'
114+
- name: keyword.operator.control.pseudo-opcode.94.redcode
115+
match: '(?i)\b(ORG)\b'
116+
- name: keyword.operator.control.pseudo-opcode.p-space.redcode
117+
match: '(?i)\b(PIN)\b'
118118

119119
paren_expression:
120120
name: expression.group

0 commit comments

Comments
 (0)