tree-sitter-lotus
Tree-sitter grammar for LotusScript, the programming language used in IBM Lotus Notes and Domino.
Installation
Python Package (PyPI)
pip install tree-sitter-lotus
Note: This package requires tree-sitter>=0.24.0 for compatibility with ABI version 15.
Node.js Package (npm)
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:
SubandFunctiondeclarations with parameters - Classes:
Classdeclarations with methods and properties - Control structures:
If...Then...Else,For...Next,Do...Loop,While...Wend,Select Case - Variable declarations:
Dim,Set,Letstatements - Expressions: Arithmetic, comparison, and logical expressions
- Comments: Single quote (
') andRemcomments - Function calls: Method calls and member expressions
Usage
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
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
- Install the grammar package
- VS Code will automatically use it for
.lssand.lsfiles - You'll get syntax highlighting and parsing for LotusScript files
Development
Building the grammar
npm run generate
Running tests
npm test
Parsing a file
npm run parse path/to/your/file.lss
Grammar Structure
The grammar recognizes the following main constructs:
source_file: Top-level container for all statementsoption_stmt: Option declarationsclass_decl: Class definitionssub_decl: Subroutine definitionsfunction_decl: Function definitionsstatement: Various statement typesexpression: 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
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new features
- Submit a pull request
License
MIT License - see LICENSE file for details.
Related
Release files for tree-sitter-lotus 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tree_sitter_lotus-0.1.1.tar.gz | 67.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tree_sitter_lotus-0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64, Linux glibc 2.28+ x86-64 | Details |
Total release size: 116.2 kB
Release files / tree_sitter_lotus-0.1.1.tar.gz
| Download URL | tree_sitter_lotus-0.1.1.tar.gz |
|---|---|
| Size | 67.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ceb32977251aa3f969bae721347040b2fde1752e4200ddf90a7c6211c6feffc9
|
|
BLAKE2b-256 checksum How to use checksums |
3c5f2c882d2dac4bae675a207331145c45b958644998de467b19b8b6b350bee3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.12
|
Release files / tree_sitter_lotus-0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | tree_sitter_lotus-0.1.1-cp39-abi3-manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 49.0 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
66d35e9d9b468587627d9ae4cc93f1e3ad5e17d8b5aca1a1cc5287b91e740f95
|
|
BLAKE2b-256 checksum How to use checksums |
88a867084fdaa80055b79829f3fd36e141078ba30be2c20c13764083ebd632b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.12
|