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

Add walk package to traverse an AST #265

Merged
merged 26 commits into from
Jan 13, 2025

Conversation

makenowjust
Copy link
Collaborator

Close #218

  • Add ast-gen-walk
  • Remove ColumnDefOptions and VectorIndexOption because they are unused.

@makenowjust
Copy link
Collaborator Author

@apstndb I merged your PR #264. Could you review this?

@makenowjust makenowjust marked this pull request as ready for review January 11, 2025 06:40
}

// Preorder returns an iterator that traverses an AST in depth-first preorder.
func Preorder(node Node) iter.Seq[Node] {
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: go.mod still have go 1.22.0 dilective so we can't use range over func in memefish development.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

go directive in go.mod is also updated. Is it problematic?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, seems like I had missed this.

return false
}

return true
// FIXME: The fields of `CreateTable` are not ordered by position for now,
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@apstndb apstndb left a comment

Choose a reason for hiding this comment

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

The known requirements have been addressed and there appear to be no issues that need to be fixed.

LGTM!

@apstndb
Copy link
Contributor

apstndb commented Jan 11, 2025

Note:
We can update these lines to reflect current conventions.

memefish/ast/ast.go

Lines 40 to 46 in 0052764

// Conventions:
//
// - Each node interface (except for Node) should have isXXX method (XXX must be a name of the interface itself).
// - `isXXX` methods should be defined after the interface definition
// and the receiver should be the non-pointer node struct type.
// - Each node struct should have pos and end comments.
// - Each node struct should have template lines in its doc comment.

@makenowjust
Copy link
Collaborator Author

@apstndb That's updated. Thank you!

ast/ast.go Outdated Show resolved Hide resolved
@makenowjust makenowjust merged commit 6ab0f40 into cloudspannerecosystem:main Jan 13, 2025
2 checks passed
@makenowjust makenowjust deleted the feature/ast-walk branch January 13, 2025 07:48
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.

Support walk/visit
2 participants