Skip to content

feat(doc): migrate from solang to solar#14447

Open
mablr wants to merge 2 commits intomasterfrom
mablr/migrate-forge-doc-solang-to-solar
Open

feat(doc): migrate from solang to solar#14447
mablr wants to merge 2 commits intomasterfrom
mablr/migrate-forge-doc-solang-to-solar

Conversation

@mablr
Copy link
Copy Markdown
Collaborator

@mablr mablr commented Apr 24, 2026

Motivation

Replace all solang_parser usage in forge-doc with solar AST. Use owned purpose-built structs (ParamInfo, ContractSource, FunctionSource, etc.) extracted at walk time instead of cloning arena-allocated solar AST nodes.

  • Add parser/source.rs with owned doc structs
  • Rewrite Parser to walk solar AST items directly
  • Parse doc comments from solar's DocComments (raw text)
  • Update builder to use solar AST from gcx, remove solang re-parse
  • Update writer and preprocessor layers for owned structs
  • Delete solang_ext/ module (Visitor, Visitable, AstEq, etc.)
  • Remove solang-parser dependency from forge-doc
  • Decouple chisel from forge-doc (inline CodeLocation/SafeUnwrap)

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Replace all solang_parser usage in forge-doc with solar AST.
Use owned purpose-built structs (ParamInfo, ContractSource,
FunctionSource, etc.) extracted at walk time instead of cloning
arena-allocated solar AST nodes.

- Add parser/source.rs with owned doc structs
- Rewrite Parser to walk solar AST items directly
- Parse doc comments from solar's DocComments (raw text)
- Update builder to use solar AST from gcx, remove solang re-parse
- Update writer and preprocessor layers for owned structs
- Delete solang_ext/ module (Visitor, Visitable, AstEq, etc.)
- Remove solang-parser dependency from forge-doc
- Decouple chisel from forge-doc (inline CodeLocation/SafeUnwrap)

Co-authored-by: Amp <amp@ampcode.com>
@mablr mablr marked this pull request as ready for review April 24, 2026 15:04
@DaniPopes
Copy link
Copy Markdown
Member

would be nicer to rewrite from scratch and have an actual test harness and suite for this, but i guess at this point we can leave that for the future.

Copy link
Copy Markdown
Collaborator

@stevencartavia stevencartavia left a comment

Choose a reason for hiding this comment

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

lgtm, just a minor nit

@@ -315,12 +310,20 @@ impl Document {
fn write_function(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this duplicates the logic in ParseSource::signature(). Maybe a FunctionSource::signature() method can be added and both can share it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants