tame/tamer/tests/xmli/template/expected.xml

157 lines
2.9 KiB
XML
Raw Normal View History

<package xmlns="http://www.lovullo.com/rater"
xmlns:c="http://www.lovullo.com/calc"
xmlns:t="http://www.lovullo.com/rater/apply-template">
<template name="_empty_" />
<template name="_with-static-reachable_">
<rate yields="tplStaticA">
<c:sum />
</rate>
<classify as="tpl-static-b">
<any />
</classify>
</template>
<template name="_with-static-unreachable_">
<c:sum>
<c:product />
</c:sum>
<c:product>
<c:sum />
</c:product>
</template>
<template name="_with-static-mix-reachability_">
<c:sum>
<c:product />
</c:sum>
<c:product>
<c:sum />
</c:product>
<rate yields="tplStaticMix" />
<c:sum>
<c:product />
</c:sum>
</template>
<template name="_short-hand-nullary_" />
<apply-template name="_short-hand-nullary_" />
<template name="_short-hand-unary_" />
<apply-template name="_short-hand-unary_">
<with-param name="@foo@" value="bar" />
</apply-template>
<template name="_short-hand-nary_" />
<apply-template name="_short-hand-nary_">
<with-param name="@foo@" value="bar" />
<with-param name="@bar@" value="baz" />
<with-param name="@baz@" value="quux" />
</apply-template>
tamer: nir::tplshort: Desugar body into @values@ This represents a significant departure from how the XSLT-based TAME handles the `@values@` param, but it will end up having the same effect. It builds upon prior work, utilizing the fact that referencing a template in TAMER will expand it. The problem is this: allowing trees in `Meta` would add yet another container; we have `Pkg` and `Tpl` already. This was the same problem with template application---I didn't want to add support for binding arguments separately, and so re-used templates themselves, reaching the generalization I just mentioned above. `Meta` is intended to be a lexical metasyntatic variable. That keeps its implementation quite simple. But if we start allowing trees, that gets rather complicated really quickly, and starts to require much more complex AIR parser state. But we can accomplish the same behavior by desugaring into an existing container---a template---and placing the body within it. Then, in the future, we'll parse `param-copy` into a simple `Air::RefIdent`, which will expand the closed template and produce the same result as it does today in the XSLT-based system. This leaves open issues of closure (variable binding) in complex scenarios, such as in templates that introduce metavariables to be utilized by the body. That's never a practice I liked, but we'll see how things evolve. Further, this does not yet handle nested template applications. But this saved me a ton of work. Desugaring is much simpler. The question is going to be how the XSLT-based compiler responds to this for large packages with thousands of template applications. I'll have to see if it's worth the hit at that time, or if we should inline it when generating the `xmli` file, producing the same `@values@` as before. But as it stands at this moment, the output is _not_ compatible with the current compiler, as it expects `@values@` to be a tree, so a modification would have to be made there. DEV-13708
2023-03-23 14:40:40 -04:00
<template name="_short-hand-nullary-body_" />
<apply-template name="_short-hand-nullary-body_">
<with-param name="@values@" value="___dsgr-c23___" />
</apply-template>
<template name="___dsgr-c23___">
<c:product>
<c:sum />
</c:product>
</template>
<template name="_short-hand-nary-body_" />
<apply-template name="_short-hand-nary-body_">
<with-param name="@bar@" value="baz" />
<with-param name="@baz@" value="quux" />
<with-param name="@values@" value="___dsgr-cc2___" />
</apply-template>
<template name="___dsgr-cc2___">
<c:sum>
<c:product />
</c:sum>
</template>
<template name="_short-hand-nullary-outer_" />
<apply-template name="_short-hand-nullary-outer_">
<with-param name="@values@" value="___dsgr-d72___" />
</apply-template>
<template name="___dsgr-d72___">
<template name="_short-hand-nullary-inner-dfn-inner_" />
<apply-template name="_short-hand-nullary-inner-dfn-inner_" />
</template>
<template name="_short-hand-nullary-inner-dfn-outer_" />
<apply-template name="_short-hand-nullary-outer_">
<with-param name="@values@" value="___dsgr-e59___" />
</apply-template>
<template name="___dsgr-e59___">
<apply-template name="_short-hand-nullary-inner-dfn-outer_" />
</template>
<template name="_short-hand-unary-with-values_" />
<apply-template name="_short-hand-unary-with-values_">
<with-param name="@foo@" value="bar" />
<with-param name="@values@" value="___dsgr-eff___" />
</apply-template>
<template name="___dsgr-eff___">
<template name="_short-hand-unary-with-values-inner_" />
<apply-template name="_short-hand-unary-with-values-inner_" />
</template>
</package>