Run files through clang-format before editing.
This commit is contained in:
parent
bed39e1f4d
commit
788f439a48
|
@ -22,10 +22,10 @@
|
||||||
/* Data about the token yielded */
|
/* Data about the token yielded */
|
||||||
struct token dot, ahead, aside;
|
struct token dot, ahead, aside;
|
||||||
int token_nmb = 0; /* number of the ahead token */
|
int token_nmb = 0; /* number of the ahead token */
|
||||||
int tk_nmb_at_last_syn_err = -5/*ERR_SHADOW*/;
|
int tk_nmb_at_last_syn_err = -5 /*ERR_SHADOW*/;
|
||||||
/* token number at last syntax error */
|
/* token number at last syntax error */
|
||||||
int idfsize = IDFSIZE;
|
int idfsize = IDFSIZE;
|
||||||
char sp_occurred[SP_TOTAL+1];
|
char sp_occurred[SP_TOTAL + 1];
|
||||||
|
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
int ReplaceMacros = 1; /* replacing macros */
|
int ReplaceMacros = 1; /* replacing macros */
|
||||||
|
@ -74,18 +74,19 @@ PopLex()
|
||||||
}
|
}
|
||||||
#endif /* NOPP */
|
#endif /* NOPP */
|
||||||
|
|
||||||
int
|
int LLlex()
|
||||||
LLlex()
|
|
||||||
{
|
{
|
||||||
/* LLlex() plays the role of Lexical Analyzer for the C parser.
|
/* LLlex() plays the role of Lexical Analyzer for the C parser.
|
||||||
The look-ahead and putting aside of tokens are taken into
|
The look-ahead and putting aside of tokens are taken into
|
||||||
account.
|
account.
|
||||||
*/
|
*/
|
||||||
if (ASIDE) { /* a token is put aside */
|
if (ASIDE)
|
||||||
|
{ /* a token is put aside */
|
||||||
dot = aside;
|
dot = aside;
|
||||||
ASIDE = 0;
|
ASIDE = 0;
|
||||||
}
|
}
|
||||||
else { /* read ahead and return the old one */
|
else
|
||||||
|
{ /* read ahead and return the old one */
|
||||||
#ifdef LINT
|
#ifdef LINT
|
||||||
lint_comment_ahead();
|
lint_comment_ahead();
|
||||||
#endif /* LINT */
|
#endif /* LINT */
|
||||||
|
@ -104,13 +105,10 @@ LLlex()
|
||||||
return DOT;
|
return DOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* string_token();
|
||||||
char *string_token();
|
|
||||||
arith char_constant();
|
arith char_constant();
|
||||||
|
|
||||||
int
|
int GetToken(ptok) register struct token* ptok;
|
||||||
GetToken(ptok)
|
|
||||||
register struct token *ptok;
|
|
||||||
{
|
{
|
||||||
/* GetToken() is the actual token recognizer. It calls the
|
/* GetToken() is the actual token recognizer. It calls the
|
||||||
control line interpreter if it encounters a "\n{w}*#"
|
control line interpreter if it encounters a "\n{w}*#"
|
||||||
|
@ -122,7 +120,8 @@ GetToken(ptok)
|
||||||
|
|
||||||
token_nmb++;
|
token_nmb++;
|
||||||
|
|
||||||
if (File_Inserted) {
|
if (File_Inserted)
|
||||||
|
{
|
||||||
File_Inserted = 0;
|
File_Inserted = 0;
|
||||||
goto firstline;
|
goto firstline;
|
||||||
}
|
}
|
||||||
|
@ -138,9 +137,10 @@ go_on: /* rescan, the following character has been read */
|
||||||
ptok->tk_file = FileName;
|
ptok->tk_file = FileName;
|
||||||
ptok->tk_line = LineNumber;
|
ptok->tk_line = LineNumber;
|
||||||
|
|
||||||
switch (class(ch)) { /* detect character class */
|
switch (class(ch))
|
||||||
|
{ /* detect character class */
|
||||||
case STNL: /* newline, vertical space or formfeed */
|
case STNL: /* newline, vertical space or formfeed */
|
||||||
firstline:
|
firstline:
|
||||||
LineNumber++; /* also at vs and ff */
|
LineNumber++; /* also at vs and ff */
|
||||||
ptok->tk_file = FileName;
|
ptok->tk_file = FileName;
|
||||||
ptok->tk_line = LineNumber;
|
ptok->tk_line = LineNumber;
|
||||||
|
@ -150,25 +150,32 @@ firstline:
|
||||||
*/
|
*/
|
||||||
return ptok->tk_symb = EOI;
|
return ptok->tk_symb = EOI;
|
||||||
|
|
||||||
while ((ch = GetChar()),
|
while ((ch = GetChar()), (ch == '#'
|
||||||
(ch == '#'
|
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
|| ch == '/'
|
|| ch == '/'
|
||||||
#endif
|
#endif
|
||||||
|| class(ch) == STSKIP)) {
|
|| class(ch) == STSKIP))
|
||||||
|
{
|
||||||
/* blanks are allowed before hashes */
|
/* blanks are allowed before hashes */
|
||||||
if (ch == '#') {
|
if (ch == '#')
|
||||||
|
{
|
||||||
/* a control line follows */
|
/* a control line follows */
|
||||||
domacro();
|
domacro();
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
if (File_Inserted) {
|
if (File_Inserted)
|
||||||
|
{
|
||||||
File_Inserted = 0;
|
File_Inserted = 0;
|
||||||
goto firstline;
|
goto firstline;
|
||||||
}
|
}
|
||||||
} else if (ch == '/') {
|
}
|
||||||
if ((GetChar() == '*') && !InputLevel) {
|
else if (ch == '/')
|
||||||
|
{
|
||||||
|
if ((GetChar() == '*') && !InputLevel)
|
||||||
|
{
|
||||||
skipcomment();
|
skipcomment();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
UnGetChar();
|
UnGetChar();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -184,11 +191,14 @@ firstline:
|
||||||
goto again;
|
goto again;
|
||||||
case STGARB: /* garbage character */
|
case STGARB: /* garbage character */
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
garbage:
|
garbage:
|
||||||
#endif
|
#endif
|
||||||
if (040 < ch && ch < 0177) {
|
if (040 < ch && ch < 0177)
|
||||||
|
{
|
||||||
return ptok->tk_symb = ch;
|
return ptok->tk_symb = ch;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
lexerror("garbage char \\%03o", ch);
|
lexerror("garbage char \\%03o", ch);
|
||||||
}
|
}
|
||||||
goto again;
|
goto again;
|
||||||
|
@ -196,7 +206,8 @@ garbage:
|
||||||
return ptok->tk_symb = ch;
|
return ptok->tk_symb = ch;
|
||||||
case STCOMP: /* maybe the start of a compound token */
|
case STCOMP: /* maybe the start of a compound token */
|
||||||
nch = GetChar(); /* character lookahead */
|
nch = GetChar(); /* character lookahead */
|
||||||
switch (ch) {
|
switch (ch)
|
||||||
|
{
|
||||||
case '!':
|
case '!':
|
||||||
if (nch == '=')
|
if (nch == '=')
|
||||||
return ptok->tk_symb = NOTEQUAL;
|
return ptok->tk_symb = NOTEQUAL;
|
||||||
|
@ -222,13 +233,14 @@ garbage:
|
||||||
return ptok->tk_symb = MINAB;
|
return ptok->tk_symb = MINAB;
|
||||||
break;
|
break;
|
||||||
case '<':
|
case '<':
|
||||||
if (AccFileSpecifier) {
|
if (AccFileSpecifier)
|
||||||
|
{
|
||||||
UnGetChar(); /* pushback nch */
|
UnGetChar(); /* pushback nch */
|
||||||
ptok->tk_bts = string_token("file specifier",
|
ptok->tk_bts = string_token("file specifier", '>', &(ptok->tk_len));
|
||||||
'>', &(ptok->tk_len));
|
|
||||||
return ptok->tk_symb = FILESPECIFIER;
|
return ptok->tk_symb = FILESPECIFIER;
|
||||||
}
|
}
|
||||||
if (nch == '<') {
|
if (nch == '<')
|
||||||
|
{
|
||||||
if ((nch = GetChar()) == '=')
|
if ((nch = GetChar()) == '=')
|
||||||
return ptok->tk_symb = LEFTAB;
|
return ptok->tk_symb = LEFTAB;
|
||||||
UnGetChar();
|
UnGetChar();
|
||||||
|
@ -244,7 +256,8 @@ garbage:
|
||||||
case '>':
|
case '>':
|
||||||
if (nch == '=')
|
if (nch == '=')
|
||||||
return ptok->tk_symb = GREATEREQ;
|
return ptok->tk_symb = GREATEREQ;
|
||||||
if (nch == '>') {
|
if (nch == '>')
|
||||||
|
{
|
||||||
if ((nch = GetChar()) == '=')
|
if ((nch = GetChar()) == '=')
|
||||||
return ptok->tk_symb = RIGHTAB;
|
return ptok->tk_symb = RIGHTAB;
|
||||||
UnGetChar();
|
UnGetChar();
|
||||||
|
@ -271,7 +284,8 @@ garbage:
|
||||||
break;
|
break;
|
||||||
case '/':
|
case '/':
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
if (nch == '*' && !InputLevel) {
|
if (nch == '*' && !InputLevel)
|
||||||
|
{
|
||||||
skipcomment();
|
skipcomment();
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
@ -295,12 +309,14 @@ garbage:
|
||||||
return ptok->tk_symb = STRING;
|
return ptok->tk_symb = STRING;
|
||||||
case STELL: /* wide character constant/string prefix */
|
case STELL: /* wide character constant/string prefix */
|
||||||
nch = GetChar();
|
nch = GetChar();
|
||||||
if (nch == '"') {
|
if (nch == '"')
|
||||||
ptok->tk_bts = string_token("wide character string",
|
{
|
||||||
'"', &(ptok->tk_len));
|
ptok->tk_bts = string_token("wide character string", '"', &(ptok->tk_len));
|
||||||
ptok->tk_fund = WCHAR; /* string of wide characters */
|
ptok->tk_fund = WCHAR; /* string of wide characters */
|
||||||
return ptok->tk_symb = STRING;
|
return ptok->tk_symb = STRING;
|
||||||
} else if (nch == '\'') {
|
}
|
||||||
|
else if (nch == '\'')
|
||||||
|
{
|
||||||
ptok->tk_ival = char_constant("wide character");
|
ptok->tk_ival = char_constant("wide character");
|
||||||
ptok->tk_fund = INT;
|
ptok->tk_fund = INT;
|
||||||
return ptok->tk_symb = INTEGER;
|
return ptok->tk_symb = INTEGER;
|
||||||
|
@ -309,21 +325,25 @@ garbage:
|
||||||
/* fallthrough */
|
/* fallthrough */
|
||||||
case STIDF:
|
case STIDF:
|
||||||
{
|
{
|
||||||
register char *tg = &buf[0];
|
register char* tg = &buf[0];
|
||||||
register int pos = -1;
|
register int pos = -1;
|
||||||
register struct idf *idef;
|
register struct idf* idef;
|
||||||
extern int idfsize; /* ??? */
|
extern int idfsize; /* ??? */
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
int NoExpandNext = 0;
|
int NoExpandNext = 0;
|
||||||
|
|
||||||
if (Unstacked) EnableMacros(); /* unstack macro's when allowed. */
|
if (Unstacked)
|
||||||
if (ch == NOEXPM) {
|
EnableMacros(); /* unstack macro's when allowed. */
|
||||||
|
if (ch == NOEXPM)
|
||||||
|
{
|
||||||
NoExpandNext = 1;
|
NoExpandNext = 1;
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
do { /* read the identifier */
|
do
|
||||||
if (++pos < idfsize) {
|
{ /* read the identifier */
|
||||||
|
if (++pos < idfsize)
|
||||||
|
{
|
||||||
*tg++ = ch;
|
*tg++ = ch;
|
||||||
}
|
}
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
|
@ -337,47 +357,52 @@ garbage:
|
||||||
idef->id_file = ptok->tk_file;
|
idef->id_file = ptok->tk_file;
|
||||||
idef->id_line = ptok->tk_line;
|
idef->id_line = ptok->tk_line;
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
if (idef->id_macro && ReplaceMacros && !NoExpandNext) {
|
if (idef->id_macro && ReplaceMacros && !NoExpandNext)
|
||||||
|
{
|
||||||
if (replace(idef))
|
if (replace(idef))
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
if (UnknownIdIsZero && idef->id_reserved != SIZEOF) {
|
if (UnknownIdIsZero && idef->id_reserved != SIZEOF)
|
||||||
|
{
|
||||||
ptok->tk_ival = (arith)0;
|
ptok->tk_ival = (arith)0;
|
||||||
ptok->tk_fund = INT;
|
ptok->tk_fund = INT;
|
||||||
return ptok->tk_symb = INTEGER;
|
return ptok->tk_symb = INTEGER;
|
||||||
}
|
}
|
||||||
#endif /* NOPP */
|
#endif /* NOPP */
|
||||||
ptok->tk_symb = (
|
ptok->tk_symb
|
||||||
idef->id_reserved
|
= (idef->id_reserved
|
||||||
? idef->id_reserved
|
? idef->id_reserved
|
||||||
: idef->id_def && idef->id_def->df_sc == TYPEDEF
|
: idef->id_def && idef->id_def->df_sc == TYPEDEF ? TYPE_IDENTIFIER
|
||||||
? TYPE_IDENTIFIER
|
: IDENTIFIER);
|
||||||
: IDENTIFIER
|
|
||||||
);
|
|
||||||
return IDENTIFIER;
|
return IDENTIFIER;
|
||||||
}
|
}
|
||||||
case STNUM: /* a numeric constant */
|
case STNUM: /* a numeric constant */
|
||||||
{
|
{
|
||||||
register int siz_left = NUMSIZE - 1;
|
register int siz_left = NUMSIZE - 1;
|
||||||
register char *np = &buf[0];
|
register char* np = &buf[0];
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
|
||||||
#define store(ch) if (--siz_left >= 0) \
|
#define store(ch) \
|
||||||
|
if (--siz_left >= 0) \
|
||||||
*np++ = ch;
|
*np++ = ch;
|
||||||
|
|
||||||
if (ch == '.') {
|
if (ch == '.')
|
||||||
|
{
|
||||||
/* An embarrasing ambiguity. We have either a
|
/* An embarrasing ambiguity. We have either a
|
||||||
pp-number, a field operator, an ELLIPSIS or
|
pp-number, a field operator, an ELLIPSIS or
|
||||||
an error (..).
|
an error (..).
|
||||||
*/
|
*/
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
if (!is_dig(ch)) { /* . or ... */
|
if (!is_dig(ch))
|
||||||
if (ch == '.') {
|
{ /* . or ... */
|
||||||
|
if (ch == '.')
|
||||||
|
{
|
||||||
if ((ch = GetChar()) == '.')
|
if ((ch = GetChar()) == '.')
|
||||||
return ptok->tk_symb = ELLIPSIS;
|
return ptok->tk_symb = ELLIPSIS;
|
||||||
UnGetChar(); /* not '.' */
|
UnGetChar(); /* not '.' */
|
||||||
ChPushBack('.'); /* sigh ... */
|
ChPushBack('.'); /* sigh ... */
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
UnGetChar(); /* not '.' */
|
UnGetChar(); /* not '.' */
|
||||||
return ptok->tk_symb = '.';
|
return ptok->tk_symb = '.';
|
||||||
}
|
}
|
||||||
|
@ -387,31 +412,37 @@ garbage:
|
||||||
}
|
}
|
||||||
store(ch);
|
store(ch);
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
while(in_idf(ch) || ch == '.') {
|
while (in_idf(ch) || ch == '.')
|
||||||
|
{
|
||||||
store(ch);
|
store(ch);
|
||||||
if (ch == '.') flags |= FLG_DOTSEEN;
|
if (ch == '.')
|
||||||
if (ch == 'e' || ch == 'E') {
|
flags |= FLG_DOTSEEN;
|
||||||
|
if (ch == 'e' || ch == 'E')
|
||||||
|
{
|
||||||
flags |= FLG_ESEEN;
|
flags |= FLG_ESEEN;
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
if (ch == '+' || ch == '-') {
|
if (ch == '+' || ch == '-')
|
||||||
|
{
|
||||||
flags |= FLG_DOTSEEN; /* trick */
|
flags |= FLG_DOTSEEN; /* trick */
|
||||||
store(ch);
|
store(ch);
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
}
|
}
|
||||||
} else ch = GetChar();
|
}
|
||||||
|
else
|
||||||
|
ch = GetChar();
|
||||||
}
|
}
|
||||||
store('\0');
|
store('\0');
|
||||||
UnGetChar();
|
UnGetChar();
|
||||||
|
|
||||||
np = &buf[0];
|
np = &buf[0];
|
||||||
ch = *np++;
|
ch = *np++;
|
||||||
if (siz_left < 0) {
|
if (siz_left < 0)
|
||||||
|
{
|
||||||
lexerror("number too long");
|
lexerror("number too long");
|
||||||
if ((flags & FLG_DOTSEEN)
|
if ((flags & FLG_DOTSEEN)
|
||||||
|| (flags & FLG_ESEEN
|
|| (flags & FLG_ESEEN && !(ch == '0' && (*np == 'x' || *np == 'X'))))
|
||||||
&& !(ch == '0'
|
{
|
||||||
&& (*np == 'x' || *np == 'X')))) {
|
ptok->tk_fval = Salloc("0.0", (unsigned)4);
|
||||||
ptok->tk_fval = Salloc("0.0", (unsigned) 4);
|
|
||||||
ptok->tk_fund = DOUBLE;
|
ptok->tk_fund = DOUBLE;
|
||||||
return ptok->tk_symb = FLOATING;
|
return ptok->tk_symb = FLOATING;
|
||||||
}
|
}
|
||||||
|
@ -421,8 +452,8 @@ garbage:
|
||||||
}
|
}
|
||||||
/* Now, the pp-number must be converted into a token */
|
/* Now, the pp-number must be converted into a token */
|
||||||
if ((flags & FLG_DOTSEEN)
|
if ((flags & FLG_DOTSEEN)
|
||||||
|| (flags & FLG_ESEEN
|
|| (flags & FLG_ESEEN && !(ch == '0' && (*np == 'x' || *np == 'X'))))
|
||||||
&& !(ch == '0' && (*np == 'x' || *np == 'X')))) {
|
{
|
||||||
strflt2tok(&buf[0], ptok);
|
strflt2tok(&buf[0], ptok);
|
||||||
return ptok->tk_symb = FLOATING;
|
return ptok->tk_symb = FLOATING;
|
||||||
}
|
}
|
||||||
|
@ -433,9 +464,11 @@ garbage:
|
||||||
return ptok->tk_symb = EOI;
|
return ptok->tk_symb = EOI;
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
case STMSPEC:
|
case STMSPEC:
|
||||||
if (!InputLevel) goto garbage;
|
if (!InputLevel)
|
||||||
if (ch == TOKSEP) goto again;
|
goto garbage;
|
||||||
/* fallthrough shouldn't happen */
|
if (ch == TOKSEP)
|
||||||
|
goto again;
|
||||||
|
/* fallthrough shouldn't happen */
|
||||||
#endif
|
#endif
|
||||||
default: /* this cannot happen */
|
default: /* this cannot happen */
|
||||||
crash("bad class for char 0%o", ch);
|
crash("bad class for char 0%o", ch);
|
||||||
|
@ -444,8 +477,7 @@ garbage:
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
void
|
void skipcomment()
|
||||||
skipcomment()
|
|
||||||
{
|
{
|
||||||
/* The last character read has been the '*' of '/_*'. The
|
/* The last character read has been the '*' of '/_*'. The
|
||||||
characters, except NL and EOI, between '/_*' and the first
|
characters, except NL and EOI, between '/_*' and the first
|
||||||
|
@ -462,46 +494,54 @@ skipcomment()
|
||||||
NoUnstack++;
|
NoUnstack++;
|
||||||
c = GetChar();
|
c = GetChar();
|
||||||
#ifdef LINT
|
#ifdef LINT
|
||||||
if (! lint_skip_comment) {
|
if (!lint_skip_comment)
|
||||||
|
{
|
||||||
lint_start_comment();
|
lint_start_comment();
|
||||||
lint_comment_char(c);
|
lint_comment_char(c);
|
||||||
}
|
}
|
||||||
#endif /* LINT */
|
#endif /* LINT */
|
||||||
do {
|
do
|
||||||
while (c != '*') {
|
{
|
||||||
if (class(c) == STNL) {
|
while (c != '*')
|
||||||
|
{
|
||||||
|
if (class(c) == STNL)
|
||||||
|
{
|
||||||
++LineNumber;
|
++LineNumber;
|
||||||
} else if (c == EOI) {
|
}
|
||||||
|
else if (c == EOI)
|
||||||
|
{
|
||||||
NoUnstack--;
|
NoUnstack--;
|
||||||
#ifdef LINT
|
#ifdef LINT
|
||||||
if (! lint_skip_comment) lint_end_comment();
|
if (!lint_skip_comment)
|
||||||
|
lint_end_comment();
|
||||||
#endif /* LINT */
|
#endif /* LINT */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
oldc = c;
|
oldc = c;
|
||||||
c = GetChar();
|
c = GetChar();
|
||||||
#ifdef LINT
|
#ifdef LINT
|
||||||
if (! lint_skip_comment) lint_comment_char(c);
|
if (!lint_skip_comment)
|
||||||
|
lint_comment_char(c);
|
||||||
#endif /* LINT */
|
#endif /* LINT */
|
||||||
} /* last Character seen was '*' */
|
} /* last Character seen was '*' */
|
||||||
c = GetChar();
|
c = GetChar();
|
||||||
if ( c != '/' && oldc == '/')
|
if (c != '/' && oldc == '/')
|
||||||
lexwarning("comment inside comment ?");
|
lexwarning("comment inside comment ?");
|
||||||
oldc = '*';
|
oldc = '*';
|
||||||
#ifdef LINT
|
#ifdef LINT
|
||||||
if (! lint_skip_comment) lint_comment_char(c);
|
if (!lint_skip_comment)
|
||||||
|
lint_comment_char(c);
|
||||||
#endif /* LINT */
|
#endif /* LINT */
|
||||||
} while (c != '/');
|
} while (c != '/');
|
||||||
#ifdef LINT
|
#ifdef LINT
|
||||||
if (! lint_skip_comment) lint_end_comment();
|
if (!lint_skip_comment)
|
||||||
|
lint_end_comment();
|
||||||
#endif /* LINT */
|
#endif /* LINT */
|
||||||
NoUnstack--;
|
NoUnstack--;
|
||||||
}
|
}
|
||||||
#endif /* NOPP */
|
#endif /* NOPP */
|
||||||
|
|
||||||
arith
|
arith char_constant(nm) char* nm;
|
||||||
char_constant(nm)
|
|
||||||
char *nm;
|
|
||||||
{
|
{
|
||||||
register arith val = 0;
|
register arith val = 0;
|
||||||
register int ch;
|
register int ch;
|
||||||
|
@ -511,15 +551,18 @@ char_constant(nm)
|
||||||
if (ch == '\'')
|
if (ch == '\'')
|
||||||
lexerror("%s constant too short", nm);
|
lexerror("%s constant too short", nm);
|
||||||
else
|
else
|
||||||
while (ch != '\'') {
|
while (ch != '\'')
|
||||||
if (ch == '\n') {
|
{
|
||||||
|
if (ch == '\n')
|
||||||
|
{
|
||||||
lexerror("newline in %s constant", nm);
|
lexerror("newline in %s constant", nm);
|
||||||
LineNumber++;
|
LineNumber++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ch == '\\')
|
if (ch == '\\')
|
||||||
ch = quoted(GetChar());
|
ch = quoted(GetChar());
|
||||||
if (ch >= 128) ch -= 256;
|
if (ch >= 128)
|
||||||
|
ch -= 256;
|
||||||
if (size < (int)int_size)
|
if (size < (int)int_size)
|
||||||
val |= ch << 8 * size;
|
val |= ch << 8 * size;
|
||||||
size++;
|
size++;
|
||||||
|
@ -532,24 +575,25 @@ char_constant(nm)
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char* string_token(nm, stop_char, plen) char* nm;
|
||||||
string_token(nm, stop_char, plen)
|
int* plen;
|
||||||
char *nm;
|
|
||||||
int *plen;
|
|
||||||
{
|
{
|
||||||
register int ch;
|
register int ch;
|
||||||
register int str_size;
|
register int str_size;
|
||||||
register char *str = Malloc((unsigned) (str_size = ISTRSIZE));
|
register char* str = Malloc((unsigned)(str_size = ISTRSIZE));
|
||||||
register int pos = 0;
|
register int pos = 0;
|
||||||
|
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
while (ch != stop_char) {
|
while (ch != stop_char)
|
||||||
if (ch == '\n') {
|
{
|
||||||
|
if (ch == '\n')
|
||||||
|
{
|
||||||
lexerror("newline in %s", nm);
|
lexerror("newline in %s", nm);
|
||||||
LineNumber++;
|
LineNumber++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ch == EOI) {
|
if (ch == EOI)
|
||||||
|
{
|
||||||
lexerror("end-of-file inside %s", nm);
|
lexerror("end-of-file inside %s", nm);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -557,7 +601,7 @@ string_token(nm, stop_char, plen)
|
||||||
ch = quoted(GetChar());
|
ch = quoted(GetChar());
|
||||||
str[pos++] = ch;
|
str[pos++] = ch;
|
||||||
if (pos == str_size)
|
if (pos == str_size)
|
||||||
str = Realloc(str, (unsigned) (str_size += RSTRSIZE));
|
str = Realloc(str, (unsigned)(str_size += RSTRSIZE));
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
}
|
}
|
||||||
str[pos++] = '\0'; /* for filenames etc. */
|
str[pos++] = '\0'; /* for filenames etc. */
|
||||||
|
@ -565,16 +609,16 @@ string_token(nm, stop_char, plen)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int quoted(ch) register int ch;
|
||||||
quoted(ch)
|
|
||||||
register int ch;
|
|
||||||
{
|
{
|
||||||
/* quoted() replaces an escaped character sequence by the
|
/* quoted() replaces an escaped character sequence by the
|
||||||
character meant.
|
character meant.
|
||||||
*/
|
*/
|
||||||
/* first char after backslash already in ch */
|
/* first char after backslash already in ch */
|
||||||
if (!is_oct(ch)) { /* a quoted char */
|
if (!is_oct(ch))
|
||||||
switch (ch) {
|
{ /* a quoted char */
|
||||||
|
switch (ch)
|
||||||
|
{
|
||||||
case 'n':
|
case 'n':
|
||||||
ch = '\n';
|
ch = '\n';
|
||||||
break;
|
break;
|
||||||
|
@ -601,7 +645,8 @@ quoted(ch)
|
||||||
register int hex = 0;
|
register int hex = 0;
|
||||||
register int vch;
|
register int vch;
|
||||||
|
|
||||||
for (;;) {
|
for (;;)
|
||||||
|
{
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
if ((vch = hex_val(ch)) == -1)
|
if ((vch = hex_val(ch)) == -1)
|
||||||
break;
|
break;
|
||||||
|
@ -612,32 +657,27 @@ quoted(ch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { /* a quoted octal */
|
else
|
||||||
|
{ /* a quoted octal */
|
||||||
register int oct = 0, cnt = 0;
|
register int oct = 0, cnt = 0;
|
||||||
|
|
||||||
do {
|
do
|
||||||
oct = oct*8 + (ch-'0');
|
{
|
||||||
|
oct = oct * 8 + (ch - '0');
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
} while (is_oct(ch) && ++cnt < 3);
|
} while (is_oct(ch) && ++cnt < 3);
|
||||||
UnGetChar();
|
UnGetChar();
|
||||||
ch = oct;
|
ch = oct;
|
||||||
}
|
}
|
||||||
return ch&0377;
|
return ch & 0377;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int hex_val(ch) register int ch;
|
||||||
int
|
|
||||||
hex_val(ch)
|
|
||||||
register int ch;
|
|
||||||
{
|
{
|
||||||
return is_dig(ch) ? ch - '0'
|
return is_dig(ch) ? ch - '0' : is_hex(ch) ? (ch - 'a' + 10) & 017 : -1;
|
||||||
: is_hex(ch) ? (ch - 'a' + 10) & 017
|
|
||||||
: -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetChar()
|
||||||
int
|
|
||||||
GetChar()
|
|
||||||
{
|
{
|
||||||
/* The routines GetChar and trigraph parses the trigraph
|
/* The routines GetChar and trigraph parses the trigraph
|
||||||
sequences and removes occurences of \\\n.
|
sequences and removes occurences of \\\n.
|
||||||
|
@ -655,9 +695,11 @@ again:
|
||||||
ch = trigraph();
|
ch = trigraph();
|
||||||
|
|
||||||
/* \<newline> is removed from the input stream */
|
/* \<newline> is removed from the input stream */
|
||||||
if (ch == '\\') {
|
if (ch == '\\')
|
||||||
|
{
|
||||||
LoadChar(ch);
|
LoadChar(ch);
|
||||||
if (ch == '\n') {
|
if (ch == '\n')
|
||||||
|
{
|
||||||
++LineNumber;
|
++LineNumber;
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
@ -665,113 +707,133 @@ again:
|
||||||
ch = '\\';
|
ch = '\\';
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return(LexSave = ch);
|
return (LexSave = ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NOPP
|
#ifndef NOPP
|
||||||
int
|
int trigraph()
|
||||||
trigraph()
|
|
||||||
{
|
{
|
||||||
register int ch;
|
register int ch;
|
||||||
|
|
||||||
LoadChar(ch);
|
LoadChar(ch);
|
||||||
if (ch == '?') {
|
if (ch == '?')
|
||||||
|
{
|
||||||
LoadChar(ch);
|
LoadChar(ch);
|
||||||
switch (ch) { /* its a trigraph */
|
switch (ch)
|
||||||
|
{ /* its a trigraph */
|
||||||
case '=':
|
case '=':
|
||||||
ch = '#';
|
ch = '#';
|
||||||
return(ch);
|
return (ch);
|
||||||
case '(':
|
case '(':
|
||||||
ch = '[';
|
ch = '[';
|
||||||
return(ch);
|
return (ch);
|
||||||
case '/':
|
case '/':
|
||||||
ch = '\\';
|
ch = '\\';
|
||||||
return(ch);
|
return (ch);
|
||||||
case ')':
|
case ')':
|
||||||
ch = ']';
|
ch = ']';
|
||||||
return(ch);
|
return (ch);
|
||||||
case '\'':
|
case '\'':
|
||||||
ch = '^';
|
ch = '^';
|
||||||
return(ch);
|
return (ch);
|
||||||
case '<':
|
case '<':
|
||||||
ch = '{';
|
ch = '{';
|
||||||
return(ch);
|
return (ch);
|
||||||
case '!':
|
case '!':
|
||||||
ch = '|';
|
ch = '|';
|
||||||
return(ch);
|
return (ch);
|
||||||
case '>':
|
case '>':
|
||||||
ch = '}';
|
ch = '}';
|
||||||
return(ch);
|
return (ch);
|
||||||
case '-':
|
case '-':
|
||||||
ch = '~';
|
ch = '~';
|
||||||
return(ch);
|
return (ch);
|
||||||
}
|
}
|
||||||
PushBack();
|
PushBack();
|
||||||
}
|
}
|
||||||
PushBack();
|
PushBack();
|
||||||
return('?');
|
return ('?');
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* strflt2tok only checks the syntax of the floating-point number and
|
/* strflt2tok only checks the syntax of the floating-point number and
|
||||||
* selects the right type for the number.
|
* selects the right type for the number.
|
||||||
*/
|
*/
|
||||||
strflt2tok(fltbuf, ptok)
|
strflt2tok(fltbuf, ptok) char fltbuf[];
|
||||||
char fltbuf[];
|
struct token* ptok;
|
||||||
struct token *ptok;
|
|
||||||
{
|
{
|
||||||
register char *cp = fltbuf;
|
register char* cp = fltbuf;
|
||||||
int malformed = 0;
|
int malformed = 0;
|
||||||
|
|
||||||
while (is_dig(*cp)) cp++;
|
while (is_dig(*cp))
|
||||||
if (*cp == '.') {
|
cp++;
|
||||||
|
if (*cp == '.')
|
||||||
|
{
|
||||||
|
cp++;
|
||||||
|
while (is_dig(*cp))
|
||||||
cp++;
|
cp++;
|
||||||
while (is_dig(*cp)) cp++;
|
|
||||||
}
|
}
|
||||||
if (*cp == 'e' || *cp == 'E') {
|
if (*cp == 'e' || *cp == 'E')
|
||||||
|
{
|
||||||
cp++;
|
cp++;
|
||||||
if (*cp == '+' || *cp == '-')
|
if (*cp == '+' || *cp == '-')
|
||||||
cp++;
|
cp++;
|
||||||
if (!is_dig(*cp)) malformed++;
|
if (!is_dig(*cp))
|
||||||
while (is_dig(*cp)) cp++;
|
malformed++;
|
||||||
|
while (is_dig(*cp))
|
||||||
|
cp++;
|
||||||
}
|
}
|
||||||
if (*cp == 'f' || *cp == 'F') {
|
if (*cp == 'f' || *cp == 'F')
|
||||||
if (*(cp + 1)) malformed++;
|
{
|
||||||
|
if (*(cp + 1))
|
||||||
|
malformed++;
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
ptok->tk_fund = FLOAT;
|
ptok->tk_fund = FLOAT;
|
||||||
} else if (*cp == 'l' || *cp == 'L') {
|
}
|
||||||
if (*(cp + 1)) malformed++;
|
else if (*cp == 'l' || *cp == 'L')
|
||||||
|
{
|
||||||
|
if (*(cp + 1))
|
||||||
|
malformed++;
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
ptok->tk_fund = LNGDBL;
|
ptok->tk_fund = LNGDBL;
|
||||||
} else {
|
}
|
||||||
if (*cp) malformed++;
|
else
|
||||||
|
{
|
||||||
|
if (*cp)
|
||||||
|
malformed++;
|
||||||
ptok->tk_fund = DOUBLE;
|
ptok->tk_fund = DOUBLE;
|
||||||
}
|
}
|
||||||
if (malformed) {
|
if (malformed)
|
||||||
|
{
|
||||||
lexerror("malformed floating constant");
|
lexerror("malformed floating constant");
|
||||||
ptok->tk_fval = Salloc("0.0", (unsigned) 4);
|
ptok->tk_fval = Salloc("0.0", (unsigned)4);
|
||||||
} else {
|
}
|
||||||
ptok->tk_fval = Salloc(fltbuf, (unsigned) (cp - fltbuf + 1));
|
else
|
||||||
|
{
|
||||||
|
ptok->tk_fval = Salloc(fltbuf, (unsigned)(cp - fltbuf + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strint2tok(intbuf, ptok)
|
strint2tok(intbuf, ptok) char intbuf[];
|
||||||
char intbuf[];
|
struct token* ptok;
|
||||||
struct token *ptok;
|
|
||||||
{
|
{
|
||||||
register char *cp = intbuf;
|
register char* cp = intbuf;
|
||||||
int base = 10;
|
int base = 10;
|
||||||
arith val = 0, dig, ubound;
|
arith val = 0, dig, ubound;
|
||||||
int uns_flg = 0, lng_flg = 0, malformed = 0, ovfl = 0;
|
int uns_flg = 0, lng_flg = 0, malformed = 0, ovfl = 0;
|
||||||
int fund;
|
int fund;
|
||||||
|
|
||||||
assert(*cp != '-');
|
assert(*cp != '-');
|
||||||
if (*cp == '0') {
|
if (*cp == '0')
|
||||||
|
{
|
||||||
cp++;
|
cp++;
|
||||||
if (*cp == 'x' || *cp == 'X') {
|
if (*cp == 'x' || *cp == 'X')
|
||||||
|
{
|
||||||
cp++;
|
cp++;
|
||||||
base = 16;
|
base = 16;
|
||||||
} else base = 8;
|
}
|
||||||
|
else
|
||||||
|
base = 8;
|
||||||
}
|
}
|
||||||
/* The upperbound will be the same as when computed with
|
/* The upperbound will be the same as when computed with
|
||||||
* max_unsigned_arith / base (since base is even). The problem here
|
* max_unsigned_arith / base (since base is even). The problem here
|
||||||
|
@ -779,68 +841,99 @@ struct token *ptok;
|
||||||
*/
|
*/
|
||||||
ubound = max_arith / (base / 2);
|
ubound = max_arith / (base / 2);
|
||||||
|
|
||||||
while (is_hex(*cp)) {
|
while (is_hex(*cp))
|
||||||
|
{
|
||||||
dig = hex_val(*cp);
|
dig = hex_val(*cp);
|
||||||
if (dig >= base) {
|
if (dig >= base)
|
||||||
|
{
|
||||||
malformed++; /* ignore */
|
malformed++; /* ignore */
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
if (val < 0 || val > ubound) ovfl++;
|
{
|
||||||
|
if (val < 0 || val > ubound)
|
||||||
|
ovfl++;
|
||||||
val *= base;
|
val *= base;
|
||||||
if (val < 0 && val + dig >= 0) ovfl++;
|
if (val < 0 && val + dig >= 0)
|
||||||
|
ovfl++;
|
||||||
val += dig;
|
val += dig;
|
||||||
}
|
}
|
||||||
cp++;
|
cp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (*cp) {
|
while (*cp)
|
||||||
if (*cp == 'l' || *cp == 'L') lng_flg++;
|
{
|
||||||
else if (*cp == 'u' || *cp == 'U') uns_flg++;
|
if (*cp == 'l' || *cp == 'L')
|
||||||
else break;
|
lng_flg++;
|
||||||
|
else if (*cp == 'u' || *cp == 'U')
|
||||||
|
uns_flg++;
|
||||||
|
else
|
||||||
|
break;
|
||||||
cp++;
|
cp++;
|
||||||
}
|
}
|
||||||
if (*cp) {
|
if (*cp)
|
||||||
|
{
|
||||||
malformed++;
|
malformed++;
|
||||||
}
|
}
|
||||||
if (malformed) {
|
if (malformed)
|
||||||
lexerror("malformed %s integer constant",
|
{
|
||||||
(base == 10 ? "decimal"
|
lexerror(
|
||||||
: (base == 8 ? "octal"
|
"malformed %s integer constant",
|
||||||
: "hexadecimal")));
|
(base == 10 ? "decimal" : (base == 8 ? "octal" : "hexadecimal")));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (lng_flg > 1)
|
if (lng_flg > 1)
|
||||||
lexerror("only one long suffix allowed");
|
lexerror("only one long suffix allowed");
|
||||||
if (uns_flg > 1)
|
if (uns_flg > 1)
|
||||||
lexerror("only one unsigned suffix allowed");
|
lexerror("only one unsigned suffix allowed");
|
||||||
}
|
}
|
||||||
if (ovfl) {
|
if (ovfl)
|
||||||
|
{
|
||||||
lexwarning("overflow in constant");
|
lexwarning("overflow in constant");
|
||||||
fund = ULONG;
|
fund = ULONG;
|
||||||
} else if (!lng_flg && (val & full_mask[(int)int_size]) == val) {
|
}
|
||||||
if (val >= 0 && val <= max_int) {
|
else if (!lng_flg && (val & full_mask[(int)int_size]) == val)
|
||||||
|
{
|
||||||
|
if (val >= 0 && val <= max_int)
|
||||||
|
{
|
||||||
fund = INT;
|
fund = INT;
|
||||||
} else if (int_size == long_size) {
|
}
|
||||||
|
else if (int_size == long_size)
|
||||||
|
{
|
||||||
fund = UNSIGNED;
|
fund = UNSIGNED;
|
||||||
} else if (base == 10 && !uns_flg)
|
}
|
||||||
|
else if (base == 10 && !uns_flg)
|
||||||
fund = LONG;
|
fund = LONG;
|
||||||
else fund = UNSIGNED;
|
else
|
||||||
} else if((val & full_mask[(int)long_size]) == val) {
|
fund = UNSIGNED;
|
||||||
if (val >= 0) fund = LONG;
|
}
|
||||||
else fund = ULONG;
|
else if ((val & full_mask[(int)long_size]) == val)
|
||||||
} else { /* sizeof(arith) is greater than long_size */
|
{
|
||||||
|
if (val >= 0)
|
||||||
|
fund = LONG;
|
||||||
|
else
|
||||||
|
fund = ULONG;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ /* sizeof(arith) is greater than long_size */
|
||||||
assert(arith_size > long_size);
|
assert(arith_size > long_size);
|
||||||
lexwarning("constant too large for target machine");
|
lexwarning("constant too large for target machine");
|
||||||
/* cut the size to prevent further complaints */
|
/* cut the size to prevent further complaints */
|
||||||
val &= full_mask[(int)long_size];
|
val &= full_mask[(int)long_size];
|
||||||
fund = ULONG;
|
fund = ULONG;
|
||||||
}
|
}
|
||||||
if (lng_flg) {
|
if (lng_flg)
|
||||||
|
{
|
||||||
/* fund can't be INT */
|
/* fund can't be INT */
|
||||||
if (fund == UNSIGNED) fund = ULONG;
|
if (fund == UNSIGNED)
|
||||||
|
fund = ULONG;
|
||||||
}
|
}
|
||||||
if (uns_flg) {
|
if (uns_flg)
|
||||||
if (fund == INT) fund = UNSIGNED;
|
{
|
||||||
else if (fund == LONG) fund = ULONG;
|
if (fund == INT)
|
||||||
|
fund = UNSIGNED;
|
||||||
|
else if (fund == LONG)
|
||||||
|
fund = ULONG;
|
||||||
}
|
}
|
||||||
ptok->tk_fund = fund;
|
ptok->tk_fund = fund;
|
||||||
ptok->tk_ival = val;
|
ptok->tk_ival = val;
|
||||||
|
|
|
@ -30,23 +30,19 @@ int AccFileSpecifier = 0; /* return filespecifier <...> */
|
||||||
int LexSave = 0; /* last character read by GetChar */
|
int LexSave = 0; /* last character read by GetChar */
|
||||||
extern int InputLevel; /* # of current macro expansions */
|
extern int InputLevel; /* # of current macro expansions */
|
||||||
|
|
||||||
extern char *string_token();
|
extern char* string_token();
|
||||||
extern arith char_constant();
|
extern arith char_constant();
|
||||||
#define FLG_ESEEN 0x01 /* possibly a floating point number */
|
#define FLG_ESEEN 0x01 /* possibly a floating point number */
|
||||||
#define FLG_DOTSEEN 0x02 /* certainly a floating point number */
|
#define FLG_DOTSEEN 0x02 /* certainly a floating point number */
|
||||||
|
|
||||||
void skipcomment();
|
void skipcomment();
|
||||||
|
|
||||||
int
|
int LLlex()
|
||||||
LLlex()
|
|
||||||
{
|
{
|
||||||
return (DOT != EOF) ? GetToken(&dot) : EOF;
|
return (DOT != EOF) ? GetToken(&dot) : EOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetToken(ptok) register struct token* ptok;
|
||||||
int
|
|
||||||
GetToken(ptok)
|
|
||||||
register struct token *ptok;
|
|
||||||
{
|
{
|
||||||
/* GetToken() is the actual token recognizer. It calls the
|
/* GetToken() is the actual token recognizer. It calls the
|
||||||
control line interpreter if it encounters a "\n{w}*#"
|
control line interpreter if it encounters a "\n{w}*#"
|
||||||
|
@ -63,14 +59,15 @@ again: /* rescan the input after an error or replacement */
|
||||||
fatal("non-ascii '\\%03o' read", ch & 0377);
|
fatal("non-ascii '\\%03o' read", ch & 0377);
|
||||||
/* keep track of the place of the token in the file */
|
/* keep track of the place of the token in the file */
|
||||||
|
|
||||||
switch (class(ch)) { /* detect character class */
|
switch (class(ch))
|
||||||
|
{ /* detect character class */
|
||||||
case STNL: /* newline, vertical space or formfeed */
|
case STNL: /* newline, vertical space or formfeed */
|
||||||
LineNumber++;
|
LineNumber++;
|
||||||
return ptok->tk_symb = EOF;
|
return ptok->tk_symb = EOF;
|
||||||
case STSKIP: /* just skip the skip characters */
|
case STSKIP: /* just skip the skip characters */
|
||||||
goto again;
|
goto again;
|
||||||
case STGARB: /* garbage character */
|
case STGARB: /* garbage character */
|
||||||
garbage:
|
garbage:
|
||||||
if (040 < ch && ch < 0177)
|
if (040 < ch && ch < 0177)
|
||||||
error("garbage char %c", ch);
|
error("garbage char %c", ch);
|
||||||
else
|
else
|
||||||
|
@ -80,7 +77,8 @@ garbage:
|
||||||
return ptok->tk_symb = ch;
|
return ptok->tk_symb = ch;
|
||||||
case STCOMP: /* maybe the start of a compound token */
|
case STCOMP: /* maybe the start of a compound token */
|
||||||
nch = GetChar(); /* character lookahead */
|
nch = GetChar(); /* character lookahead */
|
||||||
switch (ch) {
|
switch (ch)
|
||||||
|
{
|
||||||
case '!':
|
case '!':
|
||||||
if (nch == '=')
|
if (nch == '=')
|
||||||
return ptok->tk_symb = NOTEQUAL;
|
return ptok->tk_symb = NOTEQUAL;
|
||||||
|
@ -110,17 +108,20 @@ garbage:
|
||||||
UnGetChar();
|
UnGetChar();
|
||||||
return ptok->tk_symb = ch;
|
return ptok->tk_symb = ch;
|
||||||
case '<':
|
case '<':
|
||||||
if (AccFileSpecifier) {
|
if (AccFileSpecifier)
|
||||||
|
{
|
||||||
UnGetChar(); /* pushback nch */
|
UnGetChar(); /* pushback nch */
|
||||||
ptok->tk_str =
|
ptok->tk_str = string_token("file specifier", '>');
|
||||||
string_token("file specifier", '>');
|
|
||||||
return ptok->tk_symb = FILESPECIFIER;
|
return ptok->tk_symb = FILESPECIFIER;
|
||||||
} else if (nch == '<') {
|
}
|
||||||
|
else if (nch == '<')
|
||||||
|
{
|
||||||
if ((nch = GetChar()) == '=')
|
if ((nch = GetChar()) == '=')
|
||||||
return ptok->tk_symb = LEFTAB;
|
return ptok->tk_symb = LEFTAB;
|
||||||
UnGetChar();
|
UnGetChar();
|
||||||
return ptok->tk_symb = LEFT;
|
return ptok->tk_symb = LEFT;
|
||||||
} else if (nch == '=')
|
}
|
||||||
|
else if (nch == '=')
|
||||||
return ptok->tk_symb = LESSEQ;
|
return ptok->tk_symb = LESSEQ;
|
||||||
UnGetChar();
|
UnGetChar();
|
||||||
return ptok->tk_symb = ch;
|
return ptok->tk_symb = ch;
|
||||||
|
@ -132,7 +133,8 @@ garbage:
|
||||||
case '>':
|
case '>':
|
||||||
if (nch == '=')
|
if (nch == '=')
|
||||||
return ptok->tk_symb = GREATEREQ;
|
return ptok->tk_symb = GREATEREQ;
|
||||||
else if (nch == '>') {
|
else if (nch == '>')
|
||||||
|
{
|
||||||
if ((nch = GetChar()) == '=')
|
if ((nch = GetChar()) == '=')
|
||||||
return ptok->tk_symb = RIGHTAB;
|
return ptok->tk_symb = RIGHTAB;
|
||||||
UnGetChar();
|
UnGetChar();
|
||||||
|
@ -163,7 +165,8 @@ garbage:
|
||||||
UnGetChar();
|
UnGetChar();
|
||||||
return ptok->tk_symb = ch;
|
return ptok->tk_symb = ch;
|
||||||
case '/':
|
case '/':
|
||||||
if (nch == '*' && !InputLevel) {
|
if (nch == '*' && !InputLevel)
|
||||||
|
{
|
||||||
skipcomment();
|
skipcomment();
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
@ -183,11 +186,13 @@ garbage:
|
||||||
return ptok->tk_symb = STRING;
|
return ptok->tk_symb = STRING;
|
||||||
case STELL: /* wide character constant/string prefix */
|
case STELL: /* wide character constant/string prefix */
|
||||||
nch = GetChar();
|
nch = GetChar();
|
||||||
if (nch == '"') {
|
if (nch == '"')
|
||||||
ptok->tk_str =
|
{
|
||||||
string_token("wide character string", '"');
|
ptok->tk_str = string_token("wide character string", '"');
|
||||||
return ptok->tk_symb = STRING;
|
return ptok->tk_symb = STRING;
|
||||||
} else if (nch == '\'') {
|
}
|
||||||
|
else if (nch == '\'')
|
||||||
|
{
|
||||||
ptok->tk_val = char_constant("wide character");
|
ptok->tk_val = char_constant("wide character");
|
||||||
return ptok->tk_symb = INTEGER;
|
return ptok->tk_symb = INTEGER;
|
||||||
}
|
}
|
||||||
|
@ -196,33 +201,57 @@ garbage:
|
||||||
case STIDF:
|
case STIDF:
|
||||||
{
|
{
|
||||||
extern int idfsize; /* ??? */
|
extern int idfsize; /* ??? */
|
||||||
register char *tg = &buf[0];
|
register char* tg = &buf[0];
|
||||||
register char *maxpos = &buf[idfsize];
|
register char* maxpos = &buf[idfsize];
|
||||||
int NoExpandNext = 0;
|
int NoExpandNext = 0;
|
||||||
|
|
||||||
#define tstmac(bx) if (!(bits[ch] & bx)) goto nomac
|
#define tstmac(bx) \
|
||||||
|
if (!(bits[ch] & bx)) \
|
||||||
|
goto nomac
|
||||||
#define cpy *tg++ = ch
|
#define cpy *tg++ = ch
|
||||||
#define load (ch = GetChar()); if (!in_idf(ch)) goto endidf
|
#define load \
|
||||||
|
(ch = GetChar()); \
|
||||||
|
if (!in_idf(ch)) \
|
||||||
|
goto endidf
|
||||||
|
|
||||||
if (Unstacked) EnableMacros(); /* unstack macro's when allowed. */
|
if (Unstacked)
|
||||||
if (ch == NOEXPM) {
|
EnableMacros(); /* unstack macro's when allowed. */
|
||||||
|
if (ch == NOEXPM)
|
||||||
|
{
|
||||||
NoExpandNext = 1;
|
NoExpandNext = 1;
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
}
|
}
|
||||||
#ifdef DOBITS
|
#ifdef DOBITS
|
||||||
cpy; tstmac(bit0); load;
|
|
||||||
cpy; tstmac(bit1); load;
|
|
||||||
cpy; tstmac(bit2); load;
|
|
||||||
cpy; tstmac(bit3); load;
|
|
||||||
cpy; tstmac(bit4); load;
|
|
||||||
cpy; tstmac(bit5); load;
|
|
||||||
cpy; tstmac(bit6); load;
|
|
||||||
cpy; tstmac(bit7); load;
|
|
||||||
#endif
|
|
||||||
for(;;) {
|
|
||||||
if (tg < maxpos) {
|
|
||||||
cpy;
|
cpy;
|
||||||
|
tstmac(bit0);
|
||||||
|
load;
|
||||||
|
cpy;
|
||||||
|
tstmac(bit1);
|
||||||
|
load;
|
||||||
|
cpy;
|
||||||
|
tstmac(bit2);
|
||||||
|
load;
|
||||||
|
cpy;
|
||||||
|
tstmac(bit3);
|
||||||
|
load;
|
||||||
|
cpy;
|
||||||
|
tstmac(bit4);
|
||||||
|
load;
|
||||||
|
cpy;
|
||||||
|
tstmac(bit5);
|
||||||
|
load;
|
||||||
|
cpy;
|
||||||
|
tstmac(bit6);
|
||||||
|
load;
|
||||||
|
cpy;
|
||||||
|
tstmac(bit7);
|
||||||
|
load;
|
||||||
|
#endif
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
if (tg < maxpos)
|
||||||
|
{
|
||||||
|
cpy;
|
||||||
}
|
}
|
||||||
load;
|
load;
|
||||||
}
|
}
|
||||||
|
@ -230,10 +259,12 @@ garbage:
|
||||||
/*if (ch != EOI) UnGetChar();*/
|
/*if (ch != EOI) UnGetChar();*/
|
||||||
UnGetChar();
|
UnGetChar();
|
||||||
*tg++ = '\0'; /* mark the end of the identifier */
|
*tg++ = '\0'; /* mark the end of the identifier */
|
||||||
if (ReplaceMacros) {
|
if (ReplaceMacros)
|
||||||
register struct idf *idef = findidf(buf);
|
{
|
||||||
|
register struct idf* idef = findidf(buf);
|
||||||
|
|
||||||
if (idef && idef->id_macro && !NoExpandNext) {
|
if (idef && idef->id_macro && !NoExpandNext)
|
||||||
|
{
|
||||||
if (replace(idef))
|
if (replace(idef))
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
@ -241,15 +272,18 @@ garbage:
|
||||||
|
|
||||||
nomac: /* buf can already be null-terminated. soit */
|
nomac: /* buf can already be null-terminated. soit */
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
while (in_idf(ch)) {
|
while (in_idf(ch))
|
||||||
if (tg < maxpos) *tg++ = ch;
|
{
|
||||||
|
if (tg < maxpos)
|
||||||
|
*tg++ = ch;
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
}
|
}
|
||||||
UnGetChar();
|
UnGetChar();
|
||||||
*tg++ = '\0'; /* mark the end of the identifier */
|
*tg++ = '\0'; /* mark the end of the identifier */
|
||||||
|
|
||||||
NoExpandNext = 0;
|
NoExpandNext = 0;
|
||||||
if (UnknownIdIsZero) {
|
if (UnknownIdIsZero)
|
||||||
|
{
|
||||||
ptok->tk_val = (arith)0;
|
ptok->tk_val = (arith)0;
|
||||||
return ptok->tk_symb = INTEGER;
|
return ptok->tk_symb = INTEGER;
|
||||||
}
|
}
|
||||||
|
@ -262,52 +296,65 @@ garbage:
|
||||||
register int base = 10, vch;
|
register int base = 10, vch;
|
||||||
register arith val = 0;
|
register arith val = 0;
|
||||||
int ovfl = 0;
|
int ovfl = 0;
|
||||||
arith ubound = max_arith/(base/2);
|
arith ubound = max_arith / (base / 2);
|
||||||
|
|
||||||
/* Since the preprocessor only knows integers and has
|
/* Since the preprocessor only knows integers and has
|
||||||
* nothing to do with ellipsis we just return when the
|
* nothing to do with ellipsis we just return when the
|
||||||
* pp-number starts with a '.'
|
* pp-number starts with a '.'
|
||||||
*/
|
*/
|
||||||
if (ch == '.') {
|
if (ch == '.')
|
||||||
|
{
|
||||||
return ptok->tk_symb = ch;
|
return ptok->tk_symb = ch;
|
||||||
}
|
}
|
||||||
if (ch == '0') {
|
if (ch == '0')
|
||||||
|
{
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
if (ch == 'x' || ch == 'X') {
|
if (ch == 'x' || ch == 'X')
|
||||||
|
{
|
||||||
base = 16;
|
base = 16;
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
base = 8;
|
base = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
while ((vch = val_in_base(ch, base)) >= 0) {
|
while ((vch = val_in_base(ch, base)) >= 0)
|
||||||
if (val < 0 || val > ubound) ovfl++;
|
{
|
||||||
|
if (val < 0 || val > ubound)
|
||||||
|
ovfl++;
|
||||||
val *= base;
|
val *= base;
|
||||||
if (val < 0 && val + vch >= 0) ovfl++;
|
if (val < 0 && val + vch >= 0)
|
||||||
|
ovfl++;
|
||||||
val += vch;
|
val += vch;
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
}
|
}
|
||||||
ptok->tk_unsigned = 0;
|
ptok->tk_unsigned = 0;
|
||||||
if (ch == 'u' || ch == 'U') {
|
if (ch == 'u' || ch == 'U')
|
||||||
|
{
|
||||||
ptok->tk_unsigned = 1;
|
ptok->tk_unsigned = 1;
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
if (ch == 'l' || ch == 'L') {
|
if (ch == 'l' || ch == 'L')
|
||||||
|
{
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ch == 'l' || ch == 'L') {
|
else if (ch == 'l' || ch == 'L')
|
||||||
|
{
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
if (ch == 'u' || ch == 'U') {
|
if (ch == 'u' || ch == 'U')
|
||||||
|
{
|
||||||
ptok->tk_unsigned = 1;
|
ptok->tk_unsigned = 1;
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ovfl) {
|
if (ovfl)
|
||||||
|
{
|
||||||
warning("overflow in constant");
|
warning("overflow in constant");
|
||||||
ptok->tk_unsigned = 1;
|
ptok->tk_unsigned = 1;
|
||||||
}
|
}
|
||||||
else if (val < 0) {
|
else if (val < 0)
|
||||||
|
{
|
||||||
/* give warning??? */
|
/* give warning??? */
|
||||||
ptok->tk_unsigned = 1;
|
ptok->tk_unsigned = 1;
|
||||||
}
|
}
|
||||||
|
@ -318,8 +365,10 @@ garbage:
|
||||||
case STEOI: /* end of text on source file */
|
case STEOI: /* end of text on source file */
|
||||||
return ptok->tk_symb = EOF;
|
return ptok->tk_symb = EOF;
|
||||||
case STMSPEC:
|
case STMSPEC:
|
||||||
if (!InputLevel) goto garbage;
|
if (!InputLevel)
|
||||||
if (ch == TOKSEP) goto again;
|
goto garbage;
|
||||||
|
if (ch == TOKSEP)
|
||||||
|
goto again;
|
||||||
/* fallthrough shouldn't happen */
|
/* fallthrough shouldn't happen */
|
||||||
default: /* this cannot happen */
|
default: /* this cannot happen */
|
||||||
crash("bad class for char 0%o", ch);
|
crash("bad class for char 0%o", ch);
|
||||||
|
@ -327,8 +376,7 @@ garbage:
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void skipcomment()
|
||||||
skipcomment()
|
|
||||||
{
|
{
|
||||||
/* The last character read has been the '*' of '/_*'. The
|
/* The last character read has been the '*' of '/_*'. The
|
||||||
characters, except NL and EOI, between '/_*' and the first
|
characters, except NL and EOI, between '/_*' and the first
|
||||||
|
@ -344,11 +392,16 @@ skipcomment()
|
||||||
|
|
||||||
NoUnstack++;
|
NoUnstack++;
|
||||||
c = GetChar();
|
c = GetChar();
|
||||||
do {
|
do
|
||||||
while (c != '*') {
|
{
|
||||||
if (class(c) == STNL) {
|
while (c != '*')
|
||||||
|
{
|
||||||
|
if (class(c) == STNL)
|
||||||
|
{
|
||||||
++LineNumber;
|
++LineNumber;
|
||||||
} else if (c == EOI) {
|
}
|
||||||
|
else if (c == EOI)
|
||||||
|
{
|
||||||
NoUnstack--;
|
NoUnstack--;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -359,9 +412,7 @@ skipcomment()
|
||||||
NoUnstack--;
|
NoUnstack--;
|
||||||
}
|
}
|
||||||
|
|
||||||
arith
|
arith char_constant(nm) char* nm;
|
||||||
char_constant(nm)
|
|
||||||
char *nm;
|
|
||||||
{
|
{
|
||||||
register arith val = 0;
|
register arith val = 0;
|
||||||
register int ch;
|
register int ch;
|
||||||
|
@ -371,15 +422,18 @@ char_constant(nm)
|
||||||
if (ch == '\'')
|
if (ch == '\'')
|
||||||
error("%s constant too short", nm);
|
error("%s constant too short", nm);
|
||||||
else
|
else
|
||||||
while (ch != '\'') {
|
while (ch != '\'')
|
||||||
if (ch == '\n') {
|
{
|
||||||
|
if (ch == '\n')
|
||||||
|
{
|
||||||
error("newline in %s constant", nm);
|
error("newline in %s constant", nm);
|
||||||
LineNumber++;
|
LineNumber++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ch == '\\')
|
if (ch == '\\')
|
||||||
ch = quoted(GetChar());
|
ch = quoted(GetChar());
|
||||||
if (ch >= 128) ch -= 256;
|
if (ch >= 128)
|
||||||
|
ch -= 256;
|
||||||
if (size < sizeof(arith))
|
if (size < sizeof(arith))
|
||||||
val |= ch << (8 * size);
|
val |= ch << (8 * size);
|
||||||
size++;
|
size++;
|
||||||
|
@ -392,23 +446,24 @@ char_constant(nm)
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char* string_token(nm, stop_char) char* nm;
|
||||||
string_token(nm, stop_char)
|
|
||||||
char *nm;
|
|
||||||
{
|
{
|
||||||
register int ch;
|
register int ch;
|
||||||
register int str_size;
|
register int str_size;
|
||||||
register char *str = Malloc((unsigned) (str_size = ISTRSIZE));
|
register char* str = Malloc((unsigned)(str_size = ISTRSIZE));
|
||||||
register int pos = 0;
|
register int pos = 0;
|
||||||
|
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
while (ch != stop_char) {
|
while (ch != stop_char)
|
||||||
if (ch == '\n') {
|
{
|
||||||
|
if (ch == '\n')
|
||||||
|
{
|
||||||
error("newline in %s", nm);
|
error("newline in %s", nm);
|
||||||
LineNumber++;
|
LineNumber++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ch == EOI) {
|
if (ch == EOI)
|
||||||
|
{
|
||||||
error("end-of-file inside %s", nm);
|
error("end-of-file inside %s", nm);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -424,16 +479,16 @@ string_token(nm, stop_char)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int quoted(ch) register int ch;
|
||||||
quoted(ch)
|
|
||||||
register int ch;
|
|
||||||
{
|
{
|
||||||
/* quoted() replaces an escaped character sequence by the
|
/* quoted() replaces an escaped character sequence by the
|
||||||
character meant.
|
character meant.
|
||||||
*/
|
*/
|
||||||
/* first char after backslash already in ch */
|
/* first char after backslash already in ch */
|
||||||
if (!is_oct(ch)) { /* a quoted char */
|
if (!is_oct(ch))
|
||||||
switch (ch) {
|
{ /* a quoted char */
|
||||||
|
switch (ch)
|
||||||
|
{
|
||||||
case 'n':
|
case 'n':
|
||||||
ch = '\n';
|
ch = '\n';
|
||||||
break;
|
break;
|
||||||
|
@ -460,7 +515,8 @@ quoted(ch)
|
||||||
register int hex = 0;
|
register int hex = 0;
|
||||||
register int vch;
|
register int vch;
|
||||||
|
|
||||||
for (;;) {
|
for (;;)
|
||||||
|
{
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
if (vch = val_in_base(ch, 16), vch == -1)
|
if (vch = val_in_base(ch, 16), vch == -1)
|
||||||
break;
|
break;
|
||||||
|
@ -470,42 +526,39 @@ quoted(ch)
|
||||||
ch = hex;
|
ch = hex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { /* a quoted octal */
|
}
|
||||||
|
else
|
||||||
|
{ /* a quoted octal */
|
||||||
register int oct = 0, cnt = 0;
|
register int oct = 0, cnt = 0;
|
||||||
|
|
||||||
do {
|
do
|
||||||
oct = oct*8 + (ch-'0');
|
{
|
||||||
|
oct = oct * 8 + (ch - '0');
|
||||||
ch = GetChar();
|
ch = GetChar();
|
||||||
} while (is_oct(ch) && ++cnt < 3);
|
} while (is_oct(ch) && ++cnt < 3);
|
||||||
UnGetChar();
|
UnGetChar();
|
||||||
ch = oct;
|
ch = oct;
|
||||||
}
|
}
|
||||||
return ch&0377;
|
return ch & 0377;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int val_in_base(ch, base) register int ch;
|
||||||
int
|
|
||||||
val_in_base(ch, base)
|
|
||||||
register int ch;
|
|
||||||
{
|
{
|
||||||
switch (base) {
|
switch (base)
|
||||||
|
{
|
||||||
case 8:
|
case 8:
|
||||||
return (is_dig(ch) && ch < '9') ? ch - '0' : -1;
|
return (is_dig(ch) && ch < '9') ? ch - '0' : -1;
|
||||||
case 10:
|
case 10:
|
||||||
return is_dig(ch) ? ch - '0' : -1;
|
return is_dig(ch) ? ch - '0' : -1;
|
||||||
case 16:
|
case 16:
|
||||||
return is_dig(ch) ? ch - '0'
|
return is_dig(ch) ? ch - '0' : is_hex(ch) ? (ch - 'a' + 10) & 017 : -1;
|
||||||
: is_hex(ch) ? (ch - 'a' + 10) & 017
|
|
||||||
: -1;
|
|
||||||
default:
|
default:
|
||||||
fatal("(val_in_base) illegal base value %d", base);
|
fatal("(val_in_base) illegal base value %d", base);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetChar()
|
||||||
int
|
|
||||||
GetChar()
|
|
||||||
{
|
{
|
||||||
/* The routines GetChar and trigraph parses the trigraph
|
/* The routines GetChar and trigraph parses the trigraph
|
||||||
sequences and removes occurences of \\\n.
|
sequences and removes occurences of \\\n.
|
||||||
|
@ -520,58 +573,60 @@ again:
|
||||||
ch = trigraph();
|
ch = trigraph();
|
||||||
|
|
||||||
/* \\\n are removed from the input stream */
|
/* \\\n are removed from the input stream */
|
||||||
if (ch == '\\') {
|
if (ch == '\\')
|
||||||
|
{
|
||||||
LoadChar(ch);
|
LoadChar(ch);
|
||||||
if (ch == '\n') {
|
if (ch == '\n')
|
||||||
|
{
|
||||||
++LineNumber;
|
++LineNumber;
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
PushBack();
|
PushBack();
|
||||||
ch = '\\';
|
ch = '\\';
|
||||||
}
|
}
|
||||||
return(LexSave = ch);
|
return (LexSave = ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int trigraph()
|
||||||
int
|
|
||||||
trigraph()
|
|
||||||
{
|
{
|
||||||
register int ch;
|
register int ch;
|
||||||
|
|
||||||
LoadChar(ch);
|
LoadChar(ch);
|
||||||
if (ch == '?') {
|
if (ch == '?')
|
||||||
|
{
|
||||||
LoadChar(ch);
|
LoadChar(ch);
|
||||||
switch (ch) { /* its a trigraph */
|
switch (ch)
|
||||||
|
{ /* its a trigraph */
|
||||||
case '=':
|
case '=':
|
||||||
ch = '#';
|
ch = '#';
|
||||||
return(ch);
|
return (ch);
|
||||||
case '(':
|
case '(':
|
||||||
ch = '[';
|
ch = '[';
|
||||||
return(ch);
|
return (ch);
|
||||||
case '/':
|
case '/':
|
||||||
ch = '\\';
|
ch = '\\';
|
||||||
return(ch);
|
return (ch);
|
||||||
case ')':
|
case ')':
|
||||||
ch = ']';
|
ch = ']';
|
||||||
return(ch);
|
return (ch);
|
||||||
case '\'':
|
case '\'':
|
||||||
ch = '^';
|
ch = '^';
|
||||||
return(ch);
|
return (ch);
|
||||||
case '<':
|
case '<':
|
||||||
ch = '{';
|
ch = '{';
|
||||||
return(ch);
|
return (ch);
|
||||||
case '!':
|
case '!':
|
||||||
ch = '|';
|
ch = '|';
|
||||||
return(ch);
|
return (ch);
|
||||||
case '>':
|
case '>':
|
||||||
ch = '}';
|
ch = '}';
|
||||||
return(ch);
|
return (ch);
|
||||||
case '-':
|
case '-':
|
||||||
ch = '~';
|
ch = '~';
|
||||||
return(ch);
|
return (ch);
|
||||||
}
|
}
|
||||||
PushBack();
|
PushBack();
|
||||||
}
|
}
|
||||||
PushBack();
|
PushBack();
|
||||||
return('?');
|
return ('?');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue