bollian / tree-sitter-openscad Goto Github PK
View Code? Open in Web Editor NEWIncremental parser for OpenSCAD using tree-sitter
License: MIT License
Incremental parser for OpenSCAD using tree-sitter
License: MIT License
List comprehensions can contain many sub-clauses:
if_for_ifelse = [for (x = 0) if (x < 0) for (y = 2) if (y == 2) y else x];
// effectively equivalent to
if_for_ifelse = [for (x = 0) if (x < 0) for (y = 2) (if (y == 2) y else x)];
This means subclauses need to be groupable, and this parser currently doesn't support that. Example:
if_for_ifelse = [for (x = 0) if (x < 0) for (y = 2) (if (y == 2) y) else x];
I noticed that this project does not seem to use semantic versioning. I think it would be valuable if it tagged actual releases so that it's clear what version projects based on this (e.g., the VS Code plugin) can use this project at specific releases.
The releated issue.
Is python required in order to install this? I didn't see anything about this in the docs or issues.
When installing this package as a dependency with npm (npm i tree-sitter-openscad) I am gettting:
npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
Thanks!
It's surprisingly difficult to publish a clean version of this library because both cargo and npm are very liberal with which parts of the repository they include in the uploaded tarball. The most recent 0.5 and 0.5.1 releases, for example, both include the upstream openscad submodule, including a litany of pngs and other files that users of this library don't actually need. It's also easy for local tooling files to wind up in the archive, which has happened before.
I need to create an action for publishing to both crates.io and NPM that ensures a proper, clean upload.
The CI added by the recent merge of #9 is currently failing. This needs to be fixed.
I've already updated the versions of the used GitHub actions in order to fix some warnings about old node versions, but there's apparently something else wrong with the added tests.
This grammer has semi-colon listed as optional at the end of use/include. It isn't optional it simply isn't necessary at the end of use/include.
include_statement: $ => prec.left(seq(choice('use', 'include'), $.include_path, optional(';'))),
A semi-colon at the end of use/include does compile but that is because ;
is a legal statement all by itself. So use <whatever.scad>;
is actually two statements. The use <whatever.scad>
is one, and then the ;
is another statement that just happens to be empty.
There are several test cases in the upstream OpenScad repository which this project currently fails to parse. This can be seen in the expected_failed_parses
list in the "test.js" file. These failed parses are all marked as "todo" in the test file so that the CI continues to pass, but these are valid OpenScad files and thus should successfully parse. The ignored_examples
list contains files that shouldn't successfully parse, and doesn't represent any issues for this project.
This issue exists to track all the component causes of these "todo" failing parses. Each root-cause issue will be broken out into its own ticket.
Hey @bollian, I have a few questions I think would come under an FAQ.
I'm personally looking to use this library to create an LSP/formatter for vscode using Topiary because the current openscad plugins I use have really poor formatting. I assume it's possible with these tools together.
Thank you for putting the grammar together.
OpenSCAD allows numbers to be formatted using scientific notation with integer exponents. All of the following are allowed:
assert(5.2e1 == 52);
assert(5.2e-1 == 0.52);
assert(-5.2e0 == -5.2);
The parser should handle all of the above cases.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.