Module computed_attribute
Expand description
Parsing for the @computed(params: <Type>?) field attribute’s
parenthesized argument. Bare @computed needs no parsing; this
module only handles the parameterized form. Mirrors
super::composite_key’s shape: syntax parsing lives here in
cratestack-core so cratestack-parser’s semantic checker and any
other consumer (codegen, later) share one implementation.
Enums§
- Computed
Params Arg - The parenthesized argument of a
@computed(...)attribute, however it parses.
Functions§
- computed_
params_ type_ name - The params type name off a field’s
@computed(params: <Type>?)attribute, orNonefor a bare@computedfield (or a field with no@computedattribute at all). Assumes the attribute is already well-formed — per-declaration validation (e.g.cratestack-parser’svalidate_computed_field_attribute) must run first and reject anything else. Callers that still need to validate the argument form should parse the raw attribute text withparse_computed_params_arginstead. - is_
computed_ attribute - True when a single attribute’s raw text is either spelling of
@computed— bare@computedor the parameterized@computed(...)form (whatever its argument, valid or not; argument-shape validation is a separate concern — seecratestack-parser’svalidate_computed_field_attribute). Anchored withstarts_with("@computed(")rather than the looserstarts_with("@computed")deliberately: the latter would also match a hypothetical unrelated attribute merely prefixed with the same characters (e.g.@computedSomethingElse). - is_
computed_ field - True for a field carrying either spelling of
@computed— bare or@computed(params: <Type>?). Seeis_computed_attributefor why this must be the only place the string comparison is written. - parse_
computed_ params_ arg - Parses the text between (but not including) the parens of a
@computed(...)attribute into its recognized shape. Whitespace-tolerant around the:and before the trailing?.