0.1.0 • Published 4 days ago

tmdl-parser-service v0.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
4 days ago

tmdl-parser-service

The tmdl-parser-service is a TypeScript-based library that provides a robust solution for parsing the Tabular Model Definition Language (TMDL). This library is designed to work efficiently with TMDL scripts, allowing developers to easily parse and analyze these scripts within their applications

Usage

To install the library, use the following command:

npm i tmdl-parser-service

Here's an example demonstrating how to use the library:

// Import the TMDLLexer and TMDLParser classes from the tmdl-parser-service library
import { TMDLParser, TMDLLexer } from 'tmdl-parser-service';

// Get the text from a text document (e.g., a TMDL file)
const text = textDocument.getText();

// Convert the text to a stream of characters (CharStream)
const chars = CharStreams.fromString(text);

// Create a lexer instance using the CharStream
const lexer = new TMDLLexer(chars);

// Create a token stream from the lexer
const tokens = new CommonTokenStream(lexer);

// Create a parser instance using the token stream
const parser = new TMDLParser(tokens);

// Trigger the parsing process by starting from the top-level rule (`prog`)
const tree = parser.prog();

// Print the parse tree for testing purposes

console.log(tree.toStringTree(parser.ruleNames, parser));

Contribution Guidelines

Regenerate lexer and parser files

After making changes to the .g4 files, generate new parser and lexer files by running the following commands:

antlr4 -visitor -Dlanguage=TypeScript TMDLLexer.g4 -o ../parser
antlr4 -visitor -Dlanguage=TypeScript TMDLParser.g4 -o ../parser

Publish

To publish the library, use the following commands:

tsc -b
npm publish
0.1.0

4 days ago

0.2.1

4 days ago

0.1.2

4 days ago

0.2.0

4 days ago

0.1.1

4 days ago

0.1.8

4 days ago

0.0.9

4 days ago

0.1.7

4 days ago

0.0.8

4 days ago

0.1.9

4 days ago

0.1.4

4 days ago

0.1.3

4 days ago

0.1.6

4 days ago

0.1.5

4 days ago

0.0.7

7 days ago

0.0.6

7 days ago

0.0.5

12 days ago

0.0.4

14 days ago

0.0.3

17 days ago

0.0.2

24 days ago

0.0.1

24 days ago