mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-01-22 23:29:55 +00:00
Fix some pointer to pointer problems and scan_rewind with string quotes
This commit is contained in:
parent
47ed2014e3
commit
def57dc263
@ -234,16 +234,18 @@ t_token scan(void)
|
|||||||
scanpos += 4;
|
scanpos += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (scanpos[0] == '\"')
|
else if ((scanpos[0] & 0x7F) == '\"') // Hack for string quote char in case we have to rewind later
|
||||||
{
|
{
|
||||||
char *scanshift;
|
char *scanshift, quotechar;
|
||||||
int scanoffset;
|
int scanoffset;
|
||||||
/*
|
/*
|
||||||
* String constant.
|
* String constant.
|
||||||
*/
|
*/
|
||||||
|
quotechar = scanpos[0];
|
||||||
|
*scanpos |= 0x80; // Set high bit in case of rewind
|
||||||
scantoken = STRING_TOKEN;
|
scantoken = STRING_TOKEN;
|
||||||
constval = (long)++scanpos;
|
constval = (long)++scanpos;
|
||||||
while (*scanpos && *scanpos != '\"')
|
while (*scanpos && *scanpos != quotechar)
|
||||||
{
|
{
|
||||||
if (*scanpos == '\\')
|
if (*scanpos == '\\')
|
||||||
{
|
{
|
||||||
@ -288,11 +290,12 @@ t_token scan(void)
|
|||||||
}
|
}
|
||||||
scanpos++;
|
scanpos++;
|
||||||
}
|
}
|
||||||
if (!*scanpos++)
|
if (!*scanpos)
|
||||||
{
|
{
|
||||||
parse_error("Unterminated string");
|
parse_error("Unterminated string");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
*scanpos++ |= 0x80; // Set high bit in case of rewind
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -501,7 +501,7 @@ t_opseq *parse_value(t_opseq *codeseq, int rvalue, int *stackdepth)
|
|||||||
if (stackdepth)
|
if (stackdepth)
|
||||||
*stackdepth = cfnvals;
|
*stackdepth = cfnvals;
|
||||||
cfnvals = 1;
|
cfnvals = 1;
|
||||||
type &= ~FUNC_TYPE;
|
type &= ~(FUNC_TYPE | VAR_TYPE);
|
||||||
}
|
}
|
||||||
else if (scantoken == OPEN_BRACKET_TOKEN)
|
else if (scantoken == OPEN_BRACKET_TOKEN)
|
||||||
{
|
{
|
||||||
@ -556,7 +556,7 @@ t_opseq *parse_value(t_opseq *codeseq, int rvalue, int *stackdepth)
|
|||||||
*stackdepth = cfnvals;
|
*stackdepth = cfnvals;
|
||||||
type &= ~FUNC_TYPE;
|
type &= ~FUNC_TYPE;
|
||||||
}
|
}
|
||||||
else if (type & VAR_TYPE)
|
else if (type & (VAR_TYPE | PTR_TYPE))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Pointer dereference
|
* Pointer dereference
|
||||||
|
Loading…
x
Reference in New Issue
Block a user