Extracted meta symbol generation

* src/current/include/preproc/symtable.xsl
  (preproc:symtable)[lv:meta]: Extracted template.

* src/symtable/symbols.xsl
  (preproc:symtable)[lv:meta]: Added template.

* test/symtable/symbols.xsl
  (lv:meta): Scenario added
master
Mike Gerwitz 2016-11-17 08:55:07 -05:00
parent c199f4739e
commit f396858fb1
3 changed files with 68 additions and 8 deletions

View File

@ -901,14 +901,6 @@
</xsl:template>
<xsl:template match="lv:meta" mode="preproc:symtable" priority="5">
<xsl:for-each select="lv:prop">
<preproc:sym name=":meta:{@name}" type="meta"
keep="true" />
</xsl:for-each>
</xsl:template>
<xsl:template match="preproc:sym[ @type='param' ]" mode="preproc:symtable-complete" priority="5">
<xsl:param name="syms" as="element( preproc:sym )*" />

View File

@ -250,6 +250,7 @@
@menu
* Templates: Template Symbols. @code{tpl}
* Program Metadata: Program Metadata Symbols. @code{meta}
@end menu
-->
@ -291,4 +292,45 @@
</template>
<!--
@node Program Metadata Symbols
@subsection Program Metadata Symbols
A basic key-value system allows for compiling static metadata into
the program.
These metadata can be referenced externally without having to run
the program.
-->
<!--
Produce a @code{meta} symbol for each @pkgns{meta/}@pkgns{prop} with
the following attributes:
@table @code
@item name
The metavalue name as provided by @pkgns{prop/@@name},
prefixed with @samp{:meta:} to avoid conflicts with other
symbols.
@item desc
Generic description including @code{name}.
@item keep
Always @samp{true}.
@end table
The @code{name} prefix enforces separation between the two
compilation stages by preventing conflicts.
-->
<template mode="preproc:symtable" priority="5"
match="lv:meta">
<for-each select="lv:prop">
<preproc:sym type="meta"
name=":meta:{@name}"
desc="Metavalue {@name}"
keep="true" />
</for-each>
</template>
</stylesheet>

View File

@ -44,4 +44,30 @@
desc="Test template" />
</expect>
</scenario>
<scenario label="lv:meta">
<context mode="preproc:symtable">
<lv:meta>
<lv:prop name="prop1">
<lv:const value="ignore" />
</lv:prop>
<lv:prop name="prop2">
<lv:const value="ignore" />
</lv:prop>
</lv:meta>
</context>
<expect label="derives symbols from properties">
<preproc:sym type="meta"
name=":meta:prop1"
desc="Metavalue prop1"
keep="true" />
<preproc:sym type="meta"
name=":meta:prop2"
desc="Metavalue prop2"
keep="true" />
</expect>
</scenario>
</description>