Delphi-Konzept: Reale tree-sitter-pascal AST-Typen, Integration Guide, erweiterte Fixtures

- Alle Docs auf verifizierte AST-Knotentypen aktualisiert (declClass, declIntf, declProc, etc.)
- Scaffold/ entfernt und durch konkreten Integration Guide ersetzt (06-Integration-Guide.md)
- Neue Docs: AST-Referenz (03), NodeKind-Mapping (05), Integration Guide (06)
- Checklist um bekannte Einschränkungen erweitert (with-Statements, .dfm/.fmx, Generics)
- UAuth.pas erweitert: Sichtbarkeitsbereiche, Felder, Properties, Constructor/Destructor
- UTypes.pas neu: Enums, Records, Type-Aliase, Konstanten, Class Methods, verschachtelte Typen
- UnitResolution.md mit konkreten AST-Strukturen aktualisiert
- README.md an neue Architektur-Beschreibung angepasst
This commit is contained in:
Olaf Monien
2026-02-11 00:17:29 +01:00
parent 645fd71e45
commit dcca22c78f
15 changed files with 739 additions and 384 deletions
+30 -15
View File
@@ -2,29 +2,44 @@
## Input
- Extracted edges of kind `imports` from `uses` clauses.
- Extracted nodes of kind `unit|program|package|library` with their names.
- Extrahierte Edges vom Typ `imports` aus `declUses`-Knoten.
- Extrahierte Nodes vom Typ `module` aus `unit`/`program`/`library` (Name aus `moduleName`-Kind-Knoten).
## AST-Struktur
```
(declUses
(kUses)
(identifier "System.SysUtils") ← Unit-Name
(identifier "UAuth") ← Unit-Name
(kIn) (literalString "'UAuth.pas'") ← optionaler Pfad
)
```
## MVP Algorithm
1. Build `unitName -> nodeId` map for all indexed files.
2. For each `imports` edge with target name `X`:
- try exact match `X`
- try case-insensitive match
- try namespace normalization:
- `System.SysUtils` may correspond to unit `SysUtils` (optional heuristic)
3. If resolved: store `edge.to_node_id = targetNodeId`.
4. If not resolved: keep `edge.to_symbol = X` so search still works.
1. Build `unitName nodeId` Map für alle indexierten Dateien (aus `moduleName`-Knoten).
2. Für jeden `imports`-Edge mit Zielname `X`:
- Exakter Match auf `X`
- Case-insensitiver Match (Delphi ist case-insensitive)
- Namespace-Normalisierung:
- `System.SysUtils` → versuche auch `SysUtils` (letzter Segment)
- Dateiname-basierter Fallback: `X``X.pas` in den indexierten Dateien suchen
3. Falls aufgelöst: `edge.to_node_id = targetNodeId`
4. Falls nicht aufgelöst: `edge.to_symbol = X` beibehalten (Suche funktioniert trotzdem)
## DPR/DPK "in 'path'" cases (Phase 2)
## DPR/DPK `in 'path'` (Phase 2)
In Delphi project files you can have:
In Delphi-Projektdateien kann ein expliziter Pfad angegeben werden:
```
```delphi
uses
Foo in 'src/Foo.pas',
Bar in 'Bar.pas';
```
Enhancement:
- Parse optional path literal and resolve directly to file.
Im AST erkennbar durch `(kIn) (literalString)` nach dem `(identifier)`.
**Enhancement:**
- `literalString` extrahieren und direkt zur Datei auflösen
- Pfad relativ zur DPR/DPK-Datei interpretieren