Skip to main content

Module elixir

Module elixir 

Source
Expand description

Rendering the Elixir CST. Spec §5.

One style, mix format’s: two spaces per level, do/end blocks, # comments, @moduledoc as a heredoc. Two spaces and not four because mix format is not configurable in that respect, and a generated file that changes under the formatter every consumer runs is a diff nobody asked for.

Nothing is decided here. Three spellings are the language’s rather than a choice, and each is written down where it happens:

  • a float literal must have a digit, a point and a digit before any exponent — 1e10 does not parse (measured, Elixir 1.20.2), while C, C++, Java and Rust all take it, so the shared zerodds_lang_rules::adapter::constant::float_text cannot be handed straight through;
  • #{ inside a double-quoted string is interpolation, so # is escaped;
  • the keyword pairs of a list come last, which is why zerodds_lang_cst::elixir::Field always carries a default.

Functions§

codec_function
Render one codec routine.
expr
Render one expression, for a caller that has only one.
file
Render a whole file.
ident
The identifier a name renders as, for a caller assembling one.
item
Render one item, for a caller that has only one.
module
Render one module, for a caller that has only one.
string_literal
A double-quoted Elixir string literal, escaped.
top_level
Render one top-level entry, for a caller that has only one.
type_
Render one type, for a caller that has only one.