Имплементирано нотирање "тачкасте листе"
This commit is contained in:
parent
687a1a8835
commit
075669842b
1
print.c
1
print.c
|
@ -5,6 +5,7 @@
|
|||
char *errors[] =
|
||||
{
|
||||
"Конс објекат мора бити правилна листа да би могао бити евалуиран",
|
||||
"Неправилан конс \".\" оператер",
|
||||
"Неправилан тип аргумента прослеђен функцији",
|
||||
"Непознати симбол",
|
||||
"Објекат није примењив",
|
||||
|
|
38
read.c
38
read.c
|
@ -413,6 +413,44 @@ object macroFunction(wchar_t m)
|
|||
SIGERR(ERR(error));
|
||||
}
|
||||
|
||||
int properDotComb = 1, dotPlace = -1, length;
|
||||
object *dot;
|
||||
for (length = 0, listCurrent = &result; TYPE(*listCurrent) !=
|
||||
nilObject; ++length, listCurrent = &CDR(*listCurrent))
|
||||
{
|
||||
if (TYPE(CAR(*listCurrent)) == symbolObject &&
|
||||
!strcmp(SYM(CAR(*listCurrent)), "."))
|
||||
{
|
||||
if (dotPlace == -1)
|
||||
{
|
||||
dotPlace = length;
|
||||
dot = listCurrent;
|
||||
}
|
||||
else
|
||||
{
|
||||
properDotComb = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dotPlace != -1)
|
||||
{
|
||||
if (dotPlace != length - 2 || dotPlace == 0)
|
||||
{
|
||||
properDotComb = 0;
|
||||
}
|
||||
}
|
||||
if (!properDotComb)
|
||||
{
|
||||
SIGERR(improperDotNotation);
|
||||
}
|
||||
if (dotPlace != -1 && properDotComb)
|
||||
{
|
||||
object tmp = copyObject(CAR(CDR(*dot)));
|
||||
deleteObject(*dot);
|
||||
*dot = tmp;
|
||||
}
|
||||
|
||||
return result;
|
||||
break;
|
||||
case L')':
|
||||
|
|
Loading…
Reference in a new issue