Skip to content

Add manually implemented AST visitor - #758

Closed
tustvold wants to merge 5 commits into
apache:mainfrom
tustvold:ast-visitor
Closed

Add manually implemented AST visitor#758
tustvold wants to merge 5 commits into
apache:mainfrom
tustvold:ast-visitor

Conversation

@tustvold

Copy link
Copy Markdown
Contributor

Related to #78, #114, #601

This implements a basic AST visitor. I'm not convinced this is the best way to implement this, as it is relatively fragile, but I wanted to get something up to acts as a comparison point

@coveralls

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 3685169537

  • 12 of 554(2.17%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-3.1%) to 83.174%

Changes Missing CoverageCovered LinesChanged/Added Lines%
src/ast/value.rs020.0%
src/ast/ddl.rs0490.0%
src/ast/query.rs121527.89%
src/ast/mod.rs03510.0%
TotalsCoverage Status
Change from base Build 3641238188:-3.1%
Covered Lines:12541
Relevant Lines:15078

💛 - Coveralls

@alamb

Copy link
Copy Markdown
Contributor

So what I would really like to do is to figure out some way to automatically generate this code (like using rustc_parse or something) and then automatically generate visitors (and mutators) as part of the build.rs system somehow

Comment threadsrc/ast/visitor.rs
// limitations under the License.

use crate::ast::{Expr, ObjectName, Statement};
use core::ops::ControlFlow;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TIL: ControlFlow

@tustvold

Copy link
Copy Markdown
ContributorAuthor

So what I would really like to do is to figure out some way to automatically generate this code

I'll have a play with what a proc-macro / codegen setup looks like

@tustvoldtustvold mentioned this pull request Dec 15, 2022
@tustvold

Copy link
Copy Markdown
ContributorAuthor

I think the approach in #765 is much more maintainable that this, which I think would be non-trivial to maintain and would act as a potential barrier to contribution

Sign up for freeto 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

@tustvold@coveralls@alamb