Skip to content

Commit 5ec4b2e

Browse files
committed
2 parents b73e653 + 5eb6dca commit 5ec4b2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4174
-62
lines changed

.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

CHANGELOG.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,25 @@ All notable changes to the **Bison/Flex Language Support** extension will be doc
1313
- Start condition highlighting (`<SC_NAME>`)
1414
- Abbreviation reference highlighting (`{name}`)
1515
- **Real-time diagnostics**
16-
- Bison: undeclared tokens, orphan `%type` declarations, missing `%%`, unclosed blocks
17-
- Flex: undefined start conditions, undefined abbreviations, missing `%%`, unclosed blocks
16+
- Bison:
17+
- Missing `%%` section separator (Error)
18+
- Unknown/invalid directive — e.g. `%prout` (Error)
19+
- Token used in grammar rules but not declared with `%token` (Warning)
20+
- `%type` declared for a non-terminal that has no rule (Warning)
21+
- Rule missing `%type` declaration when `api.value.type=variant` is active (Info)
22+
- Unclosed `%{ %}` code block (Error)
23+
- Unused grammar rules — not reachable from the start symbol (Warning)
24+
- Unused tokens — declared with `%token` but never referenced in rules (Warning)
25+
- Shift/reduce conflict heuristic — same terminal appears in two or more alternatives of a rule (Warning)
26+
- Flex:
27+
- Missing `%%` section separator (Error)
28+
- Unknown/invalid directive — e.g. `%woops` (Error)
29+
- Undefined start condition used in a rule (`<SC>` not declared with `%x`/`%s`) (Error)
30+
- Undefined abbreviation referenced in a pattern (`{name}` not in definitions section) (Warning)
31+
- Start condition declared but never used in any rule (Info)
32+
- Abbreviation declared but never referenced in any pattern (Info)
33+
- Unclosed `%{ %}` code block (Error)
34+
- Inaccessible rule — catch-all pattern before a specific pattern, or duplicate pattern (Warning)
1835
- **Autocompletion**
1936
- 30+ Bison directives with documentation
2037
- 20+ Flex `%option` values
@@ -32,3 +49,6 @@ All notable changes to the **Bison/Flex Language Support** extension will be doc
3249
- 12 Flex snippets (scanner skeleton, RE-flex skeleton, comment/string handlers)
3350
- **Language configuration**
3451
- Bracket matching, auto-closing pairs, comment toggling, folding
52+
- **File icon theme** (`bison-flex-icons`)
53+
- Distinct orange "B" icon for Bison files (`.y`, `.yy`, `.ypp`, `.bison`)
54+
- Distinct blue "F" icon for Flex files (`.l`, `.ll`, `.lex`, `.flex`)

README.md

Lines changed: 86 additions & 2 deletions
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

@@ -75,6 +81,25 @@ Ready-to-use templates to speed up your workflow:
7581

7682
---
7783

84+
## Screenshots
85+
86+
### Syntax Highlighting
87+
![Syntax highlighting with section-aware coloring and embedded C/C++](images/syntax-highlighting.png)
88+
89+
### Hover Documentation
90+
![Inline hover docs for Bison directives and Flex options](images/hover-docs.png)
91+
92+
### Autocompletion
93+
![Context-aware completions for directives, tokens, and semantic values](images/autocompletion.png)
94+
95+
### Diagnostics
96+
![Real-time error and warning markers for undeclared tokens, missing separators, and more](images/diagnostics.png)
97+
98+
### Snippets
99+
![Code snippet expansion for grammar skeletons and rule templates](images/snippets.png)
100+
101+
---
102+
78103
## Supported File Types
79104

80105
| Language | Extensions | Aliases |
@@ -115,6 +140,65 @@ Then press `F5` in VS Code to launch the Extension Development Host.
115140
|---------|------|---------|-------------|
116141
| `bisonFlex.enableDiagnostics` | `boolean` | `true` | Enable/disable real-time error detection |
117142
| `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.
118202
119203
---
120204

@@ -144,7 +228,7 @@ Contributions are welcome! Here's how to get started:
144228
### Running Tests
145229

146230
```bash
147-
npx ts-node --project server/tsconfig.json test-parsers.ts
231+
npx ts-node --project server/tsconfig.json tests/test-parsers.ts
148232
```
149233

150234
### Building for Production

bison-flex-icon-theme.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"iconDefinitions": {
3+
"_bison": {
4+
"iconPath": "./images/bison-icon.svg"
5+
},
6+
"_flex": {
7+
"iconPath": "./images/flex-icon.svg"
8+
}
9+
},
10+
"fileExtensions": {
11+
"y": "_bison",
12+
"yy": "_bison",
13+
"ypp": "_bison",
14+
"bison": "_bison",
15+
"l": "_flex",
16+
"ll": "_flex",
17+
"lex": "_flex",
18+
"flex": "_flex"
19+
},
20+
"fileNames": {}
21+
}

0 commit comments

Comments
 (0)