static LexSP = 0;
void skipcomment();
+void skiplinecomment();
/* In PushLex() the actions are taken in order to initialise or
re-initialise the lexical scanner.
goto firstline;
}
}
- else if (ch == '/')
+ else if ((ch == '/') && !InputLevel)
{
- if ((GetChar() == '*') && !InputLevel)
- {
+ int nch = GetChar();
+ if (nch == '*')
skipcomment();
- }
+ else if (nch == '/')
+ skiplinecomment();
else
{
UnGetChar();
break;
case '/':
#ifndef NOPP
- if (nch == '*' && !InputLevel)
+ if (!InputLevel)
{
- skipcomment();
- goto again;
+ if (nch == '*')
+ {
+ skipcomment();
+ goto again;
+ }
+ else if (nch == '/')
+ {
+ skiplinecomment();
+ goto again;
+ }
}
#endif
if (nch == '=')
#endif /* LINT */
NoUnstack--;
}
+
+void skiplinecomment(void)
+{
+ /* The last character read has been the '/' of '//'. We read
+ and discard all characters up to but not including the next
+ NL. */
+
+ for (;;) {
+ int c = GetChar();
+ if ((class(c) == STNL) || (c == EOI))
+ {
+ UnGetChar();
+ break;
+ }
+ }
+}
#endif /* NOPP */
arith char_constant(nm) char* nm;
if (ch == '/')
{
ch = GetChar();
- if (ch != '*')
- UnGetChar();
- else
+ if (ch == '/')
+ {
+ skiplinecomment();
+ continue;
+ }
+ else if (ch == '*')
{
skipcomment();
continue;
}
+ else
+ UnGetChar();
}
else
UnGetChar();
c = GetChar();
continue;
}
+ else if (c == '/')
+ {
+ skiplinecomment();
+ blank++;
+ c = GetChar();
+ continue;
+ }
if (blank)
{
blank = 0;
skipcomment();
ch = GetChar();
}
+ else if (ch == '/' && !InputLevel)
+ {
+ skiplinecomment();
+ ch = GetChar();
+ }
else
{
UnGetChar();
}
else if (ch == '/')
{
- if (GetChar() == '*' && !InputLevel)
+ if (!InputLevel)
{
- skipcomment();
- continue;
+ int nch = GetChar();
+ if (nch == '*')
+ {
+ skipcomment();
+ continue;
+ }
+ else if (nch == '/')
+ {
+ skiplinecomment();
+ continue;
+ }
+ else
+ UnGetChar();
}
- else
- UnGetChar();
}
else if (ch == TOKSEP && InputLevel)
{
#define FLG_DOTSEEN 0x02 /* certainly a floating point number */
void skipcomment();
+void skiplinecomment(void);
int LLlex()
{
UnGetChar();
return ptok->tk_symb = ch;
case '/':
- if (nch == '*' && !InputLevel)
+ if (!InputLevel)
{
- skipcomment();
- goto again;
+ if (nch == '*')
+ {
+ skipcomment();
+ goto again;
+ }
+ else if (nch == '/')
+ {
+ skiplinecomment();
+ goto again;
+ }
}
else if (nch == '=')
return ptok->tk_symb = DIVAB;
NoUnstack--;
}
+void skiplinecomment(void)
+{
+ /* The last character read has been the '/' of '//'. We read
+ and discard all characters up to but not including the next
+ NL. */
+
+ for (;;) {
+ int c = GetChar();
+ if ((class(c) == STNL) || (c == EOI))
+ {
+ UnGetChar();
+ break;
+ }
+ }
+}
+
arith char_constant(nm) char* nm;
{
register arith val = 0;
}
if (ch == '/')
{
- if (ch != '*')
- UnGetChar();
- else
+ if (ch == '*')
{
skipcomment();
continue;
}
+ else if (ch == '/')
+ {
+ skiplinecomment();
+ continue;
+ }
+ else
+ UnGetChar();
}
else
UnGetChar();
c = GetChar();
continue;
}
+ else if (c == '/')
+ {
+ skiplinecomment();
+ blank++;
+ c = GetChar();
+ continue;
+ }
if (blank)
{
blank = 0;
}
else if (c == '/')
{
- if ((c = GetChar()) != '*' || InputLevel)
+ if (!InputLevel)
{
+ c = GetChar();
+ if (c == '*')
+ {
+ skipcomment();
+ continue;
+ }
+ else if (c == '/')
+ {
+ skiplinecomment();
+ continue;
+ }
*c_ptr++ = '/';
}
- else
- {
- skipcomment();
- continue;
- }
}
*c_ptr++ = c;
c = GetChar();
c = GetChar();
continue;
}
+ else if (c == '/')
+ {
+ skiplinecomment();
+ c = GetChar();
+ continue;
+ }
UnGetChar();
c = '/';
}
c = GetChar();
continue;
}
+ else if (c == '/')
+ {
+ skiplinecomment();
+ c = GetChar();
+ continue;
+ }
echo('/');
continue;
}
skipcomment();
ch = GetChar();
}
+ else if (ch == '/' && !InputLevel)
+ {
+ skiplinecomment();
+ ch = GetChar();
+ }
else
{
UnGetChar();
}
else if (ch == '/')
{
- if (GetChar() == '*' && !InputLevel)
+ if (!InputLevel)
{
- skipcomment();
- continue;
+ int nch = GetChar();
+ if (nch == '*')
+ {
+ skipcomment();
+ continue;
+ }
+ else if (nch == '/')
+ {
+ skiplinecomment();
+ continue;
+ }
+ else
+ UnGetChar();
}
- else
- UnGetChar();
}
else if (ch == TOKSEP && InputLevel)
{