pub enum Param {
Optional {
q: OptionalTok,
name: VarTok,
},
Pat(PatBot),
Bundled {
opts: CstOptBinders,
body: PatBot,
},
}Expand description
One curried parameter of an ordinary (non-let-rec) let, or of a
let-inline/let-block/let-math command binding — upstream’s
arg nonterminal (nxnonrecdec’s argpart/cmdarglst,
parser.mly:622-624: arg: patbot | OPTIONAL defedvar): a full
pattern, or the def-site optional-parameter marker ?:name
(parser.mly’s OPTIONAL vartok), e.g. stdja.satyh’s let document record ?:configopt inner = .. and annot.satyh’s
let-inline ctx \href ?:borderopt uri inner = ... Upstream’s
let-rec/fun argument grammar (recdecargpart/argpats —
RecBinding/AndBinding/Expr::Fun) has no such alternative,
only plain let and the three command-binding forms do — all four
keep Vec<Param> (super::TopLet, Expr::LetIn,
super::TopBinding::LetInline/LetBlock/LetMath,
Expr::LetMathIn). Elaborated (elaborate.rs) by widening
Optional to PatBot::Var (params_to_patbots) before the ordinary
pattern-currying machinery runs (plain let’s rec_clause_value, or
a command binding’s curry_cmd_params) — the ?: marker carries no
further semantics of its own in this port (typecheck.rs’s
command_scheme doc comment: optionality is inferred structurally,
not from this marker); for a command binding, the maximal leading
run of ?:-marked params is additionally counted by elaborate.rs’s
leading_optional_count and recorded into the binding’s
Scope::optional_arity, so a marker-less call site can auto-omit
those slots (see cmd_args/math_bot’s Cmd arm).
Variants§
Optional
Pat(PatBot)
Bundled
A SATySFi 0.1 ?(l = x, …) labeled-optional command-parameter
bundle, lowered from
cst_v1::Param { opts: Some(_), body } by
v1/lower.rs::lower_command_params. Reuses CstOptBinders
verbatim (the same node a value-level fun ?(l = x) p -> ..
bundle lowers to) — ?(-headed, so distinct from
the 0.0.6 ?:-headed Param::Optional above (no arm overlap,
no grammar ambiguity: this variant is never PARSED directly by
this 0.0.6-frozen cst.rs, only ever constructed by the 0.1
lowering path). Consumed by elaborate.rs’s bundle-aware
curry_cmd_params_v1, which emits Ast::LambdaOpt for it — see
that function’s doc comment.
Trait Implementations§
Source§impl<__SyanMacro_Atom> Parse<__SyanMacro_Atom> for Paramwhere
__SyanMacro_Atom: Spanned + Clone,
OptionalTok: Parse<__SyanMacro_Atom>,
VarTok: Parse<__SyanMacro_Atom>,
PatBot: Parse<__SyanMacro_Atom>,
CstOptBinders: Parse<__SyanMacro_Atom>,
impl<__SyanMacro_Atom> Parse<__SyanMacro_Atom> for Paramwhere
__SyanMacro_Atom: Spanned + Clone,
OptionalTok: Parse<__SyanMacro_Atom>,
VarTok: Parse<__SyanMacro_Atom>,
PatBot: Parse<__SyanMacro_Atom>,
CstOptBinders: Parse<__SyanMacro_Atom>,
Source§type Error = ParseError<<__SyanMacro_Atom as Spanned>::Span>
type Error = ParseError<<__SyanMacro_Atom as Spanned>::Span>
<FieldTy as Parse<Atom>>::Error: Into<…> predicate re-creates a projection cycle on a
recursive field (E0275), which decycle’s bound-peeling does not break.