1 /* $Id$ */
2 /* Copyright (c) 2008-2014 Pierre Pronchery <khorben@defora.org> */
3 /* This file is part of DeforaOS System libSystem */
4 /* This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, version 3 of the License.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program.  If not, see <http://www.gnu.org/licenses/>. */
15 
16 
17 
18 #ifndef LIBSYSTEM_SYSTEM_TOKEN_H
19 # define LIBSYSTEM_SYSTEM_TOKEN_H
20 
21 # include "string.h"
22 
23 
24 /* Token */
25 /* types */
26 typedef struct _Token Token;
27 typedef unsigned int TokenCode;
28 # define TC_NULL 0
29 typedef TokenCode * TokenSet;
30 
31 
32 /* functions */
33 void token_delete(Token * token);
34 
35 
36 /* accessors */
37 String const * token_get_filename(Token * token);
38 int token_set_filename(Token * token, String const * filename);
39 
40 unsigned int token_get_col(Token * token);
41 void token_set_col(Token * token, unsigned int col);
42 
43 unsigned int token_get_line(Token * token);
44 void token_set_line(Token * token, unsigned int line);
45 
46 TokenCode token_get_code(Token * token);
47 void token_set_code(Token * token, int code);
48 
49 String const * token_get_string(Token * token);
50 int token_set_string(Token * token, String const * string);
51 
52 void * token_get_data(Token * token);
53 void token_set_data(Token * token, void * data);
54 
55 
56 /* useful */
57 int token_in_set(Token * token, TokenSet set);
58 
59 #endif /* !LIBSYSTEM_SYSTEM_TOKEN_H */
60