/* */
1 /*
2 * Copyright (c) 1998, 1999, 2000, 2003
3 * Tama Communications Corporation
4 *
5 * This file is part of GNU GLOBAL.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef _TOKEN_H_
22 #define _TOKEN_H_
23
24 #include "gparam.h"
25 #include "strbuf.h"
26
27 #define SYMBOL 0
28
29 extern const char *sp, *cp, *lp;
30 extern int lineno;
31 extern int crflag;
32 extern int cmode;
33 extern int cppmode;
34 extern int ymode;
35 extern char token[MAXTOKEN];
36 extern char curfile[MAXPATHLEN];
37 extern int continued_line;
38
39 #define nextchar() \
40 (cp == NULL ? \
41 ((sp = cp = strbuf_fgets(ib, ip, STRBUF_NOCRLF)) == NULL ? \
42 EOF : \
43 (lineno++, *cp == 0 ? \
44 (lp = cp, cp = NULL, continued_line = 0, '\n') : \
45 (unsigned char)*cp++)) : \
46 (*cp == 0 ? \
47 (lp = cp, cp = NULL, continued_line = 0, '\n') : \
48 (unsigned char)*cp++))
49 #define atfirst (sp && sp == (cp ? cp - 1 : lp))
50
51 int opentoken(const char *);
52 void closetoken(void);
53 int nexttoken(const char *, int (*)(const char *, int));
54 void pushbacktoken(void);
55 int peekc(int);
56 void throwaway_nextchar(void);
57 int atfirst_exceptspace(void);
58
59 #endif /* ! _TOKEN_H_ */
/* */