fixes to preprocessor part
This commit is contained in:
parent
3ea06a4a2a
commit
4623ed60b0
3 changed files with 15 additions and 4 deletions
|
@ -31,7 +31,7 @@ IMPORT char *getwdir();
|
||||||
PRIVATE char ifstack[IFDEPTH]; /* if-stack: the content of an entry is */
|
PRIVATE char ifstack[IFDEPTH]; /* if-stack: the content of an entry is */
|
||||||
/* 1 if a corresponding ELSE has been */
|
/* 1 if a corresponding ELSE has been */
|
||||||
/* encountered. */
|
/* encountered. */
|
||||||
PRIVATE int nestlevel = -1; /* initially no nesting level. */
|
int nestlevel = -1; /* initially no nesting level. */
|
||||||
|
|
||||||
PRIVATE struct idf *
|
PRIVATE struct idf *
|
||||||
GetIdentifier()
|
GetIdentifier()
|
||||||
|
|
|
@ -44,7 +44,7 @@ int NoUnstack;
|
||||||
AtEoIT()
|
AtEoIT()
|
||||||
{
|
{
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
if (NoUnstack) lexerror("unexpected EOF");
|
if (NoUnstack) lexwarning("unexpected EOF");
|
||||||
DoUnstack();
|
DoUnstack();
|
||||||
#endif NOPP
|
#endif NOPP
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -52,6 +52,12 @@ AtEoIT()
|
||||||
|
|
||||||
AtEoIF()
|
AtEoIF()
|
||||||
{
|
{
|
||||||
if (NoUnstack) lexerror("unexpected EOF");
|
#ifndef NOPP
|
||||||
|
extern int nestlevel;
|
||||||
|
|
||||||
|
if (nestlevel != -1) lexwarning("missing #endif");
|
||||||
|
else
|
||||||
|
#endif NOPP
|
||||||
|
if (NoUnstack) lexwarning("unexpected EOF");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,10 +67,11 @@ getactuals(idef)
|
||||||
*/
|
*/
|
||||||
lexwarning("argument mismatch, %s", idef->id_text);
|
lexwarning("argument mismatch, %s", idef->id_text);
|
||||||
|
|
||||||
while (++nr_of_params < acnt) {
|
while (nr_of_params < acnt) {
|
||||||
/* too few paraeters: remaining actuals are ""
|
/* too few paraeters: remaining actuals are ""
|
||||||
*/
|
*/
|
||||||
actparams[nr_of_params] = "";
|
actparams[nr_of_params] = "";
|
||||||
|
nr_of_params++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,16 +114,19 @@ copyact(ch1, ch2, level)
|
||||||
|
|
||||||
switch(ch) {
|
switch(ch) {
|
||||||
|
|
||||||
|
#ifdef __MATCHING_PAR__
|
||||||
case ')':
|
case ')':
|
||||||
case '}':
|
case '}':
|
||||||
case ']':
|
case ']':
|
||||||
lexerror("unbalanced parenthesis");
|
lexerror("unbalanced parenthesis");
|
||||||
break;
|
break;
|
||||||
|
#endif __MATCHING_PAR__
|
||||||
|
|
||||||
case '(':
|
case '(':
|
||||||
copyact('(', ')', level+1);
|
copyact('(', ')', level+1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef __MATCHING_PAR__
|
||||||
case '{':
|
case '{':
|
||||||
/* example:
|
/* example:
|
||||||
#define declare(v, t) t v
|
#define declare(v, t) t v
|
||||||
|
@ -134,6 +138,7 @@ copyact(ch1, ch2, level)
|
||||||
case '[':
|
case '[':
|
||||||
copyact('[', ']', level+1);
|
copyact('[', ']', level+1);
|
||||||
break;
|
break;
|
||||||
|
#endif __MATCHING_PAR__
|
||||||
|
|
||||||
case '\n':
|
case '\n':
|
||||||
while (LoadChar(ch), ch == '#') {
|
while (LoadChar(ch), ch == '#') {
|
||||||
|
|
Loading…
Reference in a new issue