Skip to content

Commit a4c4a5f

Browse files
Restore the remainder of the vscode extension
1 parent d8b233b commit a4c4a5f

File tree

6 files changed

+283
-0
lines changed

6 files changed

+283
-0
lines changed

redcode/.vscodeignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.vscode/**
2+
.vscode-test/**
3+
.gitignore
4+
vsc-extension-quickstart.md

redcode/CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Change Log
2+
All notable changes to the "redcode" extension will be documented in this file.
3+
Format based on [Keep a Changelog](http://keepachangelog.com/).
4+
5+
## Unreleased
6+
7+
## [0.0.2]
8+
### Added
9+
- INSTALL.md
10+
### Changed
11+
- Merge into [corewa.rs repository](http://github.com/ian-h-chamberlain/corewa_rs), update links to http://corewa.rs, etc.
12+
13+
### Fixed
14+
- Fix build scripts, update dependencies, general cleanup
15+
16+
## [0.0.1]
17+
### Added
18+
- Initial syntax highlighting for redcode

redcode/INSTALL.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Redcode syntax highlighting
2+
3+
## Installing locally
4+
5+
```
6+
cd redcode
7+
npm install && npm run package
8+
code --install-extension <path-to-redcode>/redcode-<version>.vsix
9+
```
10+
11+
## Install from VS Code Marketplace
12+
13+
TODO. Not yet published

redcode/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Redcode Syntax highlighting
2+
3+
Basic syntax highlighting for Redcode, the language used in [Core Wars](https://corewa.rs).
4+
5+
## Features
6+
7+
Syntax highlighting for redcode, based partially on [this vim syntax file](https://www.vim.org/scripts/script.php?script_id=1705), and on the [pMARS '94 reference](https://corewa.rs/pmars-redcode-94.txt) and an [annotated version](http://corewa.rs/icws94.txt) of the ICWS '94 draft.
8+
9+
## Contents
10+
11+
* `package.json` - NPM package declaration for the extension
12+
* `package-lock.json` - pinned NPM dependencies
13+
* `syntaxes/redcode.tmLanguage.yaml` - the TextMate grammar definition, maintained for readability and editability
14+
* `syntaxes/redcode.tmLanguage.json` - the TextMate grammar file used for tokenization, generated from `redcode.tmLanguage.yaml`.
15+
* `language-configuration.json` - this the language configuration, defining the tokens that are used for comments and brackets
16+
17+
## Release Notes
18+
19+
See CHANGELOG.md
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"comments": {
3+
// symbol used for single line comment. Remove this entry if your language does not support line comments
4+
"lineComment": ";",
5+
},
6+
// symbols used as brackets
7+
"brackets": [
8+
["(", ")"]
9+
],
10+
// symbols that are auto closed when typing
11+
"autoClosingPairs": [
12+
["(", ")"],
13+
],
14+
// symbols that that can be used to surround a selection
15+
"surroundingPairs": [
16+
["(", ")"],
17+
]
18+
}
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3+
"name": "Redcode",
4+
"scopeName": "source.redcode",
5+
"patterns": [
6+
{
7+
"include": "#directive"
8+
},
9+
{
10+
"include": "#opcode"
11+
},
12+
{
13+
"include": "#field"
14+
},
15+
{
16+
"include": "#label"
17+
}
18+
],
19+
"repository": {
20+
"opcode": {
21+
"patterns": [
22+
{
23+
"name": "keyword.operator.control.opcode.88.redcode",
24+
"match": "(?i)\\b(DAT|MOV|ADD|SUB|JMP|JMZ|JMN|DJN|SLT|CMP|SPL)\\b"
25+
},
26+
{
27+
"name": "keyword.operator.control.opcode.94.redcode",
28+
"match": "(?i)\\b(MUL|DIV|MOD|SEQ|SNE|NOP)\\b"
29+
},
30+
{
31+
"name": "keyword.operator.control.opcode.p-space.redcode",
32+
"match": "(?i)\\b(LDP|STP)\\b"
33+
},
34+
{
35+
"name": "keyword.operator.control.psuedo-opcode.88.redcode",
36+
"match": "(?i)\\b(EQU|END|FOR|ROF)\\b"
37+
},
38+
{
39+
"name": "keyword.operator.control.psuedo-opcode.94.redcode",
40+
"match": "(?i)\\b(ORG)\\b"
41+
},
42+
{
43+
"name": "keyword.operator.control.psuedo-opcode.p-space.redcode",
44+
"match": "(?i)\\b(PIN)\\b"
45+
}
46+
]
47+
},
48+
"builtin": {
49+
"patterns": [
50+
{
51+
"name": "constant.language.88.redcode",
52+
"match": "\\b(CORESIZE|MAXPROCESSES|MAXCYCLES|MAXLENGTH)\\b"
53+
},
54+
{
55+
"name": "constant.language.94.redcode",
56+
"match": "\\b(MINDISTANCE|ROUNDS|CURLINE|VERSION|WARRIORS)\\b"
57+
},
58+
{
59+
"name": "constant.language.p-space.redcode",
60+
"match": "\\b(PSPACESIZE)\\b"
61+
}
62+
]
63+
},
64+
"directive": {
65+
"begin": "(;)",
66+
"beginCaptures": {
67+
"1": {
68+
"name": "comment.line.semicolon.redcode"
69+
}
70+
},
71+
"end": "$",
72+
"patterns": [
73+
{
74+
"include": "#directive_with_argument"
75+
},
76+
{
77+
"name": "keyword.operator.directive.main.redcode",
78+
"match": "(?i)(redcode)(?!-)"
79+
},
80+
{
81+
"name": "keyword.operator.directive.koth.main.redcode",
82+
"match": "(?i)(redcode-[a-zA-Z0-9]+)"
83+
},
84+
{
85+
"name": "keyword.operator.directive.debug.redcode",
86+
"match": "(?i)(debug)[[:blank:]]+(off|static)"
87+
},
88+
{
89+
"name": "keyword.operator.directive.trace.redcode",
90+
"match": "(?i)(trace)[[:blank:]]+(off)"
91+
},
92+
{
93+
"name": "comment.line.semicolon.redcode",
94+
"match": ".*"
95+
}
96+
]
97+
},
98+
"directive_with_argument": {
99+
"patterns": [
100+
{
101+
"match": "(?i)(assert)\\b(.*)",
102+
"captures": {
103+
"1": {
104+
"name": "keyword.operator.directive.redcode"
105+
},
106+
"2": {
107+
"patterns": [
108+
{
109+
"include": "#expression"
110+
}
111+
]
112+
}
113+
}
114+
},
115+
{
116+
"match": "(?i)(author|break|name)\\b(.*)",
117+
"captures": {
118+
"1": {
119+
"name": "keyword.operator.directive.redcode"
120+
},
121+
"2": {
122+
"name": "string.unquoted.directive.argument.redcode"
123+
}
124+
}
125+
},
126+
{
127+
"match": "(?i)(help|kill|status|strategy|test|password|newpasswd|newredcode|url|version|date)\\b(.*)",
128+
"name": "keyword.operator.directive.koth.redcode",
129+
"captures": {
130+
"2": {
131+
"name": "string.unquoted.directive.koth.argument.redcode"
132+
}
133+
}
134+
}
135+
]
136+
},
137+
"label": {
138+
"patterns": [
139+
{
140+
"name": "variable.redcode",
141+
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*[:]?)\\b"
142+
}
143+
]
144+
},
145+
"field": {
146+
"patterns": [
147+
{
148+
"name": "keyword.operator.address-mode.88.redcode",
149+
"match": "[#$@<]"
150+
},
151+
{
152+
"name": "keyword.operator.address-mode.94.redcode",
153+
"match": "[>*{}]"
154+
},
155+
{
156+
"name": "keyword.operator.modifier.redcode",
157+
"match": "(?i)\\b(\\.([ABFXI]|AB|BA))\\b"
158+
},
159+
{
160+
"include": "#expression"
161+
}
162+
]
163+
},
164+
"expression": {
165+
"name": "expression",
166+
"patterns": [
167+
{
168+
"name": "keyword.operator.math.redcode",
169+
"match": "[+\\-*/%]"
170+
},
171+
{
172+
"name": "keyword.operator.logical.redcode",
173+
"match": "[=<>&|!]"
174+
},
175+
{
176+
"name": "constant.numeric.redcode",
177+
"match": "\\b\\d+\\b"
178+
},
179+
{
180+
"include": "#builtin"
181+
},
182+
{
183+
"include": "#label"
184+
},
185+
{
186+
"include": "#paren_expression"
187+
}
188+
]
189+
},
190+
"paren_expression": {
191+
"begin": "\\(",
192+
"beginCaptures": {
193+
"0": {
194+
"name": "punctuation.paren.open.redcode"
195+
}
196+
},
197+
"end": "\\)",
198+
"endCaptures": {
199+
"0": {
200+
"name": "punctuation.paren.open.redcode"
201+
}
202+
},
203+
"name": "expression.group",
204+
"patterns": [
205+
{
206+
"include": "#expression"
207+
}
208+
]
209+
}
210+
}
211+
}

0 commit comments

Comments
 (0)