Skip to content
Snippets Groups Projects
Commit a35f585f authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Tools.Standalone.precompile: Support the string(Xbit) syntax.

parent 0020e477
Branches
Tags
No related merge requests found
...@@ -1089,9 +1089,21 @@ class PikeType ...@@ -1089,9 +1089,21 @@ class PikeType
tmp=q[1..sizeof(q)-2]/({".."}); tmp=q[1..sizeof(q)-2]/({".."});
/* Workaround for buggy Parser.Pike */ /* Workaround for buggy Parser.Pike */
if(sizeof(tmp)==1) tmp=q[1..sizeof(q)-2]/({".. "}); if(sizeof(tmp)==1) tmp=q[1..sizeof(q)-2]/({".. "});
if (sizeof(tmp) == 1) {
int bits;
/* Support the string(Xbit) syntax too. */
if ((sizeof(q) == 4) && (q[2]->cast("string") == "bit") &&
((bits = (int)q[1]->cast("string")) > 0)) {
low = "0";
high = sprintf("%d", (1 << bits) - 1);
} else {
error("Syntax error in string subtype.\n");
}
} else {
if(sizeof(tmp[0])) low=tmp[0]->cast("string")*""; if(sizeof(tmp[0])) low=tmp[0]->cast("string")*"";
if(sizeof(tmp[1])) high=tmp[1]->cast("string")*""; if(sizeof(tmp[1])) high=tmp[1]->cast("string")*"";
} }
}
args=({PikeType(PC.Token(low)),PikeType(PC.Token(high))}); args=({PikeType(PC.Token(low)),PikeType(PC.Token(high))});
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment