Skip to content

Commit 3cac315

Browse files
authored
Merge pull request #89 from SSlinky/dev
Improved Pre-parsing
2 parents e61499c + c042a38 commit 3cac315

File tree

10 files changed

+397
-89
lines changed

10 files changed

+397
-89
lines changed

.github/workflows/node.js.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@ jobs:
2929
- run: npm ci
3030
# For some reason, antlr4ng writes to a different location on the VM
3131
# than it does locally, preventing compile. Command added to move the generated files.
32-
- run: npm run textMate
33-
- name: npm run antlr
32+
- name: npm run generate
3433
run: |
35-
npm run antlr4ng
36-
npm run antlr4ngPre
37-
npm run antlr4ngFmt
34+
npm run antlr
35+
npm run build:textMate
3836
mv ./server/src/antlr/out/server/src/antlr/* ./server/src/antlr/out
3937
- run: npm run build
4038
- run: xvfb-run -a npm test

contributing.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
# Contributing
2-
**Signed commits are turned on for this repo.**
2+
This repository is under active development. Please ensure your contributions do not cause merge conflicts with the dev branch.
33

44
## Setup
55

66
1. Fork this repo
7-
1. Install VS Code Extension [esBuild Problem Matchers](https://marketplace.visualstudio.com/items?itemName=connor4312.esbuild-problem-matchers).
8-
2. Install [Java](https://www.oracle.com/au/java/technologies/downloads/) >= 11
9-
3. Install [NPM](https://github.com/coreybutler/nvm-windows)
10-
4. `npm install` to install dependencies.
11-
5. `npm run textMate` first time and every time grammar is changed.
12-
6. `npm run antlr` first time and every time grammar is changed.
7+
2. Install VS Code Extension [esBuild Problem Matchers](https://marketplace.visualstudio.com/items?itemName=connor4312.esbuild-problem-matchers).
8+
3. Install [Java](https://www.oracle.com/au/java/technologies/downloads/) >= 11
9+
4. Install [NPM](https://github.com/coreybutler/nvm-windows)
10+
5. `npm install` to install dependencies.
11+
6. `npm run test` to build and unit test.
1312
7. Create a `.\sample` directory as a default workspace for client debugging (or update .\\.vscode\\launch.json as preferred).
14-
7. (Optional) Install [ANTLR4 grammar syntax support](https://marketplace.visualstudio.com/items?itemName=mike-lischke.vscode-antlr4) VS Code extension.
13+
8. (Optional) Install [ANTLR4 grammar syntax support](https://marketplace.visualstudio.com/items?itemName=mike-lischke.vscode-antlr4) VS Code extension.
1514
Note: to debug a grammar, you'll first need to activate the extension by opening one of the *.g4 files.
1615

1716
To contribute, you'll need to [create a pull request from a fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork).
18-
**Signed commits are turned on for this repo.**
1917

2018
## Debugging Language Server
2119

@@ -41,10 +39,10 @@ Note the grammar file for this project can be found at /server/src/antlr/vba.g4
4139

4240
The grammar call graph is interesting, but not particularly useful. Generating "valid" input generates garbage.
4341

44-
### Run unit tests for TextMate grammar
42+
## TextMate Snapshots
4543

46-
To verify that your changes haven't broken existing syntax or tests, and to ensure any new tests pass, run the following command:
44+
Your edits to the TextMate grammar may cause changes to the snapshot. If these changes are expected and unit tested, update the snapshot.
4745

4846
```
49-
npm run tmUnitTest
50-
```
47+
npm run tmSnapUpdate
48+
```

package.json

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -144,28 +144,26 @@
144144
},
145145
"scripts": {
146146
"vscode:prepublish": "npm run package",
147-
"build": "npm run check-types && node esbuild.js",
148-
"fullBuild": "npm run textMate && npm run antlr",
149-
"build-test": "node esbuild.js --test",
147+
"build": "npm-run-all -p build:* && npm run check-types && node esbuild.js",
148+
"package": "npm-run-all -p build:* && npm run check-types && node esbuild.js --production",
150149
"check-types": "tsc --noEmit",
151150
"watch": "npm-run-all -p watch:*",
152151
"watch:esbuild": "node esbuild.js --watch",
153152
"watch:tsc": "tsc --noEmit --watch --project tsconfig.json",
154-
"package": "npm run textMate && npm run antlr && npm run check-types && node esbuild.js --production",
155153
"lint": "eslint ./client/src ./server/src --ext .ts,.tsx",
156154
"postinstall": "cd client && npm install && cd ../server && npm install && cd ..",
157-
"textMate": "npx js-yaml client/syntaxes/vba.tmLanguage.yaml > client/syntaxes/vba.tmLanguage.json && npm run tmSnapTest",
158-
"antlr": "npm run antlr4ngPre && npm run antlr4ng && npm run antlr4ngFmt && npm run build",
159-
"antlr4ng": "antlr4ng -Dlanguage=TypeScript -visitor ./server/src/antlr/vba.g4 -o ./server/src/antlr/out/",
160-
"antlr4ngPre": "antlr4ng -Dlanguage=TypeScript -visitor ./server/src/antlr/vbapre.g4 -o ./server/src/antlr/out/",
161-
"antlr4ngFmt": "antlr4ng -Dlanguage=TypeScript -visitor ./server/src/antlr/vbafmt.g4 -o ./server/src/antlr/out/",
162-
"test": "npm run tmSnapTest && npm run tmUnitTest && npm run vsctest",
163-
"testsh": "sh ./scripts/e2e.sh",
164-
"testps": "powershell ./scripts/e2e.ps1",
165-
"tmUnitTest": "vscode-tmgrammar-test ./test/textmate/**/*.vba",
166-
"tmSnapTest": "vscode-tmgrammar-snap ./test/textmate/snapshot/*.??s",
155+
"build:textMate": "npx js-yaml client/syntaxes/vba.tmLanguage.yaml > client/syntaxes/vba.tmLanguage.json",
156+
"antlr": "npm-run-all -p build:antlr*",
157+
"build:antlr": "antlr4ng -Dlanguage=TypeScript -visitor ./server/src/antlr/vba.g4 -o ./server/src/antlr/out/",
158+
"build:antlrPre": "antlr4ng -Dlanguage=TypeScript -visitor ./server/src/antlr/vbapre.g4 -o ./server/src/antlr/out/",
159+
"build:antlrFmt": "antlr4ng -Dlanguage=TypeScript -visitor ./server/src/antlr/vbafmt.g4 -o ./server/src/antlr/out/",
167160
"tmSnapUpdate": "vscode-tmgrammar-snap --updateSnapshot ./test/textmate/snapshot/*.??s",
168-
"vsctest": "npm run build-test && vscode-test"
161+
"test": "npm run build && npm-run-all -p test:*:*",
162+
"test:textMate:unit": "vscode-tmgrammar-test ./test/textmate/**/*.vba",
163+
"test:textMate:snap": "vscode-tmgrammar-snap ./test/textmate/snapshot/*.??s",
164+
"test:vsc:unit": "vscode-test",
165+
"testsh": "sh ./scripts/e2e.sh",
166+
"testps": "powershell ./scripts/e2e.ps1"
169167
},
170168
"dependencies": {
171169
"antlr4ng": "^3.0.16",
@@ -189,4 +187,4 @@
189187
"typescript": "^5.8.3",
190188
"vscode-tmgrammar-test": "^0.1.3"
191189
}
192-
}
190+
}

0 commit comments

Comments
 (0)