Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: cleaner $.expr + match order with spec #14

Merged
merged 2 commits into from
Aug 3, 2023

Conversation

Duologic
Copy link
Contributor

@Duologic Duologic commented Jul 18, 2023

First of all, great job on this tree-sitter parser. This is the first time I'm working with tree-sitter, so please be kind.

I'm debugging a few issues but had a hard time navigating the code so I spent a bit of time refactoring first.

This PR does 3 things:

  • Format the JS with prettier
  • Split out the $.expr into separate items (and matched order with the Jsonnet spec, there were a few differences)
  • Matched order of other items with the Jsonnet spec

I've maintained the visibility by using the underscore prefix on all new items but we might want to make them visible in the output (and perhaps hide $.expr as it's ubiquitous) in a follow up PR.

@@ -5,3 +5,6 @@ generate:

test: generate
${ts} test

fmt:
npx prettier --tab-width 4 -w grammar.js
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a JS dev, so no clue if this one makes sense, I choose 4 spaces as it created only a small diff.

Comment on lines +88 to +89
number: ($) => $._number,
string: ($) => $._string,
Copy link
Contributor Author

@Duologic Duologic Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've linked $.number and $.string here so they show up in the right order but all the details can stay at the bottom to reduce the diff.

@Duologic Duologic changed the title refactor: cleaner $.expr + match order to abstract syntax (from jsonnet spec) refactor: cleaner $.expr + match order with spec Jul 18, 2023
@Duologic
Copy link
Contributor Author

ping @tjdevries @aryx Any feedback on this?

Copy link

@aryx aryx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have commit right on this repo, but yes looks good to me.

@aryx
Copy link

aryx commented Jul 24, 2023

Would be good to have some CI checks on this repo so at least we're making sure it does not break the build.

@Duologic
Copy link
Contributor Author

Fair point, I have run the test cases locally tho. I have several changes on my fork that I'd like to pass along to this repo, I'll have a look at adding CI before those.

@aryx
Copy link

aryx commented Jul 25, 2023

maybe @tjdevries should give some 'maintain' right to one of us, otherwise we will have to fork the repo to get improvements in it.

@aryx
Copy link

aryx commented Jul 25, 2023

I've created #17

@Duologic
Copy link
Contributor Author

Duologic commented Aug 3, 2023

@tjdevries Any feedback on this? (last ping, no worries if you are too busy, we can fork and converge later)

@tjdevries
Copy link
Contributor

Hey, thanks for the ping! I will follow up to see about adding other maintainers (may have to move it out of sourcegraph org, not sure).

in the meantime, PR looks good to me. I'll merge. Thanks!

@tjdevries tjdevries merged commit af22de3 into sourcegraph:main Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants