Skip to content

Commit

Permalink
Store string width in XML.
Browse files Browse the repository at this point in the history
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/PikeObjects.pmod:1.32
Rev: lib/modules/Tools.pmod/AutoDoc.pmod/PikeParser.pike:1.43
Rev: refdoc/xml.txt:1.3
  • Loading branch information
Martin Nilsson committed Mar 4, 2007
1 parent 7e8cb4e commit 84108be
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
12 changes: 12 additions & 0 deletions lib/modules/Tools.pmod/AutoDoc.pmod/PikeObjects.pmod
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,19 @@ class IntType {

class StringType {
inherit Type;
string width;
void create() { ::create("string"); }
string print() {
if (width)
return "string("+width+")";
else
return "string";
}
string xml() {
if (width)
return xmltag("string", xmltag("width",width));
return xmltag("string");
}
}

class MixedType {
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/Tools.pmod/AutoDoc.pmod/PikeParser.pike
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ StringType parseString() {
StringType s = StringType();
if (peekToken() == "(") {
readToken();
eatLiteral();
s->width = eatLiteral();
eat(")");
}
return s;
Expand Down
8 changes: 7 additions & 1 deletion refdoc/xml.txt
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ the form <foo/>:
<float/>
<mixed/>
<program/>
<string/>
<void/>

The same goes for mapping, array, function, object, multiset, &c that have
Expand Down Expand Up @@ -324,6 +323,13 @@ int

<int><min>0</min><max>MAX</max></int>

string
A string type can have a numerical width value.

string(8)

<string><width>8</width></string>

mapping
The types of the indices and values are given:

Expand Down

0 comments on commit 84108be

Please sign in to comment.