Skip to content

fix: align C# value binding with grammar - #30

Merged
Seddryck merged 1 commit into
mainfrom
codex/issue-29-bind-record-access
Aug 12, 2026
Merged

fix: align C# value binding with grammar#30
Seddryck merged 1 commit into
mainfrom
codex/issue-29-bind-record-access

Conversation

@Seddryck

@Seddryck Seddryck commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • bind record_access nodes, including current/original roots, named/positional selectors, and nested paths
  • add managed syntax nodes for variables and compound values that were already accepted by the grammar
  • compare the generated Tree-sitter value subtype contract with the binder's declared coverage so future drift fails tests

Root cause and impact

The grammar and C# binder evolved independently. Tree-sitter could produce valid value nodes that BindValue did not recognize, causing successfully parsed expressions such as .name to fail with ExpressifBindingException. The C# syntax model now covers every value subtype exposed by the grammar.

Validation

  • dotnet test bindings/csharp/Expressif.Syntax.Tests/Expressif.Syntax.Tests.csproj --nologo --no-restore -m:1 — 48/48 passed on net8.0, net9.0, and net10.0
  • tree-sitter test — all 78 inputs parsed; 72 snapshots passed and 6 pre-existing Windows CRLF/end-token snapshot differences remain
  • git diff --check

Close #29

Summary by CodeRabbit

  • New Features

    • Expanded C# syntax support for variables, record access, and record fields.
    • Added support for array, tuple, and record literals, including nested and compound values.
    • Record access now supports named fields, quoted names, and positional indexes.
    • Added syntax node coverage for the newly supported value types.
  • Tests

    • Added comprehensive validation for binding and grammar coverage.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 642479a3-d97a-45b6-a4a3-56f98b823d98

📥 Commits

Reviewing files that changed from the base of the PR and between ec079d0 and ee95cb2.

📒 Files selected for processing (4)
  • bindings/csharp/Expressif.Syntax.Tests/Expressif.Syntax.Tests.csproj
  • bindings/csharp/Expressif.Syntax.Tests/SyntaxBindingTests.cs
  • bindings/csharp/Expressif.Syntax/ExpressifSyntax.cs
  • bindings/csharp/Expressif.Syntax/SyntaxNodes.cs

📝 Walkthrough

Walkthrough

The C# binding layer now supports variables, record access, array and tuple literals, record literals, and record fields. New syntax nodes expose selectors, quoting, nested values, and original-input state. Tests compare binder coverage with node-types.json.

Changes

C# value binding

Layer / File(s) Summary
Managed value syntax model
bindings/csharp/Expressif.Syntax/SyntaxNodes.cs
SyntaxKind and syntax node types now represent variables, record access, sequence literals, record literals, and record fields.
Value binding implementation
bindings/csharp/Expressif.Syntax/ExpressifSyntax.cs
The binder recursively handles supported value nodes, record-access selectors, positional indices, and quoted field names.
Binder contract and regression tests
bindings/csharp/Expressif.Syntax.Tests/...
Tests cover nested and compound values and verify that supported binder types match node-types.json.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Mergeability Score: ⚪ Minimal · up to ee95c

The PR expands C# value binding to match the grammar and adds coverage for supported syntax; reported tests pass, and no actionable merge-blocking risk remains.

Sequence Diagram(s)

sequenceDiagram
  participant Grammar
  participant BindValue
  participant BindRecordAccess
  participant RecordAccessSyntax
  Grammar->>BindValue: provide record_access value node
  BindValue->>BindRecordAccess: delegate record access binding
  BindRecordAccess->>RecordAccessSyntax: create selectors and original-input state
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: aligning C# value binding with the grammar.
Linked Issues check ✅ Passed The changes implement record-access binding, add grammar-alignment coverage, and provide the contract test required by issue #29.
Out of Scope Changes check ✅ Passed The changes are limited to C# value binding, syntax nodes, project test content, and regression tests related to issue #29.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/issue-29-bind-record-access

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

Comment @coderabbitai help to get the list of available commands.

@Seddryck
Seddryck marked this pull request as ready for review August 12, 2026 22:55
@Seddryck
Seddryck merged commit 146aca3 into main Aug 12, 2026
12 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.

Keep C# value binding aligned with parser nodes

1 participant