include/libtu/tokenizer.h

Fri, 27 Oct 2000 15:17:27 +0200

author
tuomov
date
Fri, 27 Oct 2000 15:17:27 +0200
changeset 25
9d41e3611050
parent 21
6d4282804e73
child 35
5a71d53d0228
permissions
-rw-r--r--

trunk: changeset 28
Added errmsg_* functions alike warn_* -- asprintf and vasprintf
required now.

5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
1 /*
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
2 * libtu/tokenizer.h
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
3 *
9
55e7f2ff6021 trunk: changeset 12
tuomov
parents: 8
diff changeset
4 * Copyright (c) Tuomo Valkonen 1999-2000.
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
5 * See the included file LICENSE for details.
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
6 */
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
7
8
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
8 #ifndef LIBTU_TOKENIZER_H
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
9 #define LIBTU_TOKENIZER_H
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
10
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
11 #include <stdio.h>
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
12 #include "types.h"
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
13
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
14
18
afabe75987eb trunk: changeset 21
tuomov
parents: 14
diff changeset
15 #define TOK_SET_BOOL(TOK, VAL) {(TOK)->type=TOK_BOOL; (TOK)->u.bval=VAL;}
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
16 #define TOK_SET_LONG(TOK, VAL) {(TOK)->type=TOK_LONG; (TOK)->u.lval=VAL;}
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
17 #define TOK_SET_DOUBLE(TOK, VAL) {(TOK)->type=TOK_DOUBLE; (TOK)->u.dval=VAL;}
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
18 #define TOK_SET_CHAR(TOK, VAL) {(TOK)->type=TOK_CHAR; (TOK)->u.cval=VAL;}
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
19 #define TOK_SET_STRING(TOK, VAL) {(TOK)->type=TOK_STRING; (TOK)->u.sval=VAL;}
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
20 #define TOK_SET_IDENT(TOK, VAL) {(TOK)->type=TOK_IDENT; (TOK)->u.sval=VAL;}
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
21 #define TOK_SET_COMMENT(TOK, VAL) {(TOK)->type=TOK_COMMENT; (TOK)->u.sval=VAL;}
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
22 #define TOK_SET_OP(TOK, VAL) {(TOK)->type=TOK_OP; (TOK)->u.opval=VAL;}
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
23
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
24 #define TOK_TYPE(TOK) ((TOK)->type)
18
afabe75987eb trunk: changeset 21
tuomov
parents: 14
diff changeset
25 #define TOK_BOOL_VAL(TOK) ((TOK)->u.bval)
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
26 #define TOK_LONG_VAL(TOK) ((TOK)->u.lval)
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
27 #define TOK_DOUBLE_VAL(TOK) ((TOK)->u.dval)
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
28 #define TOK_CHAR_VAL(TOK) ((TOK)->u.cval)
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
29 #define TOK_STRING_VAL(TOK) ((TOK)->u.sval)
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
30 #define TOK_IDENT_VAL(TOK) ((TOK)->u.sval)
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
31 #define TOK_COMMENT_VAL(TOK) ((TOK)->u.sval)
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
32 #define TOK_OP_VAL(TOK) ((TOK)->u.opval)
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
33
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
34 #define TOK_IS_INVALID(TOK) ((TOK)->type==TOK_INVALID)
18
afabe75987eb trunk: changeset 21
tuomov
parents: 14
diff changeset
35 #define TOK_IS_BOOL(TOK) ((TOK)->type==TOK_BOOL)
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
36 #define TOK_IS_LONG(TOK) ((TOK)->type==TOK_LONG)
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
37 #define TOK_IS_DOUBLE(TOK) ((TOK)->type==TOK_DOUBLE)
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
38 #define TOK_IS_CHAR(TOK) ((TOK)->type==TOK_CHAR)
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
39 #define TOK_IS_STRING(TOK) ((TOK)->type==TOK_STRING)
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
40 #define TOK_IS_IDENT(TOK) ((TOK)->type==TOK_IDENT)
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
41 #define TOK_IS_COMMENT(TOK) ((TOK)->type==TOK_COMMENT)
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
42 #define TOK_IS_OP(TOK) ((TOK)->type==TOK_OP)
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
43
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
44 #define TOK_OP_IS(TOK, OP) ((TOK)->type==TOK_OP && (TOK)->u.opval==(OP))
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
45
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
46 #define TOK_TAKE_STRING_VAL(TOK) ((TOK)->type=TOK_INVALID, (TOK)->u.sval)
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
47 #define TOK_TAKE_IDENT_VAL(TOK) ((TOK)->type=TOK_INVALID, (TOK)->u.sval)
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
48 #define TOK_TAKE_COMMENT_VAL(TOK) ((TOK)->type=TOK_INVALID, (TOK)->u.sval)
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
49
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
50
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
51 enum{
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
52 TOK_INVALID=0,
20
3f11f764772a trunk: changeset 23
tuomov
parents: 18
diff changeset
53 TOK_LONG='l',
3f11f764772a trunk: changeset 23
tuomov
parents: 18
diff changeset
54 TOK_DOUBLE='d',
3f11f764772a trunk: changeset 23
tuomov
parents: 18
diff changeset
55 TOK_CHAR='c',
3f11f764772a trunk: changeset 23
tuomov
parents: 18
diff changeset
56 TOK_STRING='s',
3f11f764772a trunk: changeset 23
tuomov
parents: 18
diff changeset
57 TOK_IDENT='i',
3f11f764772a trunk: changeset 23
tuomov
parents: 18
diff changeset
58 TOK_BOOL='b',
3f11f764772a trunk: changeset 23
tuomov
parents: 18
diff changeset
59 TOK_COMMENT='#',
3f11f764772a trunk: changeset 23
tuomov
parents: 18
diff changeset
60 TOK_OP='+'
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
61 };
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
62
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
63
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
64 enum{
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
65 #define OP2(X,Y) ((X)|((Y)<<8))
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
66 #define OP3(X,Y,Z) ((X)|((Y)<<8)|((Z)<<16))
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
67
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
68 OP_L_PAR= '(', OP_R_PAR= ')', OP_L_BRK= '[', OP_R_BRK= ']',
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
69 OP_L_BRC= '{', OP_R_BRC= '}', OP_COMMA= ',', OP_SCOLON= ';',
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
70
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
71 OP_PLUS= '+', OP_MINUS= '-', OP_MUL= '*', OP_DIV= '/',
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
72 OP_MOD= '%', OP_POW= '^', OP_OR= '|', OP_AND= '&',
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
73 /*OP_NOT= '~',*/ OP_NOT= '!', OP_ASGN= '=', OP_LT= '<',
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
74 OP_GT= '>', OP_DOT= '.', OP_COLON= ':', OP_QMARK= '?',
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
75 OP_AT= '@',
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
76 OP_NEXTLINE='\n',OP_EOF= -1,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
77
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
78 OP_INC= OP2('+','+'), OP_DEC= OP2('-','-'),
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
79 OP_LSHIFT= OP2('<','<'), OP_RSHIFT= OP2('>','>'),
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
80 OP_AS_INC= OP2('+','='), OP_AS_DEC= OP2('-','='),
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
81 OP_AS_MUL= OP2('*','='), OP_AS_DIV= OP2('/','='),
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
82 OP_AS_MOD= OP2('%','='), OP_AS_POW= OP2('^','='),
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
83
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
84 /* AS_OR= OP2('|','='), AS_AND= OP2('&','='), */
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
85 OP_EQ= OP2('=','='), OP_NE= OP2('!','='),
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
86 OP_LE= OP2('<','='), OP_GE= OP2('>','=')
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
87
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
88 /* L_AND= OP2('&','&'), L_OR= OP2('|','|'),
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
89 L_XOR= OP2('^','^'), */
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
90
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
91 /* AsLShift= OP3('<','<','='),
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
92 AsRShift= OP3('>','>','='), */
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
93
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
94 #undef OP2
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
95 #undef OP3
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
96 };
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
97
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
98
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
99 typedef struct{
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
100 int type;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
101 int line;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
102 union{
18
afabe75987eb trunk: changeset 21
tuomov
parents: 14
diff changeset
103 bool bval;
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
104 long lval;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
105 double dval;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
106 char cval;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
107 char *sval;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
108 int opval;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
109 } u;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
110 } Token;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
111
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
112 #define TOK_INIT {0, 0, {0}}
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
113
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
114
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
115 extern void tok_free(Token*tok);
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
116 extern void tok_init(Token*tok);
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
117
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
118
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
119 /* */
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
120
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
121
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
122 enum{
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
123 TOKZ_IGNORE_NEXTLINE=0x1,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
124 TOKZ_READ_COMMENTS=0x2,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
125 TOKZ_PARSER_INDENT_MODE=0x04,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
126 TOKZ_ERROR_TOLERANT=0x8
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
127 };
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
128
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
129
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
130 enum{
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
131 E_TOKZ_UNEXPECTED_EOF=1,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
132 E_TOKZ_UNEXPECTED_EOL,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
133 E_TOKZ_EOL_EXPECTED,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
134 E_TOKZ_INVALID_CHAR,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
135 E_TOKZ_TOOBIG,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
136 E_TOKZ_NUMFMT,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
137 E_TOKZ_NUM_JUNK,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
138 E_TOKZ_NOTINT,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
139 E_TOKZ_RANGE,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
140 E_TOKZ_MULTICHAR,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
141
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
142 E_TOKZ_TOKEN_LIMIT,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
143 E_TOKZ_UNKNOWN_OPTION,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
144 E_TOKZ_SYNTAX,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
145 E_TOKZ_INVALID_ARGUMENT,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
146 E_TOKZ_EOS_EXPECTED,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
147 E_TOKZ_TOO_FEW_ARGS,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
148 E_TOKZ_TOO_MANY_ARGS,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
149 E_TOKZ_MAX_NEST,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
150 E_TOKZ_IDENTIFIER_EXPECTED,
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
151
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
152 E_TOKZ_LBRACE_EXPECTED
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
153 };
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
154
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
155
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
156 struct _ConfOpt;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
157
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
158 typedef struct _Tokenizer_FInfo{
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
159 FILE *file;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
160 char *name;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
161 int line;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
162 int ungetc;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
163 Token ungettok;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
164 } Tokenizer_FInfo;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
165
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
166 typedef struct _Tokenizer{
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
167 FILE *file;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
168 char *name;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
169 int line;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
170 int ungetc;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
171 Token ungettok;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
172
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
173 int flags;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
174 const struct _ConfOpt **optstack;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
175 int nest_lvl;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
176 void *user_data;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
177
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
178 int filestack_n;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
179 Tokenizer_FInfo *filestack;
14
91f0c87b62a7 trunk: changeset 17
tuomov
parents: 9
diff changeset
180
91f0c87b62a7 trunk: changeset 17
tuomov
parents: 9
diff changeset
181 char **includepaths;
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
182 } Tokenizer;
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
183
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
184
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
185 extern Tokenizer *tokz_open(const char *fname);
14
91f0c87b62a7 trunk: changeset 17
tuomov
parents: 9
diff changeset
186 extern Tokenizer *tokz_open_file(FILE *file, const char *fname);
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
187 extern void tokz_close(Tokenizer *tokz);
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
188 extern bool tokz_get_token(Tokenizer *tokz, Token *tok);
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
189 extern void tokz_unget_token(Tokenizer *tokz, Token *tok);
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
190 extern void tokz_warn_error(const Tokenizer *tokz, int line, int e);
21
6d4282804e73 trunk: changeset 24
tuomov
parents: 20
diff changeset
191 extern void tokz_warn(const Tokenizer *tokz, int line, const char *fmt, ...);
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
192
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
193 extern bool tokz_pushf(Tokenizer *tokz, const char *fname);
14
91f0c87b62a7 trunk: changeset 17
tuomov
parents: 9
diff changeset
194 extern bool tokz_pushf_file(Tokenizer *tokz, FILE *file, const char *fname);
5
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
195 extern bool tokz_popf(Tokenizer *tokz);
f878a9ffa3e0 trunk: changeset 8
tuomov
parents:
diff changeset
196
14
91f0c87b62a7 trunk: changeset 17
tuomov
parents: 9
diff changeset
197 extern void tokz_set_includepaths(Tokenizer *tokz, char **paths);
91f0c87b62a7 trunk: changeset 17
tuomov
parents: 9
diff changeset
198
8
c1994196683f trunk: changeset 11
tuomov
parents: 5
diff changeset
199 #endif /* LIBTU_TOKENIZER_H */

mercurial