tamer: nir::NirSymbolTy (Display): Add impl
Add initial descriptions and consolodate some of the types. There'll be more to come; this is just to get `Display` derives working for types that'll be using it. I'd like to see where this description manifests itself before I decide how user-friendly I'd like it to be. DEV-13156main
parent
5e2d8f13a7
commit
9922910d09
|
@ -173,7 +173,6 @@ impl Display for SugaredNir {
|
|||
pub enum NirSymbolTy {
|
||||
AnyIdent,
|
||||
BooleanLiteral,
|
||||
CalcIdent,
|
||||
ClassIdent,
|
||||
ClassIdentList,
|
||||
ConstIdent,
|
||||
|
@ -190,19 +189,64 @@ pub enum NirSymbolTy {
|
|||
ParamName,
|
||||
ParamType,
|
||||
PkgPath,
|
||||
PkgTitle,
|
||||
ShortDimNumLiteral,
|
||||
StringLiteral,
|
||||
SymbolTableKey,
|
||||
TexMathLiteral,
|
||||
Title,
|
||||
TplMetaIdent,
|
||||
TplName,
|
||||
TplIdent,
|
||||
TplParamIdent,
|
||||
TypeIdent,
|
||||
ValueIdent,
|
||||
}
|
||||
|
||||
impl Display for NirSymbolTy {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
use NirSymbolTy::*;
|
||||
|
||||
match self {
|
||||
AnyIdent => write!(f, "any identifier"),
|
||||
BooleanLiteral => write!(
|
||||
f,
|
||||
"boolean literal {fmt_true} or {fmt_false}",
|
||||
fmt_true = TtQuote::wrap("true"),
|
||||
fmt_false = TtQuote::wrap("false"),
|
||||
),
|
||||
ClassIdent => write!(f, "classification identifier"),
|
||||
ClassIdentList => {
|
||||
write!(f, "space-delimited list of classification identifiers")
|
||||
}
|
||||
ConstIdent => write!(f, "constant identifier"),
|
||||
DescLiteral => write!(f, "description literal"),
|
||||
Dim => write!(f, "dimension declaration"),
|
||||
DynNodeLiteral => write!(f, "dynamic node literal"),
|
||||
FuncIdent => write!(f, "function identifier"),
|
||||
IdentDtype => write!(f, "identifier primitive datatype"),
|
||||
IdentType => write!(f, "identifier type"),
|
||||
MapTransformLiteral => write!(f, "map transformation literal"),
|
||||
NumLiteral => write!(f, "numeric literal"),
|
||||
ParamDefault => write!(f, "param default"),
|
||||
ParamIdent => write!(f, "param identifier"),
|
||||
ParamName => write!(f, "param name"),
|
||||
ParamType => write!(f, "param type"),
|
||||
PkgPath => write!(f, "package path"),
|
||||
ShortDimNumLiteral => {
|
||||
write!(f, "short-hand dimensionalized numeric literal")
|
||||
}
|
||||
StringLiteral => write!(f, "string literal"),
|
||||
SymbolTableKey => write!(f, "symbol table key name"),
|
||||
TexMathLiteral => write!(f, "TeX math literal"),
|
||||
Title => write!(f, "title"),
|
||||
TplMetaIdent => write!(f, "template metadata identifier"),
|
||||
TplIdent => write!(f, "template name"),
|
||||
TplParamIdent => write!(f, "template param identifier"),
|
||||
TypeIdent => write!(f, "type identifier"),
|
||||
ValueIdent => write!(f, "value identifier"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A ([`SymbolId`], [`Span`]) pair in an attribute value context that may
|
||||
/// require desugaring and interpretation within the context of a template
|
||||
/// application.
|
||||
|
|
|
@ -230,7 +230,7 @@ ele_parse! {
|
|||
_xmlns_lv: (QN_XMLNS_LV?) => Option<Literal<URI_LV_RATER>>,
|
||||
|
||||
_id: (QN_ID?) => Option<N<{PkgPath}>>,
|
||||
_title: (QN_TITLE?) => Option<N<{PkgTitle}>>,
|
||||
_title: (QN_TITLE?) => Option<N<{Title}>>,
|
||||
_desc: (QN_DESC?) => Option<N<{DescLiteral}>>,
|
||||
// TODO: When can we get rid of this?
|
||||
_core: (QN_CORE?) => Option<N<{BooleanLiteral}>>,
|
||||
|
@ -403,7 +403,7 @@ ele_parse! {
|
|||
@ {
|
||||
_class: (QN_CLASS?) => Option<N<{ClassIdent}>>,
|
||||
_no: (QN_NO?) => Option<N<{ClassIdentList}>>,
|
||||
_yields: (QN_YIELDS) => N<{CalcIdent}>,
|
||||
_yields: (QN_YIELDS) => N<{ValueIdent}>,
|
||||
_desc: (QN_DESC?) => Option<N<{DescLiteral}>>,
|
||||
_sym: (QN_SYM?) => Option<N<{TexMathLiteral}>>,
|
||||
|
||||
|
@ -656,8 +656,8 @@ ele_parse! {
|
|||
SumExpr := QN_C_SUM {
|
||||
@ {
|
||||
_of: (QN_OF?) => Option<N<{ValueIdent}>>,
|
||||
_generates: (QN_GENERATES?) => Option<N<{CalcIdent}>>,
|
||||
_index: (QN_INDEX?) => Option<N<{CalcIdent}>>,
|
||||
_generates: (QN_GENERATES?) => Option<N<{ValueIdent}>>,
|
||||
_index: (QN_INDEX?) => Option<N<{ValueIdent}>>,
|
||||
_desc: (QN_DESC?) => Option<N<{DescLiteral}>>,
|
||||
_label: (QN_LABEL?) => Option<N<{DescLiteral}>>,
|
||||
_sym: (QN_SYM?) => Option<N<{TexMathLiteral}>>,
|
||||
|
@ -677,8 +677,8 @@ ele_parse! {
|
|||
ProductExpr := QN_C_PRODUCT {
|
||||
@ {
|
||||
_of: (QN_OF?) => Option<N<{ValueIdent}>>,
|
||||
_generates: (QN_GENERATES?) => Option<N<{CalcIdent}>>,
|
||||
_index: (QN_INDEX?) => Option<N<{CalcIdent}>>,
|
||||
_generates: (QN_GENERATES?) => Option<N<{ValueIdent}>>,
|
||||
_index: (QN_INDEX?) => Option<N<{ValueIdent}>>,
|
||||
_desc: (QN_DESC?) => Option<N<{DescLiteral}>>,
|
||||
_label: (QN_LABEL?) => Option<N<{DescLiteral}>>,
|
||||
_dot: (QN_DOT?) => Option<N<{BooleanLiteral}>>,
|
||||
|
@ -1376,7 +1376,7 @@ ele_parse! {
|
|||
/// Templates are applied using [`ApplyTemplate`] or [`TplApplyShort`].
|
||||
TemplateStmt := QN_TEMPLATE {
|
||||
@ {
|
||||
_name: (QN_NAME) => N<{TplName}>,
|
||||
_name: (QN_NAME) => N<{TplIdent}>,
|
||||
_desc: (QN_DESC) => N<{DescLiteral}>,
|
||||
} => SugaredNir::Todo,
|
||||
|
||||
|
|
Loading…
Reference in New Issue