Skip to main content

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: 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

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

  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

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 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

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)

Source distribution for tree-sitter-lotus 0.1.1
File Size Uploaded
tree_sitter_lotus-0.1.1.tar.gz 67.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tree-sitter-lotus 0.1.1
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page