Skip to main content

Module d

Module d 

Source
Expand description

Rendering the D CST. Spec §5.

One style, the one dfmt and Phobos use: four spaces, Allman braces — the opening brace on a line of its own — and /// for documentation, which is what Ddoc reads.

Nothing is decided here, with one exception that is a rendering fact rather than a choice: a D type suffix is written after the type it applies to and reads right to left. int[3][2] is two arrays of three (D language specification, “Arrays”, “Rectangular Arrays”), which is the reverse of C. zerodds_lang_cst::d::Type::Array holds the outermost dimension outermost, exactly as the Go tree does, and this renderer writes the element before the length — so one tree shape produces [2][3]int32 in Go and int[3][2] in D and both mean two rows of three.

Unlike crate::c there is no declarator to split around a name: a D declaration is the whole type, a space, and the name.

Functions§

decl
Render one declaration, for a caller that has only one.
file
Render a whole file.
ident
The identifier a name renders as, for a caller assembling one.
type_
Render one type, for a caller that has only one.