Skip to content

Dot parser#7

Merged
IvanGoncharov merged 98 commits intomainfrom
dot-parser
May 6, 2026
Merged

Dot parser#7
IvanGoncharov merged 98 commits intomainfrom
dot-parser

Conversation

@IvanGoncharov
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings March 24, 2026 23:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a TypeScript DOT parser and shifts DOT-string rendering to a “parse to Graph JSON → WASM render” pipeline, alongside updating tests/snapshots and simplifying parts of the vendored Graphviz build.

Changes:

  • Added a new src/lexer.ts DOT lexer/parser (parseDot) and integrated it into Viz._renderInput() for string inputs.
  • Updated backend request types to accept only a Graph object (removed DOT-string input path) and adjusted the WASM module accordingly.
  • Refreshed tests/snapshots and tightened lint/TS config (including erasableSyntaxOnly).

Reviewed changes

Copilot reviewed 21 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tsconfig.json Enables erasableSyntaxOnly and normalizes trailing commas.
eslint.config.js Adds a few stricter ESLint rules (unnecessary-condition, switch-case braces, number literal casing).
cspell.yml Adds ellipsize to dictionary.
src/viz.ts Parses DOT strings via parseDot() and forwards a Graph JSON payload to WASM; preserves parser warnings.
src/lexer.ts New DOT lexer/parser implementation.
src/graph.d.ts Adjusts optional property types / Attributes to allow undefined values.
backend/src/vizjs_types.zig RenderRequest now always contains a Graph (removes DOT-string union).
backend/src/wasm_module.zig Removes agmemread DOT parsing path; always constructs Graphviz graphs from JSON.
backend/src/agrw.h / backend/src/agrw.c / backend/src/wasm_module.zig Renames/adjusts default-attr setters used by WASM.
backend/build.zig Stops compiling removed scan.c / grammar.c sources and drops related include paths.
test/* Updates inline snapshots/error messages; adds DOT language parity tests and new circo .dot snapshot.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lexer.ts Outdated
Comment thread src/lexer.ts Outdated
Comment thread src/viz.ts Outdated
@IvanGoncharov IvanGoncharov force-pushed the dot-parser branch 2 times, most recently from 2e11d05 to ea887d8 Compare March 26, 2026 21:11
@IvanGoncharov IvanGoncharov changed the base branch from backend-zig to main April 7, 2026 20:19
@IvanGoncharov IvanGoncharov force-pushed the dot-parser branch 2 times, most recently from f71ae1e to 5b7e208 Compare April 14, 2026 23:34
@IvanGoncharov IvanGoncharov requested a review from Copilot April 14, 2026 23:35
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 20 out of 21 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lexer.ts Outdated
Comment thread src/viz.ts Outdated
Comment thread src/lexer.ts Outdated
Comment thread src/normalize-graph.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 20 out of 21 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/viz.ts Outdated
Comment thread backend/src/wasm_module.zig
Comment thread src/lexer.ts Outdated
Comment thread src/normalize-graph.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 19 out of 21 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 28 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/normalize-graph.ts
Comment thread test/util/dedent.ts Outdated
Comment thread src/parser.ts Outdated
Comment thread src/parser.ts
Comment thread src/parser.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 28 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/viz.ts Outdated
Comment thread src/parser.ts Outdated
@IvanGoncharov
Copy link
Copy Markdown
Member Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request replaces the C-based DOT parser with a custom TypeScript implementation, refactors graph normalization, and updates the WebAssembly interface to use a JSON-based representation. It also introduces structured error reporting with source locations and code frames. Review feedback identifies a bug in string escape handling and suggests addressing several FIXME items related to default node labels, error message formatting, and compass point validation.

Comment thread src/parser.ts
Comment thread src/parser.ts
Comment thread src/location.ts
Comment thread src/normalize-graph.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 27 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/dot-language.test.ts
Comment thread src/parser.ts
@IvanGoncharov IvanGoncharov requested a review from Copilot May 6, 2026 01:53
@IvanGoncharov
Copy link
Copy Markdown
Member Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request replaces the existing Bison/Flex-based DOT parser with a new TypeScript implementation and introduces a graph normalization layer to handle attribute inheritance and edge deduplication. The backend WASM module and data structures have been refactored to support a new JSON-based communication format, and enhanced diagnostic reporting with source locations has been added. Feedback identifies a bug in the edge deduplication logic for strict graphs, where the inclusion of port and key attributes in the deduplication key prevents correct merging of edges between the same nodes.

Comment thread src/normalize-graph.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 27 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/viz.ts
Comment thread src/viz.ts
IvanGoncharov and others added 2 commits May 6, 2026 21:21
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@IvanGoncharov IvanGoncharov merged commit 1a9de9d into main May 6, 2026
1 check passed
@IvanGoncharov IvanGoncharov deleted the dot-parser branch May 6, 2026 21: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.

3 participants