Помогите проверить правильность процедуры ввода на языке Паскаль.Пожалуйста.
В качестве параметров можно использовать идентификаторы, строковые константы, заключенные в двойные кавычки, и одиночные символы, заключенные в одинарные кавычки.
True
proc1('s',13,"sss");
proc2('s',s,d,11,"sss");
proc3("sss");
False
proc1(s',11,"sss");
proc2('s',s,d,11,sss");
proc3("sss);
proc4("sss";
Моя жалкая попытка:
public void ThreadPoolCallback(Object threadContext)
{
if ((str.Length == 0) && (str[str.Length - 1] != ')'))
{
haveError = true;
}
else
{
int startIndex = str.IndexOf('('),
lastIndex = str.LastIndexOf(')'),
startIndex2 = str.LastIndexOf('('),
lastIndex2 = str.IndexOf(')');
if (startIndex < lastIndex && startIndex > 0 && lastIndex == str.Length - 1 &&
startIndex == startIndex2 && lastIndex == lastIndex2)
{
int curr = startIndex + 1;
while (curr < lastIndex)
{
string s = "";
while (str[curr] != ',' && curr < lastIndex)
{
s += str[curr];
curr++;
}
curr++;
}
}
else
{
haveError = true;
}
}
doneEvent.Set();
}