1
/* Copyright (c) 2002 Hewlett-Packard under GPL version 2 or later */
13
while (nest > 0 && (c = ncss_Getchar()) != EOF)
27
if (nest > 0 /* && c == EOF */ )
30
fileerror("not enough }'s");
42
while (nest > 0 && (c = ncss_Getchar()) != EOF)
56
if (nest > 0 /* && c == EOF */ )
59
fileerror("not enough )'s");
71
while ((c = ncss_Getchar()) != EOF && ISSPACE(c))
79
getsimpleident(char *buf)
102
identify(const char *ident)
109
if (STREQUAL(ident, "if"))
113
if (STREQUAL(ident, "while"))
117
if (STREQUAL(ident, "case"))
119
else if (STREQUAL(ident, "class"))
121
else if (STREQUAL(ident, "const"))
125
if (STREQUAL(ident, "switch"))
127
else if (STREQUAL(ident, "struct"))
131
if (STREQUAL(ident, "for"))
135
if (STREQUAL(ident, "union"))
139
if (STREQUAL(ident, "operator"))
148
ungettoken(int c, char *s)
161
gettoken(char *buf, int *line, int *nLine)
163
* Callers depend on the fact that gettoken() doesn't modify buf except
164
* when T_IDENT is parsed.
169
char *startbuf = buf;
171
/* skip whitespace */
183
ncss_Ungetc(getsimpleident(buf));
184
c = identify(buf - 1);
191
gettoken2(char *buf, int *line, int *nLine)
193
* This one can additionally return T_ASSIGN and T_LOGICAL. But note
194
* that the caller isn't given enough data to know what specifically
200
char *startbuf = buf;
202
/* skip whitespace */
228
case '+': /* +=, ++ */
229
case '-': /* -=, -- */
231
if (c1 == '=' || c1 == c)
241
case '&': /* &=, && */
242
case '|': /* |=, || */
283
ncss_Ungetc(getsimpleident(buf));
284
c = identify(buf - 1);
291
operatorident(char *s, int c)
293
* We're in an operator-overloaded C++ identifier. This isn't
294
* perfect but we read until either ( or ; to guess the identifier's
295
* name. In this pass we also replace whitespace with _ for printing.
302
ncss_Ungetc(skipws());
305
else if (c == '(' || c == ';')