Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/function-parsing-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Function Parsing Design

This document outlines the strategy for parsing `function` definitions and
declarations within `ddlint`. The parser relies on small helpers to interpret
parameter lists and optional return types. These helpers are shared with
relation parsing to avoid duplication.

```mermaid
classDiagram
class parse_name_type_pairs {
<<function>>
}
class parse_type_after_colon {
<<function>>
}
Function ..> parse_name_type_pairs : uses
Function ..> parse_type_after_colon : uses
Relation ..> parse_name_type_pairs : uses
```
13 changes: 13 additions & 0 deletions docs/parser-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ sequenceDiagram
The parser's final output is the AST root together with a `GreenNode` that
contains the full CST.

```mermaid
sequenceDiagram
participant Parser
participant SpanCollector
participant CSTBuilder
participant ASTRoot
Parser->>SpanCollector: collect_function_spans(tokens, src)
SpanCollector-->>Parser: (function_spans, errors)
Parser->>CSTBuilder: build_green_tree(..., function_spans, ...)
CSTBuilder-->>ASTRoot: Root::from_green(green)
ASTRoot->>ASTRoot: functions() -> Vec<Function>
```

## 5. Map CST Nodes to AST Structures

Implement lightweight AST types that reference the CST. Each AST node should
Expand Down
Loading