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

Python tree-sitter to CAST Porting: Imports #826

Merged
merged 11 commits into from
Mar 4, 2024
Merged

Conversation

titomeister
Copy link
Contributor

@titomeister titomeister commented Feb 27, 2024

This PR introduces support for generating CAST import statements. This is using tree sitter, as part of the ongoing effort to port over the Python AST to CAST generation to use tree-sitter.

Summary of Changes

  • Adds handlers to python/ts2cast.py to support CAST generation for import statements.
  • Adds basic CAST generation for the attribute idiom. In order to support function calls from imports.
  • Adds test script test_import_cast.py with unit tests to maintain consistency.
  • Added 'support' for yields and assert statements. The current generation is to passthrough them, so nothing important gets generated from these.

Related issues

Resolves #804

@titomeister titomeister marked this pull request as ready for review February 28, 2024 00:08
@titomeister titomeister marked this pull request as draft February 28, 2024 01:02
@titomeister
Copy link
Contributor Author

Requires some tweaks to the tests to fix a goofy issue of Var vs Name in Functions. Converting back to draft.

@titomeister titomeister marked this pull request as ready for review February 28, 2024 18:45
Copy link
Contributor

@vincentraymond-ua vincentraymond-ua left a comment

Choose a reason for hiding this comment

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

@titomeister - Looks good!

@titomeister titomeister merged commit 102dd72 into main Mar 4, 2024
7 checks passed
@titomeister titomeister deleted the ferra/python_ts_import branch March 4, 2024 15:55
github-actions bot added a commit that referenced this pull request Mar 4, 2024
This PR introduces support for generating CAST import statements. This
is using tree sitter, as part of the ongoing effort to port over the
Python AST to CAST generation to use tree-sitter.

### Summary of Changes

- Adds handlers to python/ts2cast.py to support CAST generation for
import statements.
- Adds basic CAST generation for the attribute idiom. In order to
support function calls from imports.
- Adds test script test_import_cast.py with unit tests to maintain
consistency.
- Added 'support' for yields and assert statements. The current
generation is to passthrough them, so nothing important gets generated
from these.

### Related issues
-

Resolves #804

---------

Co-authored-by: Vincent Raymond <vincent@lum.ai> 102dd72
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.

Python tree sitter: Imports
2 participants