#incremental #parsing #openscad

tree-sitter-openscad

openscad grammar for the tree-sitter parsing library

7 unstable releases (3 breaking)

0.4.2 Oct 30, 2022
0.4.1 Oct 23, 2022
0.4.0 May 7, 2022
0.3.0 May 4, 2022
0.1.0 Aug 1, 2021

#64 in Text editors

Download history 70/week @ 2023-02-13 49/week @ 2023-02-20 42/week @ 2023-02-27 39/week @ 2023-03-06 50/week @ 2023-03-13 56/week @ 2023-03-20 49/week @ 2023-03-27 32/week @ 2023-04-03 55/week @ 2023-04-10 40/week @ 2023-04-17 49/week @ 2023-04-24 53/week @ 2023-05-01 59/week @ 2023-05-08 39/week @ 2023-05-15 46/week @ 2023-05-22 92/week @ 2023-05-29

241 downloads per month
Used in 2 crates

MIT license

460KB
19K SLoC

C 18K SLoC JavaScript 250 SLoC // 0.1% comments Scheme 45 SLoC Rust 31 SLoC // 0.5% comments

tree-sitter-openscad

OpenSCAD grammar for the tree-sitter parsing library

Developer quickstart

Most development of tree-sitter parsers is done using nodejs and npm. You can find the instructions on how to set that up here: https://tree-sitter.github.io/tree-sitter/creating-parsers

The TLDR would be:

  1. Install npm (there are many ways, pick your poison)
  2. From the source directory, run npm install to get all the dependencies
  3. export PATH=$PATH:./node_modules/.bin to get the tree-sitter CLI command
  4. tree-sitter generate to build your changes
  5. tree-sitter test to make sure you didn't unintentionally break any of the existing test cases
  6. Add a new test case covering your change (instructions here: https://tree-sitter.github.io/tree-sitter/creating-parsers#command-test)

lib.rs:

This crate provides openscad language support for the tree-sitter parsing library.

Typically, you will use the language function to add this language to a tree-sitter Parser, and then use the parser to parse some code:

let code = "";
let mut parser = tree_sitter::Parser::new();
parser.set_language(tree_sitter_openscad::language()).expect("Error loading openscad grammar");
let tree = parser.parse(code, None).unwrap();

Dependencies

~1.4–2MB
~53K SLoC