Skip to content

feat(tdl): Add NamedVar AST node. - #185

Merged
LinZhihao-723 merged 31 commits into
y-scope:mainfrom
LinZhihao-723:ast-namaed-var
Aug 9, 2025
Merged

feat(tdl): Add NamedVar AST node.#185
LinZhihao-723 merged 31 commits into
y-scope:mainfrom
LinZhihao-723:ast-namaed-var

Conversation

@LinZhihao-723

@LinZhihao-723 LinZhihao-723 commented Aug 8, 2025

Copy link
Copy Markdown
Member

Description

This PR introduces the NamedVar AST node for named variables. A named variable contains an ID (Identifier) and a type (Type).

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

  • Ensure all workflows pass.

Summary by CodeRabbit

  • New Features
    • Introduced support for named variable nodes in the task definition language (TDL) abstract syntax tree, including creation and string serialization.
  • Bug Fixes
    • Improved the formatting of identifier serialization by removing an extra space after the colon.
  • Tests
    • Added tests to validate creation and serialization of named variable nodes in the TDL parser AST.

@LinZhihao-723
LinZhihao-723 requested review from a team and sitaowang1998 as code owners August 8, 2025 18:54
@coderabbitai

coderabbitai Bot commented Aug 8, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This change introduces the NamedVar AST node to the TDL parser, including its implementation, header, and unit tests. It also updates the build configuration to include new AST node types (such as NamedVar, List, Map, Bool, Float, and Int) and adjusts the serialization format for identifiers.

Changes

Cohort / File(s) Change Summary
Build Configuration Updates
src/spider/CMakeLists.txt
Added new source and header files for NamedVar, container types (List, Map), and primitive types (Bool, Float, Int) to the build configuration for the spider_tdl library.
Identifier Serialization
src/spider/tdl/parser/ast/node_impl/Identifier.cpp
Modified the serialization output of Identifier nodes to remove the space after the colon in the output string.
NamedVar Node Implementation
src/spider/tdl/parser/ast/node_impl/NamedVar.cpp,
src/spider/tdl/parser/ast/node_impl/NamedVar.hpp
Added the implementation and header for the NamedVar AST node, including its factory method, serialization logic, and accessors for identifier and type children.
Unit Tests for NamedVar
tests/tdl/test-parser-ast.cpp
Introduced tests for the NamedVar node, verifying creation, child count, and serialization output; included necessary headers and using declarations for testing.

Sequence Diagram(s)

sequenceDiagram
    participant Test
    participant NamedVar
    participant Identifier
    participant Type

    Test->>Identifier: create()
    Test->>Type: create()
    Test->>NamedVar: NamedVar::create(Identifier, Type)
    NamedVar->>Identifier: validate type
    NamedVar->>Type: validate type
    NamedVar-->>Test: Result<NamedVar>
    Test->>NamedVar: serialize_to_str()
    NamedVar->>Identifier: serialize_to_str()
    NamedVar->>Type: serialize_to_str()
    NamedVar-->>Test: formatted string
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • sitaowang1998

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7a2e7b3 and 7216617.

📒 Files selected for processing (1)
  • src/spider/tdl/parser/ast/node_impl/NamedVar.hpp (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/spider/tdl/parser/ast/node_impl/NamedVar.hpp
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: lint
  • GitHub Check: non-storage-unit-tests (ubuntu-24.04)
  • GitHub Check: non-storage-unit-tests (ubuntu-22.04)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Comment thread src/spider/tdl/parser/ast/node_impl/NamedVar.hpp Outdated
Co-authored-by: sitaowang1998 <sitaowang1998@outlook.com>
@LinZhihao-723
LinZhihao-723 merged commit a373dfd into y-scope:main Aug 9, 2025
5 checks passed
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.

2 participants