int idfsize = IDFSIZE;
int ForeignFlag;
-static int eofseen;
-
STATIC
SkipComment()
{
}
break;
}
- if (ch == EOI) {
- eofseen = 1;
- return '\n';
- }
return ch;
}
* Do not skip newlines
*/
ch = getch();
- if (class(ch) == STNL) {
+ if (class(ch) == STNL || class(ch) == STEOI) {
LineNumber++;
error(s_error);
return;
i = i*10 + (ch - '0');
ch = getch();
}
- while (ch != '"' && class(ch) != STNL) ch = getch();
+ while (ch != '"' && class(ch) != STNL && class(ch) != STEOI)
+ ch = getch();
if (ch == '"') {
c = buf;
do {
*c++ = ch = getch();
- if (class(ch) == STNL) {
+ if (class(ch) == STNL || class(ch) == STEOI) {
LineNumber++;
error(s_error);
return;
*--c = '\0';
do {
ch = getch();
- } while (class(ch) != STNL);
+ } while (class(ch) != STNL && class(ch) != STEOI);
/*
* Remember the file name
*/
- if (!eofseen && strcmp(FileName,buf)) {
+ if (class(ch) == STNL && strcmp(FileName,buf)) {
FileName = Salloc(buf,(unsigned) strlen(buf) + 1);
}
}
- if (eofseen) {
+ if (class(ch) == STEOI) {
error(s_error);
return;
}
return tk->tk_symb;
}
-again1:
- if (eofseen) {
- eofseen = 0;
- ch = EOI;
- }
- else {
again:
- LoadChar(ch);
- if ((ch & 0200) && ch != EOI) {
- error("non-ascii '\\%03o' read", ch & 0377);
- goto again;
- }
- }
-
+ ch = getch();
tk->tk_lineno = LineNumber;
switch (class(ch)) {
case STNL:
LineNumber++;
CheckForLineDirective();
- goto again1;
+ goto again;
case STSKIP:
goto again;
SkipComment();
goto again;
}
- else if (nch == EOI) eofseen = 1;
- else PushBack();
+ PushBack();
}
if (ch == '&') return tk->tk_symb = AND;
if (ch == '~') return tk->tk_symb = NOT;
default :
crash("(LLlex, STCOMP)");
}
- if (nch == EOI) eofseen = 1;
- else PushBack();
+ PushBack();
return tk->tk_symb = ch;
case STIDF:
LoadChar(ch);
} while(in_idf(ch));
- if (ch == EOI) eofseen = 1;
- else PushBack();
+ PushBack();
*tag++ = '\0';
tk->TOK_IDF = id = findidf(idfbuf);
else if (ch == '.') state = OptReal;
else {
state = End;
- if (ch == 'H') ;
- else if (ch == EOI) eofseen = 1;
- else PushBack();
+ if (ch != 'H') PushBack();
}
break;
state = End;
if (ch != 'H') {
lexerror("H expected after hex number");
- if (ch == EOI) eofseen = 1;
- else PushBack();
+ PushBack();
}
break;
state = Hex;
break;
}
- if (ch == EOI) eofseen = 1;
- else PushBack();
+ PushBack();
/* Fall through */
case End:
}
noscale:
- if (ch == EOI) eofseen = 1;
- else PushBack();
+ PushBack();
return tk->tk_symb = REAL;
@pr Makefile $(GF) $(HFILES) $(CSRC)
clean:
- rm -f $(OBJ) $(GENFILES) LLfiles Cfiles tab LL.output m2mm
+ rm -f $(OBJ) $(GENFILES) LLfiles Cfiles LL.output m2mm
lint: Cfiles
lint $(INCLUDES) $(LINTFLAGS) $(SRC) \
symbol2str.c: tokenname.c make.tokcase
make.tokcase <tokenname.c >symbol2str.c
-char.c: char.tab tab
- tab -fchar.tab >char.c
-
-tab:
- $(CC) tab.c -o tab
+char.c: char.tab
+ $(EMHOME)/bin/tabgen -fchar.tab >char.c
depend: Cfiles
sed '/^#AUTOAUTO/,$$d' Makefile > Makefile.new