Skip to content

Commit 0ea2d7c

Browse files
committed
Add compile commands, grammar tools & diagnostics
Add Open VSX publish workflow and UI/feature enhancements: register commands to compile Bison/Flex, show parse table and grammar graph (D3 webview), a status-bar button, and output channels. Implement compiler-output parsing into VS Code diagnostics and a dedicated diagnostic collection. Add language-server providers: code actions, cross-file token sync, First/Follow computation, and folding ranges. Extend parser to extract full symbol lists and update types. Update package.json with commands/menus/configuration and README with build integration and settings; add example files, images and tests; update dependencies (vscode-uri) and lockfile.
1 parent 716f5c9 commit 0ea2d7c

30 files changed

Lines changed: 2758 additions & 7 deletions

.github/workflows/publish-ovsx.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish to Open VSX
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
publish-ovsx:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: "20"
19+
cache: "npm"
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Build VSIX
25+
run: |
26+
npm run package
27+
npx vsce package
28+
29+
- name: Publish to Open VSX
30+
run: npx ovsx publish *.vsix --pat ${{ secrets.OVSX_PAT }}

.vscodeignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,12 @@ node_modules/
99
tests/
1010
images/icon.svg
1111
**/*.map
12+
.claude/
13+
.github/
14+
.gitignore
15+
TODO.md
16+
examples/
17+
tsconfig.base.json
18+
package-lock.json
19+
*.vsix
20+
.gitattributes

README.md

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
[![VS Marketplace Version](https://img.shields.io/visual-studio-marketplace/v/theodevelop.bison-flex-lang?label=Marketplace&logo=visual-studio-code)](https://marketplace.visualstudio.com/items?itemName=theodevelop.bison-flex-lang)
44
[![Installs](https://img.shields.io/visual-studio-marketplace/i/theodevelop.bison-flex-lang)](https://marketplace.visualstudio.com/items?itemName=theodevelop.bison-flex-lang)
5-
[![CI](https://github.com/theodevelop/Bison-Flex-Language-Support/actions/workflows/ci.yml/badge.svg)](https://github.com/theodevelop/Bison-Flex-Language-Support/actions/workflows/ci.yml)
5+
[![Rating](https://img.shields.io/visual-studio-marketplace/r/theodevelop.bison-flex-lang)](https://marketplace.visualstudio.com/items?itemName=theodevelop.bison-flex-lang)
6+
[![Open VSX](https://img.shields.io/open-vsx/v/theodevelop/bison-flex-lang?label=Open%20VSX&logo=vscodium)](https://open.vsx.org/extension/theodevelop/bison-flex-lang)
7+
[![CI](https://github.com/theodevelop/bison-flex-lang/actions/workflows/ci.yml/badge.svg)](https://github.com/theodevelop/bison-flex-lang/actions/workflows/ci.yml)
68
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
79

810
Full-featured language support for **GNU Bison** (`.y`, `.yy`) and **Flex/RE-flex** (`.l`, `.ll`) in Visual Studio Code.
@@ -32,6 +34,10 @@ Real-time error detection as you type:
3234
| Missing `%%` section separator | Missing `%%` section separator |
3335
| Unclosed `%{ %}` code blocks | Unclosed `%{ %}` code blocks |
3436
| Missing `%type` with `variant` semantic values | Unused start conditions and abbreviations |
37+
| Unused grammar rules (unreachable from start symbol) | Inaccessible rules (catch-all before specific pattern, or duplicate) |
38+
| Unused tokens (declared but never referenced) | Unknown/invalid directive |
39+
| Shift/reduce conflict heuristic | |
40+
| Unknown/invalid directive | |
3541

3642
### Autocompletion
3743

@@ -134,6 +140,65 @@ Then press `F5` in VS Code to launch the Extension Development Host.
134140
|---------|------|---------|-------------|
135141
| `bisonFlex.enableDiagnostics` | `boolean` | `true` | Enable/disable real-time error detection |
136142
| `bisonFlex.maxDiagnostics` | `number` | `100` | Maximum number of diagnostics per file |
143+
| `bisonFlex.bisonPath` | `string` | `"bison"` | Path to the Bison executable (must be in PATH or absolute) |
144+
| `bisonFlex.flexPath` | `string` | `"flex"` | Path to the Flex executable (must be in PATH or absolute) |
145+
146+
---
147+
148+
## Build Integration (tasks.json)
149+
150+
Drop this `.vscode/tasks.json` into your Bison/Flex project to get `Ctrl+Shift+B` build support with problem matchers:
151+
152+
```json
153+
{
154+
"version": "2.0.0",
155+
"tasks": [
156+
{
157+
"label": "Build (Bison + Flex + Make)",
158+
"type": "shell",
159+
"command": "make",
160+
"group": { "kind": "build", "isDefault": true },
161+
"presentation": { "reveal": "always", "panel": "shared" },
162+
"problemMatcher": [
163+
{
164+
"owner": "bison",
165+
"fileLocation": ["relative", "${workspaceFolder}"],
166+
"pattern": {
167+
"regexp": "^(.+?):(\\d+)(?:\\.(\\d+))?:\\s+(warning|error):\\s+(.+)$",
168+
"file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
169+
}
170+
},
171+
{
172+
"owner": "flex",
173+
"fileLocation": ["relative", "${workspaceFolder}"],
174+
"pattern": {
175+
"regexp": "^(.+?):(\\d+):\\s+(warning|error):\\s+(.+)$",
176+
"file": 1, "line": 2, "severity": 3, "message": 4
177+
}
178+
}
179+
]
180+
},
181+
{
182+
"label": "Bison: Compile current file",
183+
"type": "shell",
184+
"command": "bison",
185+
"args": ["-d", "-v", "${file}"],
186+
"group": "build",
187+
"problemMatcher": []
188+
},
189+
{
190+
"label": "Flex: Compile current file",
191+
"type": "shell",
192+
"command": "flex",
193+
"args": ["-o", "${fileBasenameNoExtension}.c", "${file}"],
194+
"group": "build",
195+
"problemMatcher": []
196+
}
197+
]
198+
}
199+
```
200+
201+
> **Tip**: `bison -d` generates the `.tab.h` header; `-v` produces the `.output` report with the parse table.
137202
138203
---
139204

0 commit comments

Comments
 (0)