Expand description
Rendering the Ada CST. Spec §5.
One style: three spaces per level, -- comments, one declaration per
line, the reserved words in lower case and the identifiers in
Mixed_Case_With_Underscores. Three spaces because that is what the
Ada Reference Manual’s own examples use and what GNAT’s -gnaty
style checks expect; nothing in the language depends on it.
Nothing is decided here. A record either has components or is written
null record, and which of the two it is was decided by
zerodds_lang_cst::ada::Record::is_null — the renderer only asks.
Two differences from every other renderer in this crate, and both are Ada’s:
- A string literal doubles its quote. Ada 2012 RM 2.6 spells an
embedded quotation mark
"", where the C family writes\", socrate::writer::escape_stringis not used here at all — it would produce a backslash Ada reads as a graphic character of its own. - A comment marker is
--and has no block form. RM 2.7: a comment runs to the end of the line and there is no closing delimiter, so a comment can never swallow the declaration after it.
Functions§
- decl
- Render one declaration, for a caller that has only one.
- expr
- Render one expression, for a caller assembling one.
- file
- Render a whole package specification.
- ident
- The identifier a name renders as, for a caller assembling one.
- package_
body - Render a package body:
package body Name is … end Name;. - path
- A qualified name, joined with the selector Ada uses.
- stmt
- Render one statement, for a test that holds only one.
- stmts
- Render a statement list,
declareblocks folded in.