mirror of
https://github.com/ivuorinen/tree-sitter-shellspec.git
synced 2026-02-20 13:54:23 +00:00
fix: resolve documentation inconsistencies and add ExampleGroup variants
Documentation Fixes: - README.md: Update test count from 59 to 63 (badge, features, test command) - README.md: Fix lint script references to actual npm scripts - CONTRIBUTING.md: Correct format script reference to npm run format:check - package.json: Remove non-existent yamllint script, split lint:markdown into check/fix variants Grammar Enhancements: - Add fExampleGroup and xExampleGroup to Context block variants - Regenerate parser with new grammar (63/63 tests passing, 100% success rate) Syntax Highlighting: - Add fExampleGroup and xExampleGroup to focused/skipped block highlights - Remove non-matching Data modifier tokens (:raw, :expand, #|) - Add "End" keyword as block terminator Memory File Corrections: - Remove incorrect merge_group trigger references - Remove pr-lint.yml workflow references (deleted in previous optimization) - Update test counts with timestamps (59→63, added 2025-12-11) - Update conflict count (13→5, optimized) Code Style: - Auto-format renovate.json and tree-sitter.json with prettier
This commit is contained in:
4
.github/renovate.json
vendored
4
.github/renovate.json
vendored
@@ -1,4 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends": ["github>ivuorinen/renovate-config"]
|
"extends": [
|
||||||
|
"github>ivuorinen/renovate-config"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -149,9 +149,8 @@ Total: 1,302 lines, 61 tests
|
|||||||
1. **test.yml** - Multi-node testing (Node 22, 24)
|
1. **test.yml** - Multi-node testing (Node 22, 24)
|
||||||
2. **release.yml** - Automated releases
|
2. **release.yml** - Automated releases
|
||||||
3. **codeql.yml** - Security code scanning
|
3. **codeql.yml** - Security code scanning
|
||||||
4. **pr-lint.yml** - Pull request validation
|
4. **stale.yml** - Issue/PR management
|
||||||
5. **stale.yml** - Issue/PR management
|
5. **sync-labels.yml** - Label synchronization
|
||||||
6. **sync-labels.yml** - Label synchronization
|
|
||||||
|
|
||||||
### Custom GitHub Actions
|
### Custom GitHub Actions
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ The project had significant duplication in GitHub Actions workflows, causing unn
|
|||||||
**File**: `.github/workflows/test.yml` → Renamed to "CI"
|
**File**: `.github/workflows/test.yml` → Renamed to "CI"
|
||||||
|
|
||||||
- **Purpose**: Single source of truth for all continuous integration
|
- **Purpose**: Single source of truth for all continuous integration
|
||||||
- **Triggers**: push, pull_request, merge_group to main/master
|
- **Triggers**: push, pull_request to main/master
|
||||||
- **Jobs**: test (matrix), lint, coverage
|
- **Jobs**: test (matrix), lint, coverage
|
||||||
- **Result**: Eliminated duplicate linting, maintained full functionality
|
- **Result**: Eliminated duplicate linting, maintained full functionality
|
||||||
|
|
||||||
|
|||||||
@@ -79,9 +79,10 @@ End
|
|||||||
|
|
||||||
### Test Coverage Added
|
### Test Coverage Added
|
||||||
|
|
||||||
- 59 total tests (up from 53)
|
- 63 total tests (as of 2025-12-11; originally 59, up from 53)
|
||||||
- New `real_world_patterns.txt` test file
|
- New `real_world_patterns.txt` test file
|
||||||
- 6 additional tests covering hook statements, directives, and complex patterns
|
- 6 additional tests covering hook statements, directives, and complex patterns
|
||||||
|
- 4 additional tests for Data block modifiers (added 2025-12-11)
|
||||||
|
|
||||||
## Integration Status
|
## Integration Status
|
||||||
|
|
||||||
@@ -118,8 +119,8 @@ End
|
|||||||
- **Block types**: 5 (Describe, Context, It, Hook, Utility)
|
- **Block types**: 5 (Describe, Context, It, Hook, Utility)
|
||||||
- **Statement types**: 2 (Hook statements, Directives)
|
- **Statement types**: 2 (Hook statements, Directives)
|
||||||
- **Keywords supported**: 25+ ShellSpec keywords
|
- **Keywords supported**: 25+ ShellSpec keywords
|
||||||
- **Test coverage**: 100% (59/59 tests passing)
|
- **Test coverage**: 100% (63/63 tests passing as of 2025-12-11)
|
||||||
- **Conflict warnings**: 13 (mostly unnecessary, can be optimized)
|
- **Conflict warnings**: 5 (optimized from 13, all necessary)
|
||||||
|
|
||||||
## Recommendations for Future Development
|
## Recommendations for Future Development
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ git clone https://github.com/YOUR_USERNAME/tree-sitter-shellspec.git
|
|||||||
cd tree-sitter-shellspec
|
cd tree-sitter-shellspec
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Add the upstream repository:
|
1. Add the upstream repository:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git remote add upstream https://github.com/ivuorinen/tree-sitter-shellspec.git
|
git remote add upstream https://github.com/ivuorinen/tree-sitter-shellspec.git
|
||||||
@@ -47,19 +47,19 @@ git remote add upstream https://github.com/ivuorinen/tree-sitter-shellspec.git
|
|||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Generate the grammar:**
|
1. **Generate the grammar:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run generate
|
npm run generate
|
||||||
```
|
```
|
||||||
|
|
||||||
3. **Run tests:**
|
1. **Run tests:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm test
|
npm test
|
||||||
```
|
```
|
||||||
|
|
||||||
4. **Build the parser:**
|
1. **Build the parser:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run build
|
npm run build
|
||||||
@@ -200,7 +200,7 @@ tree-sitter test --debug
|
|||||||
### Before Submitting
|
### Before Submitting
|
||||||
|
|
||||||
1. **Ensure all tests pass:** `npm test`
|
1. **Ensure all tests pass:** `npm test`
|
||||||
2. **Check code style:** `npm run lint && npm run format -- --check`
|
2. **Check code style:** `npm run lint && npm run format:check`
|
||||||
3. **Update documentation** if needed
|
3. **Update documentation** if needed
|
||||||
4. **Test with real ShellSpec files** when possible
|
4. **Test with real ShellSpec files** when possible
|
||||||
5. **Run the full development cycle:** `npm run rebuild`
|
5. **Run the full development cycle:** `npm run rebuild`
|
||||||
@@ -213,9 +213,9 @@ tree-sitter test --debug
|
|||||||
git checkout -b feature/your-feature-name
|
git checkout -b feature/your-feature-name
|
||||||
```
|
```
|
||||||
|
|
||||||
2. **Make your changes** following the guidelines above
|
1. **Make your changes** following the guidelines above
|
||||||
|
|
||||||
3. **Commit with clear messages:**
|
2. **Commit with clear messages:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git commit -m "feat: add support for Data block modifiers
|
git commit -m "feat: add support for Data block modifiers
|
||||||
@@ -225,13 +225,13 @@ git commit -m "feat: add support for Data block modifiers
|
|||||||
- Add documentation examples"
|
- Add documentation examples"
|
||||||
```
|
```
|
||||||
|
|
||||||
4. **Push to your fork:**
|
1. **Push to your fork:**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git push origin feature/your-feature-name
|
git push origin feature/your-feature-name
|
||||||
```
|
```
|
||||||
|
|
||||||
5. **Create a Pull Request** with:
|
1. **Create a Pull Request** with:
|
||||||
|
|
||||||
- Clear description of changes
|
- Clear description of changes
|
||||||
- References to related issues
|
- References to related issues
|
||||||
@@ -288,13 +288,13 @@ Use the [Grammar Issue template](.github/ISSUE_TEMPLATE/grammar_issue.md) for:
|
|||||||
- Pipe filter syntax (`Data | command`)
|
- Pipe filter syntax (`Data | command`)
|
||||||
- Multi-line `#|` syntax
|
- Multi-line `#|` syntax
|
||||||
|
|
||||||
2. **Assertion parsing**
|
1. **Assertion parsing**
|
||||||
|
|
||||||
- When/The statement structures
|
- When/The statement structures
|
||||||
- Matcher syntax parsing
|
- Matcher syntax parsing
|
||||||
- Subject/predicate analysis
|
- Subject/predicate analysis
|
||||||
|
|
||||||
3. **Performance optimization**
|
1. **Performance optimization**
|
||||||
|
|
||||||
- Reduce parser conflicts
|
- Reduce parser conflicts
|
||||||
- Optimize grammar rules
|
- Optimize grammar rules
|
||||||
@@ -308,13 +308,13 @@ Use the [Grammar Issue template](.github/ISSUE_TEMPLATE/grammar_issue.md) for:
|
|||||||
- VS Code extension support
|
- VS Code extension support
|
||||||
- Emacs tree-sitter integration
|
- Emacs tree-sitter integration
|
||||||
|
|
||||||
2. **Tooling improvements**
|
1. **Tooling improvements**
|
||||||
|
|
||||||
- Syntax highlighting themes
|
- Syntax highlighting themes
|
||||||
- Language server features
|
- Language server features
|
||||||
- Code formatting rules
|
- Code formatting rules
|
||||||
|
|
||||||
3. **Documentation**
|
1. **Documentation**
|
||||||
|
|
||||||
- Usage tutorials
|
- Usage tutorials
|
||||||
- Grammar development guide
|
- Grammar development guide
|
||||||
|
|||||||
13
README.md
13
README.md
@@ -1,6 +1,6 @@
|
|||||||
# tree-sitter-shellspec
|
# tree-sitter-shellspec
|
||||||
|
|
||||||
[](https://github.com/ivuorinen/tree-sitter-shellspec)
|
[](https://github.com/ivuorinen/tree-sitter-shellspec)
|
||||||
[](https://github.com/ivuorinen/tree-sitter-shellspec)
|
[](https://github.com/ivuorinen/tree-sitter-shellspec)
|
||||||
[](https://tree-sitter.github.io/)
|
[](https://tree-sitter.github.io/)
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ It enables syntax highlighting, code navigation, and tooling integration for She
|
|||||||
- **Complete ShellSpec syntax support** - All block types, hooks, and utility constructs
|
- **Complete ShellSpec syntax support** - All block types, hooks, and utility constructs
|
||||||
- **Real-world compatibility** - Tested against official ShellSpec examples
|
- **Real-world compatibility** - Tested against official ShellSpec examples
|
||||||
- **Bash integration** - Seamlessly handles mixed ShellSpec/bash code
|
- **Bash integration** - Seamlessly handles mixed ShellSpec/bash code
|
||||||
- **Production ready** - 100% test coverage with 59 comprehensive test cases
|
- **Production ready** - 100% test coverage with 63 comprehensive test cases
|
||||||
- **Editor support** - Works with any Tree-sitter compatible editor
|
- **Editor support** - Works with any Tree-sitter compatible editor
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
@@ -241,7 +241,7 @@ npm install
|
|||||||
# Generate parser from grammar
|
# Generate parser from grammar
|
||||||
npm run generate
|
npm run generate
|
||||||
|
|
||||||
# Run test suite (59 comprehensive tests)
|
# Run test suite (63 comprehensive tests)
|
||||||
npm test
|
npm test
|
||||||
|
|
||||||
# Build the parser
|
# Build the parser
|
||||||
@@ -252,9 +252,10 @@ npm run dev # Generate + test
|
|||||||
npm run dev:watch # Watch mode for development
|
npm run dev:watch # Watch mode for development
|
||||||
|
|
||||||
# Linting and formatting
|
# Linting and formatting
|
||||||
npm run lint # Check code style
|
npm run lint # Check code style
|
||||||
npm run lint:fix # Auto-fix style issues
|
npm run lint:editorconfig:fix # Auto-fix EditorConfig issues
|
||||||
npm run format # Format code
|
npm run lint:markdown # Auto-fix markdown issues (includes --fix)
|
||||||
|
npm run format # Format code with prettier
|
||||||
|
|
||||||
# Utilities
|
# Utilities
|
||||||
npm run clean # Clean generated files
|
npm run clean # Clean generated files
|
||||||
|
|||||||
@@ -83,7 +83,14 @@ module.exports = grammar(bashGrammar, {
|
|||||||
prec.right(
|
prec.right(
|
||||||
1,
|
1,
|
||||||
seq(
|
seq(
|
||||||
choice("Context", "ExampleGroup", "fContext", "xContext"),
|
choice(
|
||||||
|
"Context",
|
||||||
|
"ExampleGroup",
|
||||||
|
"fContext",
|
||||||
|
"xContext",
|
||||||
|
"fExampleGroup",
|
||||||
|
"xExampleGroup",
|
||||||
|
),
|
||||||
field("description", choice($.string, $.raw_string, $.word)),
|
field("description", choice($.string, $.raw_string, $.word)),
|
||||||
repeat($._terminated_statement),
|
repeat($._terminated_statement),
|
||||||
"End",
|
"End",
|
||||||
|
|||||||
@@ -27,8 +27,8 @@
|
|||||||
"dev": "npm run generate && npm run test",
|
"dev": "npm run generate && npm run test",
|
||||||
"dev:watch": "nodemon --watch grammar.js --watch test/ --ext js,txt --exec 'npm run dev'",
|
"dev:watch": "nodemon --watch grammar.js --watch test/ --ext js,txt --exec 'npm run dev'",
|
||||||
"lint": "npx mega-linter-runner",
|
"lint": "npx mega-linter-runner",
|
||||||
"lint:yaml": "yamllint .",
|
"lint:markdown": "markdownlint . --config .markdownlint.json --ignore node_modules",
|
||||||
"lint:markdown": "markdownlint . --config .markdownlint.json --ignore node_modules --fix",
|
"lint:markdown:fix": "markdownlint . --config .markdownlint.json --ignore node_modules --fix",
|
||||||
"lint:editorconfig": "eclint check .",
|
"lint:editorconfig": "eclint check .",
|
||||||
"lint:editorconfig:fix": "eclint fix .",
|
"lint:editorconfig:fix": "eclint fix .",
|
||||||
"format": "prettier --write .",
|
"format": "prettier --write .",
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
[
|
[
|
||||||
"fDescribe"
|
"fDescribe"
|
||||||
"fContext"
|
"fContext"
|
||||||
|
"fExampleGroup"
|
||||||
"fIt"
|
"fIt"
|
||||||
"fExample"
|
"fExample"
|
||||||
"fSpecify"
|
"fSpecify"
|
||||||
@@ -24,6 +25,7 @@
|
|||||||
[
|
[
|
||||||
"xDescribe"
|
"xDescribe"
|
||||||
"xContext"
|
"xContext"
|
||||||
|
"xExampleGroup"
|
||||||
"xIt"
|
"xIt"
|
||||||
"xExample"
|
"xExample"
|
||||||
"xSpecify"
|
"xSpecify"
|
||||||
@@ -61,13 +63,6 @@
|
|||||||
"End"
|
"End"
|
||||||
] @keyword.control
|
] @keyword.control
|
||||||
|
|
||||||
; Data block modifiers
|
|
||||||
[
|
|
||||||
":raw"
|
|
||||||
":expand"
|
|
||||||
"#|"
|
|
||||||
] @keyword.modifier
|
|
||||||
|
|
||||||
; Directives
|
; Directives
|
||||||
[
|
[
|
||||||
"Include"
|
"Include"
|
||||||
|
|||||||
@@ -7072,6 +7072,14 @@
|
|||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
"value": "xContext"
|
"value": "xContext"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "fExampleGroup"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "xExampleGroup"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -7923,4 +7931,4 @@
|
|||||||
"_primary_expression"
|
"_primary_expression"
|
||||||
],
|
],
|
||||||
"reserved": {}
|
"reserved": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3143,6 +3143,10 @@
|
|||||||
"type": "fExample",
|
"type": "fExample",
|
||||||
"named": false
|
"named": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "fExampleGroup",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "fIt",
|
"type": "fIt",
|
||||||
"named": false
|
"named": false
|
||||||
@@ -3271,6 +3275,10 @@
|
|||||||
"type": "xExample",
|
"type": "xExample",
|
||||||
"named": false
|
"named": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "xExampleGroup",
|
||||||
|
"named": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "xIt",
|
"type": "xIt",
|
||||||
"named": false
|
"named": false
|
||||||
@@ -3307,4 +3315,4 @@
|
|||||||
"type": "~",
|
"type": "~",
|
||||||
"named": false
|
"named": false
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
1690
src/parser.c
1690
src/parser.c
File diff suppressed because it is too large
Load Diff
@@ -152,6 +152,7 @@ struct TSLanguage {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static inline bool set_contains(const TSCharacterRange *ranges, uint32_t len, int32_t lookahead) {
|
static inline bool set_contains(const TSCharacterRange *ranges, uint32_t len, int32_t lookahead) {
|
||||||
|
if (len == 0) return false;
|
||||||
uint32_t index = 0;
|
uint32_t index = 0;
|
||||||
uint32_t size = len - index;
|
uint32_t size = len - index;
|
||||||
while (size > 1) {
|
while (size > 1) {
|
||||||
|
|||||||
@@ -5,9 +5,15 @@
|
|||||||
"camelcase": "Shellspec",
|
"camelcase": "Shellspec",
|
||||||
"scope": "source.shellspec",
|
"scope": "source.shellspec",
|
||||||
"path": ".",
|
"path": ".",
|
||||||
"file-types": ["shellspec"],
|
"file-types": [
|
||||||
"highlights": ["queries/highlights.scm"],
|
"shellspec"
|
||||||
"locals": ["queries/locals.scm"],
|
],
|
||||||
|
"highlights": [
|
||||||
|
"queries/highlights.scm"
|
||||||
|
],
|
||||||
|
"locals": [
|
||||||
|
"queries/locals.scm"
|
||||||
|
],
|
||||||
"injection-regex": "shellspec"
|
"injection-regex": "shellspec"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user