From c1cacdda857efa1f0af629eca29d06fd114d9947 Mon Sep 17 00:00:00 2001 From: osman362 <136453917+osman362@users.noreply.github.com> Date: Sat, 28 Oct 2023 22:56:19 +0200 Subject: [PATCH] Updated README file Added installation process Added explanation on how to run tests, parse and highlight a file Added current status --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f4250eb..caeb2d8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,46 @@ # tree-sitter-modelica -An [open-source](OSMC-License.txt) Modelica ([Modelica Language Specification v3.5](https://specification.modelica.org/maint/3.5/MLS.html)) grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter). +An [open-source](OSMC-License.txt) Modelica ([Modelica Language Specification v3.5](https://specification.modelica.org/maint/3.5/MLS.html)) grammar and highlighting-query for [tree-sitter](https://github.com/tree-sitter/tree-sitter). -Currently used by [OMFrontend.js](https://github.com/OpenModelica/OMFrontend.js). +## Installation + +```bash +npm install +npm run build +``` + +To generate the C code to parse Modelica, run: + +```bash +npx tree-sitter generate +# Skip npx if you have ./node_modules/.bin in your PATH +# tree-sitter generate +``` + +## Unit Tests + +There is a number of tests included. To run all tests defined in [test/](./test/), just run: + +```bash +npx tree-sitter test +``` + +### Examples + +To test the parser on a Modelica file, you can run: + +```bash +npx tree-sitter parse examples/SimpleMath.mo +``` + +## Highlighting + +There is also a highlighting query included. To test the highlighting you can run: + +```bash +npx tree-sitter highlight examples/SimpleMath.mo +``` + +## Current Status + +Tree-sitter-modelica has been tested on a "Save Total" version of the DrumBoiler.mo file which was successfully parsed and highlighted. \ No newline at end of file