version 1.67, 2005/08/06 16:22:26 |
version 1.68, 2005/09/06 15:33:21 |
|
|
for (i = 1; *++token; i++) { |
for (i = 1; *++token; i++) { |
t = gpbc(); |
t = gpbc(); |
if (t == EOF || (unsigned char)t != (unsigned char)*token) { |
if (t == EOF || (unsigned char)t != (unsigned char)*token) { |
putback(t); |
pushback(t); |
while (--i) |
while (--i) |
putback(*--token); |
pushback(*--token); |
return 0; |
return 0; |
} |
} |
} |
} |
|
|
|
|
cycle { |
cycle { |
t = gpbc(); |
t = gpbc(); |
if (t == '_' || isalpha(t)) { |
|
|
if (LOOK_AHEAD(t,lquote)) { /* strip quotes */ |
|
nlpar = 0; |
|
record(quotes, nlpar++); |
|
/* |
|
* Opening quote: scan forward until matching |
|
* closing quote has been found. |
|
*/ |
|
do { |
|
|
|
l = gpbc(); |
|
if (LOOK_AHEAD(l,rquote)) { |
|
if (--nlpar > 0) |
|
outputstr(rquote); |
|
} else if (LOOK_AHEAD(l,lquote)) { |
|
record(quotes, nlpar++); |
|
outputstr(lquote); |
|
} else if (l == EOF) { |
|
if (nlpar == 1) |
|
warnx("unclosed quote:"); |
|
else |
|
warnx("%d unclosed quotes:", nlpar); |
|
dump_stack(quotes, nlpar); |
|
exit(1); |
|
} else { |
|
if (nlpar > 0) { |
|
if (sp < 0) |
|
reallyputchar(l); |
|
else |
|
CHRSAVE(l); |
|
} |
|
} |
|
} |
|
while (nlpar != 0); |
|
} else if (sp < 0 && LOOK_AHEAD(t, scommt)) { |
|
reallyoutputstr(scommt); |
|
|
|
for(;;) { |
|
t = gpbc(); |
|
if (LOOK_AHEAD(t, ecommt)) { |
|
reallyoutputstr(ecommt); |
|
break; |
|
} |
|
if (t == EOF) |
|
break; |
|
reallyputchar(t); |
|
} |
|
} else if (t == '_' || isalpha(t)) { |
p = inspect(t, token); |
p = inspect(t, token); |
if (p != NULL) |
if (p != NULL) |
putback(l = gpbc()); |
pushback(l = gpbc()); |
if (p == NULL || (l != LPAREN && |
if (p == NULL || (l != LPAREN && |
(macro_getdef(p)->type & NEEDARGS) != 0)) |
(macro_getdef(p)->type & NEEDARGS) != 0)) |
outputstr(token); |
outputstr(token); |
|
|
emit_synchline(); |
emit_synchline(); |
bufbase = bbase[ilevel]; |
bufbase = bbase[ilevel]; |
continue; |
continue; |
} |
} else if (sp < 0) { /* not in a macro at all */ |
/* |
|
* non-alpha token possibly seen.. |
|
* [the order of else if .. stmts is important.] |
|
*/ |
|
else if (LOOK_AHEAD(t,lquote)) { /* strip quotes */ |
|
nlpar = 0; |
|
record(quotes, nlpar++); |
|
/* |
|
* Opening quote: scan forward until matching |
|
* closing quote has been found. |
|
*/ |
|
do { |
|
|
|
l = gpbc(); |
|
if (LOOK_AHEAD(l,rquote)) { |
|
if (--nlpar > 0) |
|
outputstr(rquote); |
|
} else if (LOOK_AHEAD(l,lquote)) { |
|
record(quotes, nlpar++); |
|
outputstr(lquote); |
|
} else if (l == EOF) { |
|
if (nlpar == 1) |
|
warnx("unclosed quote:"); |
|
else |
|
warnx("%d unclosed quotes:", nlpar); |
|
dump_stack(quotes, nlpar); |
|
exit(1); |
|
} else { |
|
if (nlpar > 0) { |
|
if (sp < 0) |
|
reallyputchar(l); |
|
else |
|
CHRSAVE(l); |
|
} |
|
} |
|
} |
|
while (nlpar != 0); |
|
} |
|
|
|
else if (sp < 0 && LOOK_AHEAD(t, scommt)) { |
|
reallyoutputstr(scommt); |
|
|
|
for(;;) { |
|
t = gpbc(); |
|
if (LOOK_AHEAD(t, ecommt)) { |
|
reallyoutputstr(ecommt); |
|
break; |
|
} |
|
if (t == EOF) |
|
break; |
|
reallyputchar(t); |
|
} |
|
} |
|
|
|
else if (sp < 0) { /* not in a macro at all */ |
|
reallyputchar(t); /* output directly.. */ |
reallyputchar(t); /* output directly.. */ |
} |
} |
|
|
|
|
chrsave(t); |
chrsave(t); |
while (isspace(l = gpbc())) |
while (isspace(l = gpbc())) |
; /* skip blank, tab, nl.. */ |
; /* skip blank, tab, nl.. */ |
putback(l); |
pushback(l); |
record(paren, PARLEV++); |
record(paren, PARLEV++); |
break; |
break; |
|
|
|
|
chrsave(EOS); /* new argument */ |
chrsave(EOS); /* new argument */ |
while (isspace(l = gpbc())) |
while (isspace(l = gpbc())) |
; |
; |
putback(l); |
pushback(l); |
pushs(ep); |
pushs(ep); |
} else |
} else |
chrsave(t); |
chrsave(t); |
|
|
while ((isalnum(c = gpbc()) || c == '_') && tp < etp) |
while ((isalnum(c = gpbc()) || c == '_') && tp < etp) |
*tp++ = c; |
*tp++ = c; |
if (c != EOF) |
if (c != EOF) |
PUTBACK(c); |
PUSHBACK(c); |
*tp = EOS; |
*tp = EOS; |
/* token is too long, it won't match anything, but it can still |
/* token is too long, it won't match anything, but it can still |
* be output. */ |
* be output. */ |