- hack for buggy scripts in production code.

This commit is contained in:
Christoph Oelckers 2020-05-12 23:19:01 +02:00
parent 248e0503d8
commit 11255cbf6a
1 changed files with 30 additions and 26 deletions

View File

@ -230,6 +230,33 @@ int findlabel(const char* text)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool ispecial(char c)
{
if (c == 0x0a)
{
line_number++;
return true;
}
// oh joy - we need to skip some more characters here to allow running broken scripts.
if (c == ' ' || c == 0x0d || c == '(' || c == ')' || c == ',' || c == ';')
return true;
return false;
}
bool isaltok(char c)
{
// isalnum pukes on negative input.
return c > 0 && (isalnum(c) || c == '{' || c == '}' || c == '/' || c == '*' || c == '-' || c == '_' || c == '.');
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void skiptoendofline() void skiptoendofline()
{ {
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0)
@ -272,6 +299,9 @@ bool skipcomments()
continue; continue;
} }
// stop if we got something else // stop if we got something else
// this line got added to skip over a stray semicolon in RR's COOT.CON.
if (ispecial(*textptr)) textptr++;
break; break;
} }
return *textptr != 0; return *textptr != 0;
@ -283,32 +313,6 @@ bool skipcomments()
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool ispecial(char c)
{
if (c == 0x0a)
{
line_number++;
return true;
}
if (c == ' ' || c == 0x0d)
return true;
return false;
}
bool isaltok(char c)
{
// isalnum pukes on negative input.
return c > 0 && (isalnum(c) || c == '{' || c == '}' || c == '/' || c == '*' || c == '-' || c == '_' || c == '.');
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
int keyword(void) int keyword(void)
{ {
int i; int i;