ICU-6866 update to remove parameter names

X-SVN-Rev: 25928
This commit is contained in:
Steven R. Loomis 2009-04-27 23:41:28 +00:00
parent f059417687
commit d787e0d3ad
2 changed files with 63 additions and 1 deletions

View File

@ -342,7 +342,59 @@ public class StableAPI {
prototype = prototype.replaceAll(s,"");
prototype = prototype.trim();
}
prototype = prototype.trim();
// Now, remove parameter names!
StringBuffer out = new StringBuffer();
StringBuffer in = new StringBuffer(prototype);
int openParen = in.indexOf("(");
int closeParen = in.lastIndexOf(")");
if(openParen==-1 || closeParen==-1) return; // exit, malformed?
if(openParen+1==closeParen) return; // exit: ()
out.append(in, 0, openParen+1); // prelude
for(int left = openParen+1; left<closeParen;) {
int right = in.indexOf(",", left+1); // right edge
if(right>=closeParen || right==-1 ) right=closeParen; // found last comma
// System.err.println("Considering " + left + " / " + right + " - " + closeParen + " : " + in.substring(left, right));
if(left==right) continue;
// find variable name
int rightCh = right-1;
if(rightCh==left) { // 1 ch- break
out.append(in,left,right);
continue;
}
// eat whitespace at right
int nameEndCh = rightCh;
while(nameEndCh>left && Character.isWhitespace(in.charAt(nameEndCh))) {
nameEndCh--;
}
int nameStartCh = nameEndCh;
while(nameStartCh>left && Character.isJavaIdentifierPart(in.charAt(nameStartCh))) {
nameStartCh--;
}
// now, did we find something to skip?
if(nameStartCh>left && nameEndCh>nameStartCh) {
out.append(in, left, nameStartCh+1);
} else {
// pass through
out.append(in, left, right);
}
left = right;
}
out.append(in, closeParen, in.length()); // postlude
// System.err.println(prototype+" -> " + out.toString());
prototype = out.toString();
}
// private Element toXml(Document doc){
// Element ele = doc.createElement("func");

View File

@ -137,10 +137,19 @@
<xsl:value-of select="'stabchange'" />
</xsl:if>
</xsl:attribute>
<xsl:if test = "@leftStatus = 'Draft' and @rightStatus = 'Stable' and @leftVersion = @rightVersion">
<xsl:attribute name="colspan">
2
</xsl:attribute>
<xsl:attribute name="align">
center
</xsl:attribute>
</xsl:if>
<xsl:value-of select="@leftStatus" />
<xsl:value-of select="@leftStatus" /><xsl:if test = "@leftStatus = 'Draft' and @rightStatus = 'Stable' and @leftVersion = @rightVersion">&gt;Stable</xsl:if>
<br/> <xsl:value-of select="@leftVersion" />
</td>
<xsl:if test = "@leftStatus != 'Draft' or @rightStatus != 'Stable' or @leftVersion != @rightVersion">
<td> <xsl:value-of select="@rightStatus" />
<br/>
<span>
@ -163,6 +172,7 @@
</xsl:if>
</span>
</td>
</xsl:if>
</tr>
</xsl:for-each>
</table>