@pb-shrugged/tree-sitter-powerbuilder
v2.0.6
Published
Powerbuilder grammar for tree-sitter
Downloads
12
Maintainers
Readme
tree-sitter-powerbuilder
A Tree-sitter grammar for PowerBuilder, providing syntax highlighting, code navigation, and parsing capabilities for PowerBuilder source files.
Features
- 🎯 Complete PowerBuilder Grammar: Supports PowerBuilder syntax including objects, functions, events, and data types
- 🌐 Multi-Platform: Works on Linux, Windows, and macOS
- 📦 Multiple Bindings: Available for Node.js, Python, Rust, Go, Swift, and C
- 🚀 WebAssembly Support: Can be used in web browsers
- 🔧 IDE Integration: Compatible with editors that support Tree-sitter
- ⚡ Fast Parsing: Incremental parsing for efficient code analysis
Supported File Types
.srs- Structure.srf- Function.srw- Window.sru- User Object.sra- Application.srm- Menu.srd- DataWindow Syntax
Installation
NPM (Node.js)
npm install tree-sitter-powerbuilderUsage with Tree-sitter CLI
# Install tree-sitter CLI
npm install -g tree-sitter-cli
# Clone this repository
git clone https://github.com/pb-shrugged/tree-sitter-powerbuilder.git
cd tree-sitter-powerbuilder
# Generate the parser
tree-sitter generate
# Test the parser
tree-sitter test
# Parse a PowerBuilder file
tree-sitter parse path/to/your/file.sruUsage
Node.js
const Parser = require('tree-sitter');
const PowerBuilder = require('tree-sitter-powerbuilder');
const parser = new Parser();
parser.setLanguage(PowerBuilder);
const sourceCode = `
global type w_main from window
end type
on w_main.create
// Window creation code
end on
`;
const tree = parser.parse(sourceCode);
console.log(tree.rootNode.toString());Development
Prerequisites
- Node.js 18+
- tree-sitter CLI:
npm install -g tree-sitter-cli
Setup
git clone https://github.com/pb-shrugged/tree-sitter-powerbuilder.git
cd tree-sitter-powerbuilder
npm installDevelopment Commands
# Generate the grammar
npm run ts:generate
# Run tests
npm run ts:test
# Build WebAssembly
npm run ts:run
# Lint code
npm run lint
# Run all tests
npm testCI/CD Pipeline
This project uses GitHub Actions for continuous integration and deployment:
- CI Workflow: Runs tests on every push and pull request across multiple platforms
- Release Workflow: Automatically creates GitHub releases when tags are pushed
- Publish Workflow: Automatically publishes to NPM when releases are created
- Security Workflow: Regular security audits and dependency reviews
Automated Releases
To create a new release:
- Use the "Update Version" workflow in GitHub Actions, or
- Manually create a tag:
git tag v1.0.0 && git push origin v1.0.0
The release process will automatically:
- Create a GitHub release with assets
- Publish the package to NPM
- Generate cross-platform binaries
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Quick Start for Contributors
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and add tests
- Run tests:
npm run ts:test - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Tree-sitter for the parsing framework
- PowerBuilder community for language insights and feedback
