# tree-sitter-lotus
Tree-sitter grammar for LotusScript, the programming language used in IBM Lotus Notes and Domino.
## Installation
### Python Package (PyPI)
```bash
pip install tree-sitter-lotus
```
**Note**: This package requires `tree-sitter>=0.24.0` for compatibility with ABI version 15.
### Node.js Package (npm)
```bash
npm install tree-sitter-lotus
```
## Features
This grammar supports the core LotusScript syntax including:
- **Option statements**: `Option Public`, `Option Private`, `Option Declare`, `Option Explicit`
- **Subroutines and Functions**: `Sub` and `Function` declarations with parameters
- **Classes**: `Class` declarations with methods and properties
- **Control structures**: `If...Then...Else`, `For...Next`, `Do...Loop`, `While...Wend`, `Select Case`
- **Variable declarations**: `Dim`, `Set`, `Let` statements
- **Expressions**: Arithmetic, comparison, and logical expressions
- **Comments**: Single quote (`'`) and `Rem` comments
- **Function calls**: Method calls and member expressions
## Usage
### Python
```python
import tree_sitter
import tree_sitter_lotus
# Create a parser
parser = tree_sitter.Parser()
language = tree_sitter.Language(tree_sitter_lotus.language())
parser.language = language
# Parse some LotusScript code
code = """
Option Public
Sub HelloWorld(name As String)
Dim message As String
message = "Hello, " & name & "!"
Call PrintMessage(message)
End Sub
"""
tree = parser.parse(code.encode('utf-8'))
root = tree.root_node
# Explore the syntax tree
print(f"Root node type: {root.type}")
for child in root.children:
print(f" - {child.type}: {child.text.decode('utf-8')}")
```
### Node.js
```javascript
const Parser = require('tree-sitter');
const LotusScript = require('tree-sitter-lotus');
const parser = new Parser();
parser.setLanguage(LotusScript);
const sourceCode = `
Option Public
Sub HelloWorld(name As String)
Dim message As String
message = "Hello, " & name & "!"
Call PrintMessage(message)
End Sub
Function AddNumbers(a As Integer, b As Integer) As Integer
AddNumbers = a + b
End Function
`;
const tree = parser.parse(sourceCode);
console.log(tree.rootNode.toString());
```
### In VS Code
1. Install the grammar package
2. VS Code will automatically use it for `.lss` and `.ls` files
3. You'll get syntax highlighting and parsing for LotusScript files
## Development
### Building the grammar
```bash
npm run generate
```
### Running tests
```bash
npm test
```
### Parsing a file
```bash
npm run parse path/to/your/file.lss
```
## Grammar Structure
The grammar recognizes the following main constructs:
- `source_file`: Top-level container for all statements
- `option_stmt`: Option declarations
- `class_decl`: Class definitions
- `sub_decl`: Subroutine definitions
- `function_decl`: Function definitions
- `statement`: Various statement types
- `expression`: Expression parsing with operator precedence
## Compatibility
### Python
- **Python**: 3.9+
- **tree-sitter**: 0.24.0+ (for ABI 15 compatibility)
- **Platforms**: Windows, macOS, Linux
### Node.js
- **Node.js**: 12+
- **Platforms**: Windows, macOS, Linux
## Contributing
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests for new features
5. Submit a pull request
## License
MIT License - see LICENSE file for details.
## Related
- [Tree-sitter](https://tree-sitter.github.io/tree-sitter/)
- [LotusScript Language Reference](https://help.hcltechsw.com/domino/11.0.1/programming/programming.html)
Raw data
{
"_id": null,
"home_page": "https://github.com/adaptsai/tree-sitter-lotus.git",
"name": "tree-sitter-lotus",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "incremental, parsing, tree-sitter, lotus",
"author": "adapts",
"author_email": "sheel@adapts.ai",
"download_url": "https://files.pythonhosted.org/packages/3c/5f/2c882d2dac4bae675a207331145c45b958644998de467b19b8b6b350bee3/tree_sitter_lotus-0.1.1.tar.gz",
"platform": null,
"description": "# tree-sitter-lotus\n\nTree-sitter grammar for LotusScript, the programming language used in IBM Lotus Notes and Domino.\n\n## Installation\n\n### Python Package (PyPI)\n\n```bash\npip install tree-sitter-lotus\n```\n\n**Note**: This package requires `tree-sitter>=0.24.0` for compatibility with ABI version 15.\n\n### Node.js Package (npm)\n\n```bash\nnpm install tree-sitter-lotus\n```\n\n## Features\n\nThis grammar supports the core LotusScript syntax including:\n\n- **Option statements**: `Option Public`, `Option Private`, `Option Declare`, `Option Explicit`\n- **Subroutines and Functions**: `Sub` and `Function` declarations with parameters\n- **Classes**: `Class` declarations with methods and properties\n- **Control structures**: `If...Then...Else`, `For...Next`, `Do...Loop`, `While...Wend`, `Select Case`\n- **Variable declarations**: `Dim`, `Set`, `Let` statements\n- **Expressions**: Arithmetic, comparison, and logical expressions\n- **Comments**: Single quote (`'`) and `Rem` comments\n- **Function calls**: Method calls and member expressions\n\n## Usage\n\n### Python\n\n```python\nimport tree_sitter\nimport tree_sitter_lotus\n\n# Create a parser\nparser = tree_sitter.Parser()\nlanguage = tree_sitter.Language(tree_sitter_lotus.language())\nparser.language = language\n\n# Parse some LotusScript code\ncode = \"\"\"\nOption Public\n\nSub HelloWorld(name As String)\n Dim message As String\n message = \"Hello, \" & name & \"!\"\n Call PrintMessage(message)\nEnd Sub\n\"\"\"\n\ntree = parser.parse(code.encode('utf-8'))\nroot = tree.root_node\n\n# Explore the syntax tree\nprint(f\"Root node type: {root.type}\")\nfor child in root.children:\n print(f\" - {child.type}: {child.text.decode('utf-8')}\")\n```\n\n### Node.js\n\n```javascript\nconst Parser = require('tree-sitter');\nconst LotusScript = require('tree-sitter-lotus');\n\nconst parser = new Parser();\nparser.setLanguage(LotusScript);\n\nconst sourceCode = `\nOption Public\n\nSub HelloWorld(name As String)\n Dim message As String\n message = \"Hello, \" & name & \"!\"\n Call PrintMessage(message)\nEnd Sub\n\nFunction AddNumbers(a As Integer, b As Integer) As Integer\n AddNumbers = a + b\nEnd Function\n`;\n\nconst tree = parser.parse(sourceCode);\nconsole.log(tree.rootNode.toString());\n```\n\n### In VS Code\n\n1. Install the grammar package\n2. VS Code will automatically use it for `.lss` and `.ls` files\n3. You'll get syntax highlighting and parsing for LotusScript files\n\n## Development\n\n### Building the grammar\n\n```bash\nnpm run generate\n```\n\n### Running tests\n\n```bash\nnpm test\n```\n\n### Parsing a file\n\n```bash\nnpm run parse path/to/your/file.lss\n```\n\n## Grammar Structure\n\nThe grammar recognizes the following main constructs:\n\n- `source_file`: Top-level container for all statements\n- `option_stmt`: Option declarations\n- `class_decl`: Class definitions\n- `sub_decl`: Subroutine definitions\n- `function_decl`: Function definitions\n- `statement`: Various statement types\n- `expression`: Expression parsing with operator precedence\n\n## Compatibility\n\n### Python\n- **Python**: 3.9+\n- **tree-sitter**: 0.24.0+ (for ABI 15 compatibility)\n- **Platforms**: Windows, macOS, Linux\n\n### Node.js\n- **Node.js**: 12+\n- **Platforms**: Windows, macOS, Linux\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests for new features\n5. Submit a pull request\n\n## License\n\nMIT License - see LICENSE file for details.\n\n## Related\n\n- [Tree-sitter](https://tree-sitter.github.io/tree-sitter/)\n- [LotusScript Language Reference](https://help.hcltechsw.com/domino/11.0.1/programming/programming.html) \n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Tree-sitter grammar for LotusScript",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://github.com/adaptsai/tree-sitter-lotus.git"
},
"split_keywords": [
"incremental",
" parsing",
" tree-sitter",
" lotus"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "88a867084fdaa80055b79829f3fd36e141078ba30be2c20c13764083ebd632b1",
"md5": "8b6db0363767a733c6b6cc2486e7da33",
"sha256": "66d35e9d9b468587627d9ae4cc93f1e3ad5e17d8b5aca1a1cc5287b91e740f95"
},
"downloads": -1,
"filename": "tree_sitter_lotus-0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl",
"has_sig": false,
"md5_digest": "8b6db0363767a733c6b6cc2486e7da33",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 49024,
"upload_time": "2025-07-21T09:33:39",
"upload_time_iso_8601": "2025-07-21T09:33:39.753749Z",
"url": "https://files.pythonhosted.org/packages/88/a8/67084fdaa80055b79829f3fd36e141078ba30be2c20c13764083ebd632b1/tree_sitter_lotus-0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "3c5f2c882d2dac4bae675a207331145c45b958644998de467b19b8b6b350bee3",
"md5": "fc9cf2d79cc9530f1866ccee20586d11",
"sha256": "ceb32977251aa3f969bae721347040b2fde1752e4200ddf90a7c6211c6feffc9"
},
"downloads": -1,
"filename": "tree_sitter_lotus-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "fc9cf2d79cc9530f1866ccee20586d11",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 67128,
"upload_time": "2025-07-21T09:33:42",
"upload_time_iso_8601": "2025-07-21T09:33:42.098153Z",
"url": "https://files.pythonhosted.org/packages/3c/5f/2c882d2dac4bae675a207331145c45b958644998de467b19b8b6b350bee3/tree_sitter_lotus-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-21 09:33:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "adaptsai",
"github_project": "tree-sitter-lotus",
"github_not_found": true,
"lcname": "tree-sitter-lotus"
}