public int readMessage()
{
int foundSymbol = 0;
pushPos();
readPadding();
foundSymbol = readSymbol();
char groupChar;
while (readSeparator() != 0 || readComment() != 0);
groupChar = peekChar();
// this is bug in original IoVM so I've commented this out
if ("[{".IndexOf(groupChar) != -1 || (foundSymbol == 0 &&
groupChar == '('))
{
string groupName = nameForGroupChar(groupChar);
addTokenStringType(groupName, IoTokenType.IDENTIFIER_TOKEN);
}
if (readTokenCharsType("([{", IoTokenType.OPENPAREN_TOKEN) != 0)
{
readPadding();
do {
IoTokenType type = currentToken().type;
readPadding();
// Empty argument: (... ,)
if (IoTokenType.COMMA_TOKEN == type)
{
char c = current;
if (',' == c || ")]}".IndexOf(c) != -1)
{
readMessageError("missing argument in argument list");
return 0;
}
}
if (groupChar == '[') specialChars = "._";
messageChain();
if (groupChar == '[') specialChars = ":._";
readPadding();
} while (readTokenCharType(',', IoTokenType.COMMA_TOKEN) != 0);
if (readTokenCharsType(")]}", IoTokenType.CLOSEPAREN_TOKEN) == 0)
{
if (groupChar == '(')
{
readMessageError("unmatched ()s");
}
else if (groupChar == '[')
{
readMessageError("unmatched []s");
}
else if (groupChar == '{')
{
readMessageError("unmatched {}s");
}
return 0;
}
popPos();
return 1;
}
if (foundSymbol != 0)
{
popPos();
return 1;
}
popPosBack();
return 0;
}