tree-sitter-lotus
v1.0.0
Published
Tree-sitter grammar for LotusScript
Downloads
15
Maintainers
Readme
tree-sitter-lotus
Tree-sitter grammar for LotusScript, the programming language used in IBM Lotus Notes and Domino.
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
Installation
npm install tree-sitter-lotusUsage
In 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 generateRunning tests
npm testParsing a file
npm run parse path/to/your/file.lssGrammar 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
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.
