Code Monkey home page Code Monkey logo

tree-sitter-openscad's People

Contributors

amaanq avatar bollian avatar dzhu avatar lenbok avatar wilriker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tree-sitter-openscad's Issues

Allow grouping clauses in list comprehensions

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];

Is Python required?

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!

Create publish action

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.

Failing CI

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.

use/include do not need to end with a semi-colon

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.

Failing upstream tests

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.

FAQ

Hey @bollian, I have a few questions I think would come under an FAQ.

  • Why did you create a grammar for OpenSCAD?
  • Is this grammar complete against the grammar specification? I've had a quick look and it seems good.

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.

Scientific notation

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.