mirror of
https://github.com/boostorg/boostbook.git
synced 2025-05-09 15:03:57 +00:00
Parse brackets in argsstring.
This may seem like overkill, but it's going to be needed for handling parameters to noexcept. Doesn't handle escapes because that my sanity is already stretched far enough. [SVN r86284]
This commit is contained in:
parent
a7dd45375d
commit
9e391505c4
@ -18,6 +18,16 @@
|
||||
<method name="virtual_abstract_method" cv="= 0" specifiers="virtual"><type>int</type></method>
|
||||
<method name="virtual_const_method" cv="const" specifiers="virtual"><type>int</type></method>
|
||||
<method name="method_with_default_value"><type>int</type><parameter name=""><paramtype>int</paramtype><default>default_value</default></parameter></method>
|
||||
<method name="method_with_fp"><type>int</type><parameter name="fp"><paramtype>int(*)()</paramtype></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
|
||||
<method name="method_with_string_default1"><type>int</type><parameter name=""><paramtype>char *</paramtype><default>")"</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
|
||||
<method name="method_with_string_default2"><type>int</type><parameter name=""><paramtype>char *</paramtype><default>"("</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
|
||||
<method name="method_with_char_default1"><type>int</type><parameter name=""><paramtype>char</paramtype><default>'('</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
|
||||
<method name="method_with_char_default2"><type>int</type><parameter name=""><paramtype>char</paramtype><default>')'</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
|
||||
<method name="volatile_method_with_fp" cv="volatile"><type>int</type><parameter name="fp"><paramtype>int(*)()</paramtype></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
|
||||
<method name="volatile_method_with_string_default1" cv="volatile"><type>int</type><parameter name=""><paramtype>char *</paramtype><default>")"</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
|
||||
<method name="volatile_method_with_string_default2" cv="volatile"><type>int</type><parameter name=""><paramtype>char *</paramtype><default>"("</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
|
||||
<method name="volatile_method_with_char_default1" cv="volatile"><type>int</type><parameter name=""><paramtype>char</paramtype><default>'('</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
|
||||
<method name="volatile_method_with_char_default2" cv="volatile"><type>int</type><parameter name=""><paramtype>char</paramtype><default>')'</default></parameter><parameter name=""><paramtype>volatile char</paramtype></parameter></method>
|
||||
<method name="const_method" cv="const"><type>void</type></method>
|
||||
<method name="volatile_method" cv="volatile"><type>void</type></method>
|
||||
<method name="trad_noexcept" cv="noexcept"><type>void</type></method>
|
||||
|
@ -39,6 +39,18 @@ namespace example
|
||||
virtual int virtual_const_method() const;
|
||||
int method_with_default_value(int = default_value);
|
||||
|
||||
int method_with_fp(int (*fp)(), volatile char);
|
||||
int method_with_string_default1(char* = ")", volatile char);
|
||||
int method_with_string_default2(char* = "(", volatile char);
|
||||
int method_with_char_default1(char = '(', volatile char);
|
||||
int method_with_char_default2(char = ')', volatile char);
|
||||
|
||||
int volatile_method_with_fp(int (*fp)(), volatile char) volatile;
|
||||
int volatile_method_with_string_default1(char* = ")", volatile char) volatile;
|
||||
int volatile_method_with_string_default2(char* = "(", volatile char) volatile;
|
||||
int volatile_method_with_char_default1(char = '(', volatile char) volatile;
|
||||
int volatile_method_with_char_default2(char = ')', volatile char) volatile;
|
||||
|
||||
void const_method() const;
|
||||
void volatile_method() volatile;
|
||||
|
||||
|
@ -1062,9 +1062,18 @@
|
||||
<xsl:template name="function.attributes">
|
||||
|
||||
<!-- argsstring = '(arguments) [= delete] [= default] [constexpt]' -->
|
||||
<xsl:variable name="extra-qualifiers" select="concat(' ',
|
||||
normalize-space(substring-after(argsstring/text(), ')')),
|
||||
' ')" />
|
||||
<xsl:variable name="extra-qualifiers-a">
|
||||
<xsl:if test="contains(argsstring/text(), '(')">
|
||||
<xsl:call-template name="strip-brackets">
|
||||
<xsl:with-param name="text" select="substring-after(argsstring/text(), '(')" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="extra-qualifiers">
|
||||
<xsl:if test="$extra-qualifiers-a">
|
||||
<xsl:value-of select="concat(' ', normalize-space($extra-qualifiers-a), ' ')" />
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<!-- CV Qualifiers -->
|
||||
<!-- Plus deleted and defaulted function markers as they're not properly
|
||||
@ -1109,6 +1118,55 @@
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!-- $text = substring after the opening bracket -->
|
||||
<xsl:template name="strip-brackets">
|
||||
<xsl:param name="text"/>
|
||||
|
||||
<xsl:if test="contains($text, ')')">
|
||||
<xsl:variable name="prefix1" select="substring-before($text, ')')" />
|
||||
<xsl:variable name="prefix2" select="substring($prefix1, 1,
|
||||
string-length(substring-before($prefix1, '(')) +
|
||||
999 * not(contains($prefix1, '(')))" />
|
||||
<xsl:variable name="prefix3" select="substring($prefix2, 1,
|
||||
string-length(substring-before($prefix2, '"')) +
|
||||
999 * not(contains($prefix2, '"')))" />
|
||||
<xsl:variable name="prefix" select="substring($prefix3, 1,
|
||||
string-length(substring-before($prefix3, "'")) +
|
||||
999 * not(contains($prefix3, "'")))" />
|
||||
|
||||
<xsl:variable name="prefix-length" select="string-length($prefix)" />
|
||||
<xsl:variable name="char" select="substring($text, $prefix-length + 1, 1)" />
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="$char=')'">
|
||||
<xsl:value-of select="substring($text, $prefix-length + 2)" />
|
||||
</xsl:when>
|
||||
<xsl:when test="$char='('">
|
||||
<xsl:variable name="text2">
|
||||
<xsl:call-template name="strip-brackets">
|
||||
<xsl:with-param name="text" select="substring($text, $prefix-length + 2)" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<xsl:call-template name="strip-brackets">
|
||||
<xsl:with-param name="text" select="$text2" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="$char="'"">
|
||||
<!-- Not bothering with escapes, because this is crazy enough as it is -->
|
||||
<xsl:call-template name="strip-brackets">
|
||||
<xsl:with-param name="text" select="substring-after(substring($text, $prefix-length + 2), "'")" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="$char='"'">
|
||||
<!-- Not bothering with escapes, because this is crazy enough as it is -->
|
||||
<xsl:call-template name="strip-brackets">
|
||||
<xsl:with-param name="text" select="substring-after(substring($text, $prefix-length + 2), '"')" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Handle function children -->
|
||||
<xsl:template name="function.children">
|
||||
<xsl:param name="is-overloaded" select="false()"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user