pub struct MacroExpansion {
pub text: String,
/* private fields */
}Expand description
Outcome of expand_macros: the expanded text, plus the fault that
made it wrong if one did.
Three faults reach here — a name with no definition, a name that
resolves into itself, and a reference whose closing delimiter never
matched its opener — and they are C’s single entry->error
(macCore.c:216-224) split by cause. All three lists are therefore
private, and the only way to read them is Self::fault, or
Self::errored for the same answer as a bool. A consumer able to
reach one list directly hard-fails on the fault it named and returns
the other one’s broken text as success; that is not hypothetical, it
is what the autosave .req reader did for as long as undefined
was pub.
Fields§
§text: StringImplementations§
Source§impl MacroExpansion
impl MacroExpansion
Sourcepub fn fault(&self) -> Option<MacroFault<'_>>
pub fn fault(&self) -> Option<MacroFault<'_>>
The single owner of “did this expansion come out wrong, and why”. Every arm is read here so that no caller can read only some of them.
A macro is never in more than one list: recursive is recorded
only where the name resolved to a table entry, undefined only
where it resolved to nothing, unterminated only where no name
was ever parsed. So the order below decides nothing but which of
several independent faults a string carrying more than one
reports first.
Sourcepub fn errored(&self) -> bool
pub fn errored(&self) -> bool
C MAC_ENTRY.error: whether the expansion came out wrong, by any
of the arms that set it. macExpandString returns a negative
length for all of them alike (macCore.c:216-224), and that
negative length is the whole of what the .db reader’s per-line
warning and macDefExpand’s NULL are looking at. Delegates to
Self::fault so the bool and the name can never disagree.