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
feat(mojo): add mojo language #6441
base: master
Are you sure you want to change the base?
Conversation
Instead of copying applicable queries, please use |
In particular, does the |
currently mojo-python is like typescript-javascript. All valid python codes are valid mojo code, not the other way around. Seeing how the parser is written, I have some feeling there will be some decent breakage from python :? So keeping it separated will mean less maintanence effort |
Being new to tree-sitter I wasn't sure what the best way to approach the extend vs copy choice. I didn't find a good way to extend the existing Python parser though so I decided to just copy it and make some tweaks. If there's a better way I can go down that road. I'm happy to make the change to use |
3ccfa09
to
2826fd5
Compare
That is a valid concern, and something you'd have to keep an eye on as parser (and query) maintainer. |
Yep understood, and in that case, and with the fact that Mojo's syntax is likely to change often in the near term, it seems to me the best choice is to keep the grammar and queries separate. |
This risks the queries diverging over time, as changes (improvements) are made to python. Would people consider it a problem if the same Python file is highlighted differently depending on whether it's opened as a python or mojo file? (Just exploring the landscape here, and giving ideas on what to consider when choosing one or the other.) |
@austincummings please also test that |
((decorator | ||
"@" @attribute) | ||
(#set! "priority" 101)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, why?
If anything, move this down so you don't need priorities for it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one of the parts brought over from the Python queries so I'm not exactly sure. I can see about cleaning this up though and maybe that can be added back upstream to the Python queries.
; This one causes a crash for some reason | ||
; (struct_definition | ||
; superclasses: (argument_list | ||
; (identifier) @type)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
You might want to run the workflows from https://github.com/tree-sitter/workflows against your scanner, in particular.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, I'll give that a go and figure out what's going on there.
@clason Running |
There are some updates I need to make on the grammar side, I'll update the lockfile when that's done. Should I make this a draft PR until I've ironed out all the issues on the grammar? |
Whichever you think is more suitable for you and us. |
Copy over Python queries and extend with Mojo specific syntax.
Is it ready for review now? |
Copy over Python queries and extend with Mojo specific syntax.