Skip to content

Commit 16376ca

Browse files
Merge pull request #30 from ian-h-chamberlain/ian/fix-redcode-end
Fix redcode `end` highlight and update deps
2 parents 8031e11 + 7d28c07 commit 16376ca

File tree

14 files changed

+273
-85
lines changed

14 files changed

+273
-85
lines changed

.github/workflows/ci.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- develop
8+
pull_request:
9+
branches:
10+
- master
11+
- develop
12+
13+
defaults:
14+
run:
15+
working-directory: redcode
16+
17+
jobs:
18+
build_redcode:
19+
strategy:
20+
matrix:
21+
os:
22+
- macos-latest
23+
- ubuntu-latest
24+
- windows-latest
25+
runs-on: ${{ matrix.os }}
26+
steps:
27+
- name: Checkout branch
28+
uses: actions/checkout@v2
29+
- name: Install Node.js
30+
uses: actions/setup-node@v1
31+
with:
32+
node-version: 14.x
33+
- name: Install dependencies
34+
run: npm install --locked
35+
- name: Build extension
36+
run: npm run build
37+
- name: Verify the build did not modify any files
38+
run: git diff --exit-code HEAD -- .
39+
40+
lint_rust:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Checkout branch
44+
uses: actions/checkout@v2
45+
- name: Setup default Rust toolchain
46+
uses: actions-rs/toolchain@v1
47+
with:
48+
components: clippy,rustfmt
49+
- name: Check formatting
50+
run: cargo fmt --all --verbose -- --check
51+
- name: Run clippy linting
52+
run: cargo clippy --color=always --workspace --verbose --all-targets
53+
env:
54+
RUSTFLAGS:
55+
"-D warnings"
56+
57+
validate_rust:
58+
strategy:
59+
matrix:
60+
os:
61+
- macos-latest
62+
- ubuntu-latest
63+
- windows-latest
64+
toolchain:
65+
- stable
66+
- beta
67+
- nightly
68+
continue-on-error: ${{ matrix.toolchain != 'stable' || matrix.os == 'windows-latest' }}
69+
runs-on: ${{ matrix.os }}
70+
steps:
71+
- name: Checkout branch
72+
uses: actions/checkout@v2
73+
- name: Setup Rust toolchain
74+
uses: actions-rs/toolchain@v1
75+
with:
76+
toolchain: ${{ matrix.toolchain }}
77+
- name: Build and run tests
78+
run: cargo test --color=always --workspace

.github/workflows/redcode-publish.yml renamed to .github/workflows/publish_redcode.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
name: redcode-publish
1+
name: publish_redcode
22

33
on:
44
release:
55
types:
6-
- created
7-
- edited
6+
- published
87

98
defaults:
109
run:

.github/workflows/redcode-ci.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.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+
}

corewa_rs/src/parser.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ fn parse_opcode(opcode_pair: &Pair<grammar::Rule>) -> Opcode {
146146
}
147147

148148
fn parse_field(field_pair: Pair<grammar::Rule>) -> Field {
149-
let field_pairs = field_pair.into_inner();
149+
let mut field_pairs = field_pair.into_inner();
150150

151151
let address_mode = field_pairs
152152
.peek()
@@ -157,8 +157,7 @@ fn parse_field(field_pair: Pair<grammar::Rule>) -> Field {
157157

158158
let value = parse_value(
159159
field_pairs
160-
.skip_while(|pair| pair.as_rule() != grammar::Rule::Expr)
161-
.next()
160+
.find(|pair| pair.as_rule() == grammar::Rule::Expr)
162161
.expect("No Expr in Field"),
163162
);
164163

redcode/CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
<!-- markdownlint-disable-file no-duplicate-header -->
22

3-
# Change Log
3+
# Changelog
44

55
All notable changes to the "redcode" extension will be documented in this file.
66
Format based on [Keep a Changelog](http://keepachangelog.com/).
77

88
## Unreleased
99

10-
## [0.1.0]
10+
## [0.1.1] - 2020-07-19
11+
12+
### Fixed
13+
14+
- Lowercase `end` keyword highlighted incorrectly
15+
16+
## [0.1.0] - 2020-06-14
1117

1218
### Added
1319

redcode/INSTALL.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
## Installing locally
44

5-
```
5+
```shell
66
cd redcode
77
npm install && npm run package
88
code --install-extension <path-to-redcode>/redcode-<version>.vsix
99
```
1010

1111
## Install from VS Code Marketplace
1212

13-
TODO. Not yet published
13+
```shell
14+
code --install-extension ian-h-chamberlain.redcode
15+
```

redcode/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Redcode Syntax highlighting
22

3+
[![Latest Release](https://img.shields.io/visual-studio-marketplace/v/ian-h-chamberlain.redcode?logo=visual-studio-code)](https://marketplace.visualstudio.com/items?itemName=ian-h-chamberlain.redcode)
4+
[![Build Status](https://img.shields.io/github/workflow/status/ian-h-chamberlain/corewa_rs/build_redcode/master)](https://github.com/ian-h-chamberlain/corewa_rs/actions)
5+
36
Basic syntax highlighting for Redcode, the language used in [Core Wars](https://corewa.rs).
47

58
## Features
@@ -16,4 +19,4 @@ Syntax highlighting for redcode, based partially on [this vim syntax file](https
1619

1720
## Release Notes
1821

19-
See CHANGELOG.md
22+
See [the changelog](./CHANGELOG.md).

redcode/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)