mirror of
https://github.com/ivuorinen/tree-sitter-shellspec.git
synced 2026-01-26 03:34:03 +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",
|
||||
"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)
|
||||
2. **release.yml** - Automated releases
|
||||
3. **codeql.yml** - Security code scanning
|
||||
4. **pr-lint.yml** - Pull request validation
|
||||
5. **stale.yml** - Issue/PR management
|
||||
6. **sync-labels.yml** - Label synchronization
|
||||
4. **stale.yml** - Issue/PR management
|
||||
5. **sync-labels.yml** - Label synchronization
|
||||
|
||||
### 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"
|
||||
|
||||
- **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
|
||||
- **Result**: Eliminated duplicate linting, maintained full functionality
|
||||
|
||||
|
||||
@@ -79,9 +79,10 @@ End
|
||||
|
||||
### 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
|
||||
- 6 additional tests covering hook statements, directives, and complex patterns
|
||||
- 4 additional tests for Data block modifiers (added 2025-12-11)
|
||||
|
||||
## Integration Status
|
||||
|
||||
@@ -118,8 +119,8 @@ End
|
||||
- **Block types**: 5 (Describe, Context, It, Hook, Utility)
|
||||
- **Statement types**: 2 (Hook statements, Directives)
|
||||
- **Keywords supported**: 25+ ShellSpec keywords
|
||||
- **Test coverage**: 100% (59/59 tests passing)
|
||||
- **Conflict warnings**: 13 (mostly unnecessary, can be optimized)
|
||||
- **Test coverage**: 100% (63/63 tests passing as of 2025-12-11)
|
||||
- **Conflict warnings**: 5 (optimized from 13, all necessary)
|
||||
|
||||
## Recommendations for Future Development
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ git clone https://github.com/YOUR_USERNAME/tree-sitter-shellspec.git
|
||||
cd tree-sitter-shellspec
|
||||
```
|
||||
|
||||
3. Add the upstream repository:
|
||||
1. Add the upstream repository:
|
||||
|
||||
```bash
|
||||
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
|
||||
```
|
||||
|
||||
2. **Generate the grammar:**
|
||||
1. **Generate the grammar:**
|
||||
|
||||
```bash
|
||||
npm run generate
|
||||
```
|
||||
|
||||
3. **Run tests:**
|
||||
1. **Run tests:**
|
||||
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
|
||||
4. **Build the parser:**
|
||||
1. **Build the parser:**
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
@@ -200,7 +200,7 @@ tree-sitter test --debug
|
||||
### Before Submitting
|
||||
|
||||
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
|
||||
4. **Test with real ShellSpec files** when possible
|
||||
5. **Run the full development cycle:** `npm run rebuild`
|
||||
@@ -213,9 +213,9 @@ tree-sitter test --debug
|
||||
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
|
||||
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"
|
||||
```
|
||||
|
||||
4. **Push to your fork:**
|
||||
1. **Push to your fork:**
|
||||
|
||||
```bash
|
||||
git push origin feature/your-feature-name
|
||||
```
|
||||
|
||||
5. **Create a Pull Request** with:
|
||||
1. **Create a Pull Request** with:
|
||||
|
||||
- Clear description of changes
|
||||
- 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`)
|
||||
- Multi-line `#|` syntax
|
||||
|
||||
2. **Assertion parsing**
|
||||
1. **Assertion parsing**
|
||||
|
||||
- When/The statement structures
|
||||
- Matcher syntax parsing
|
||||
- Subject/predicate analysis
|
||||
|
||||
3. **Performance optimization**
|
||||
1. **Performance optimization**
|
||||
|
||||
- Reduce parser conflicts
|
||||
- Optimize grammar rules
|
||||
@@ -308,13 +308,13 @@ Use the [Grammar Issue template](.github/ISSUE_TEMPLATE/grammar_issue.md) for:
|
||||
- VS Code extension support
|
||||
- Emacs tree-sitter integration
|
||||
|
||||
2. **Tooling improvements**
|
||||
1. **Tooling improvements**
|
||||
|
||||
- Syntax highlighting themes
|
||||
- Language server features
|
||||
- Code formatting rules
|
||||
|
||||
3. **Documentation**
|
||||
1. **Documentation**
|
||||
|
||||
- Usage tutorials
|
||||
- Grammar development guide
|
||||
|
||||
13
README.md
13
README.md
@@ -1,6 +1,6 @@
|
||||
# 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/)
|
||||
|
||||
@@ -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
|
||||
- **Real-world compatibility** - Tested against official ShellSpec examples
|
||||
- **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
|
||||
|
||||
## Installation
|
||||
@@ -241,7 +241,7 @@ npm install
|
||||
# Generate parser from grammar
|
||||
npm run generate
|
||||
|
||||
# Run test suite (59 comprehensive tests)
|
||||
# Run test suite (63 comprehensive tests)
|
||||
npm test
|
||||
|
||||
# Build the parser
|
||||
@@ -252,9 +252,10 @@ npm run dev # Generate + test
|
||||
npm run dev:watch # Watch mode for development
|
||||
|
||||
# Linting and formatting
|
||||
npm run lint # Check code style
|
||||
npm run lint:fix # Auto-fix style issues
|
||||
npm run format # Format code
|
||||
npm run lint # Check code style
|
||||
npm run lint:editorconfig:fix # Auto-fix EditorConfig issues
|
||||
npm run lint:markdown # Auto-fix markdown issues (includes --fix)
|
||||
npm run format # Format code with prettier
|
||||
|
||||
# Utilities
|
||||
npm run clean # Clean generated files
|
||||
|
||||
@@ -83,7 +83,14 @@ module.exports = grammar(bashGrammar, {
|
||||
prec.right(
|
||||
1,
|
||||
seq(
|
||||
choice("Context", "ExampleGroup", "fContext", "xContext"),
|
||||
choice(
|
||||
"Context",
|
||||
"ExampleGroup",
|
||||
"fContext",
|
||||
"xContext",
|
||||
"fExampleGroup",
|
||||
"xExampleGroup",
|
||||
),
|
||||
field("description", choice($.string, $.raw_string, $.word)),
|
||||
repeat($._terminated_statement),
|
||||
"End",
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
"dev": "npm run generate && npm run test",
|
||||
"dev:watch": "nodemon --watch grammar.js --watch test/ --ext js,txt --exec 'npm run dev'",
|
||||
"lint": "npx mega-linter-runner",
|
||||
"lint:yaml": "yamllint .",
|
||||
"lint:markdown": "markdownlint . --config .markdownlint.json --ignore node_modules --fix",
|
||||
"lint:markdown": "markdownlint . --config .markdownlint.json --ignore node_modules",
|
||||
"lint:markdown:fix": "markdownlint . --config .markdownlint.json --ignore node_modules --fix",
|
||||
"lint:editorconfig": "eclint check .",
|
||||
"lint:editorconfig:fix": "eclint fix .",
|
||||
"format": "prettier --write .",
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
[
|
||||
"fDescribe"
|
||||
"fContext"
|
||||
"fExampleGroup"
|
||||
"fIt"
|
||||
"fExample"
|
||||
"fSpecify"
|
||||
@@ -24,6 +25,7 @@
|
||||
[
|
||||
"xDescribe"
|
||||
"xContext"
|
||||
"xExampleGroup"
|
||||
"xIt"
|
||||
"xExample"
|
||||
"xSpecify"
|
||||
@@ -61,13 +63,6 @@
|
||||
"End"
|
||||
] @keyword.control
|
||||
|
||||
; Data block modifiers
|
||||
[
|
||||
":raw"
|
||||
":expand"
|
||||
"#|"
|
||||
] @keyword.modifier
|
||||
|
||||
; Directives
|
||||
[
|
||||
"Include"
|
||||
|
||||
@@ -7072,6 +7072,14 @@
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "xContext"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "fExampleGroup"
|
||||
},
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": "xExampleGroup"
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -7923,4 +7931,4 @@
|
||||
"_primary_expression"
|
||||
],
|
||||
"reserved": {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3143,6 +3143,10 @@
|
||||
"type": "fExample",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "fExampleGroup",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "fIt",
|
||||
"named": false
|
||||
@@ -3271,6 +3275,10 @@
|
||||
"type": "xExample",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "xExampleGroup",
|
||||
"named": false
|
||||
},
|
||||
{
|
||||
"type": "xIt",
|
||||
"named": false
|
||||
@@ -3307,4 +3315,4 @@
|
||||
"type": "~",
|
||||
"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) {
|
||||
if (len == 0) return false;
|
||||
uint32_t index = 0;
|
||||
uint32_t size = len - index;
|
||||
while (size > 1) {
|
||||
|
||||
@@ -5,9 +5,15 @@
|
||||
"camelcase": "Shellspec",
|
||||
"scope": "source.shellspec",
|
||||
"path": ".",
|
||||
"file-types": ["shellspec"],
|
||||
"highlights": ["queries/highlights.scm"],
|
||||
"locals": ["queries/locals.scm"],
|
||||
"file-types": [
|
||||
"shellspec"
|
||||
],
|
||||
"highlights": [
|
||||
"queries/highlights.scm"
|
||||
],
|
||||
"locals": [
|
||||
"queries/locals.scm"
|
||||
],
|
||||
"injection-regex": "shellspec"
|
||||
}
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user