flush
[m6w6/ext-psi] / idl / lexer.h
1 /* \aThis file was automatically generated. Do not edit! */
2 #undef INTERFACE
3 #define PSI_T_COMMENT 1
4 #define PSI_T_NULL 27
5 #define PSI_T_MIXED 42
6 #define PSI_T_VOID 10
7 #define PSI_T_BOOLVAL 35
8 #define PSI_T_BOOL 43
9 #define PSI_T_INTVAL 33
10 #define PSI_T_INT 11
11 #define PSI_T_FLOATVAL 34
12 #define PSI_T_FLOAT 12
13 #define PSI_T_FUNCTION 24
14 #define PSI_T_DOUBLE 13
15 #define PSI_T_SET 36
16 #define PSI_T_SINT16 16
17 #define PSI_T_SINT32 18
18 #define PSI_T_SINT64 20
19 #define PSI_T_SINT8 14
20 #define PSI_T_STRING 44
21 #define PSI_T_STRVAL 32
22 #define PSI_T_UINT16 17
23 #define PSI_T_UINT32 19
24 #define PSI_T_UINT64 21
25 #define PSI_T_UINT8 15
26 #define PSI_T_ARRAY 45
27 #define PSI_T_TO_BOOL 40
28 #define PSI_T_TO_FLOAT 39
29 #define PSI_T_TO_INT 38
30 #define PSI_T_TO_STRING 37
31 #define PSI_T_TYPEDEF 5
32 #define PSI_T_LET 31
33 #define PSI_T_LIB 2
34 #define PSI_T_RET 41
35 #define PSI_T_NSNAME 25
36 #define PSI_T_QUOTED_STRING 3
37 #define PSI_T_DIGIT 46
38 #define PSI_T_NAME 6
39 #define PSI_T_REFERENCE 29
40 #define PSI_T_POINTER 50
41 #define PSI_T_DOLLAR 28
42 #define PSI_T_EQUALS 30
43 #define PSI_T_DOT 47
44 #define PSI_T_RBRACE 23
45 #define PSI_T_LBRACE 22
46 #define PSI_T_COLON 26
47 #define PSI_T_COMMA 9
48 #define PSI_T_EOS 4
49 #define PSI_T_RPAREN 8
50 #define PSI_T_LPAREN 7
51 typedef int token_t;
52 typedef struct PSI_Lexer PSI_Lexer;
53 typedef struct decl_typedefs decl_typedefs;
54 typedef struct decl_typedef decl_typedef;
55 typedef struct decl_type decl_type;
56 struct decl_type {
57 char *name;
58 token_t type;
59 struct decl_type *real;
60 };
61 struct decl_typedef {
62 char *alias;
63 decl_type *type;
64 };
65 struct decl_typedefs {
66 size_t count;
67 decl_typedef **list;
68 };
69 typedef struct decls decls;
70 typedef struct decl decl;
71 typedef struct decl_abi decl_abi;
72 struct decl_abi {
73 char *convention;
74 };
75 typedef struct decl_arg decl_arg;
76 typedef struct decl_var decl_var;
77 struct decl_var {
78 char *name;
79 unsigned pointer_level;
80 };
81 struct decl_arg {
82 decl_type *type;
83 decl_var *var;
84 };
85 typedef struct decl_args decl_args;
86 struct decl_args {
87 decl_arg **args;
88 size_t count;
89 };
90 struct decl {
91 decl_abi *abi;
92 decl_arg *func;
93 decl_args *args;
94 void *dlptr;
95 };
96 struct decls {
97 size_t count;
98 decl **list;
99 };
100 typedef struct impls impls;
101 typedef struct impl impl;
102 typedef struct impl_func impl_func;
103 typedef struct impl_args impl_args;
104 typedef struct impl_arg impl_arg;
105 typedef struct impl_type impl_type;
106 struct impl_type {
107 char *name;
108 token_t type;
109 };
110 typedef struct impl_var impl_var;
111 struct impl_var {
112 char *name;
113 unsigned reference:1;
114 };
115 typedef struct impl_def_val impl_def_val;
116 struct impl_def_val {
117 token_t type;
118 union {
119 int64_t digits;
120 double decimals;
121 } v;
122 unsigned is_null:1;
123 };
124 struct impl_arg {
125 impl_type *type;
126 impl_var *var;
127 impl_def_val *def;
128 };
129 struct impl_args {
130 impl_arg **args;
131 size_t count;
132 };
133 struct impl_func {
134 char *name;
135 impl_args *args;
136 impl_type *return_type;
137 };
138 typedef struct impl_stmts impl_stmts;
139 typedef struct impl_stmt impl_stmt;
140 typedef struct let_stmt let_stmt;
141 typedef struct let_value let_value;
142 typedef struct let_func let_func;
143 struct let_func {
144 token_t type;
145 char *name;
146 };
147 struct let_value {
148 let_func *func;
149 impl_var *var;
150 unsigned null_pointer_ref:1;
151 };
152 struct let_stmt {
153 decl_var *var;
154 let_value *val;
155 };
156 typedef struct set_stmt set_stmt;
157 typedef struct set_value set_value;
158 typedef struct set_func set_func;
159 struct set_func {
160 token_t type;
161 char *name;
162 };
163 typedef struct decl_vars decl_vars;
164 struct decl_vars {
165 decl_var **vars;
166 size_t count;
167 };
168 struct set_value {
169 set_func *func;
170 decl_vars *vars;
171 };
172 struct set_stmt {
173 impl_var *var;
174 set_value *val;
175 };
176 typedef struct ret_stmt ret_stmt;
177 struct ret_stmt {
178 set_func *func;
179 decl_var *decl;
180 };
181 struct impl_stmt {
182 token_t type;
183 union {
184 let_stmt *let;
185 set_stmt *set;
186 ret_stmt *ret;
187 void *ptr;
188 } s;
189 };
190 struct impl_stmts {
191 impl_stmt **stmts;
192 size_t count;
193 };
194 struct impl {
195 impl_func *func;
196 impl_stmts *stmts;
197 };
198 struct impls {
199 size_t count;
200 impl **list;
201 };
202 #define BSIZE 256
203 struct PSI_Lexer {
204 decl_typedefs *defs;
205 decls *decls;
206 impls *impls;
207 char *lib;
208 char *fn;
209 FILE *fp;
210 size_t line;
211 char *cur, *tok, *lim, *eof, *ctx, *mrk, buf[BSIZE];
212 };
213 token_t PSI_LexerScan(PSI_Lexer *L);
214 PSI_Lexer *PSI_LexerInit(PSI_Lexer *L,const char *filename);
215 void PSI_LexerFree(PSI_Lexer **L);
216 void PSI_LexerDtor(PSI_Lexer *L);
217 size_t PSI_LexerFill(PSI_Lexer *L,size_t n);
218 typedef struct PSI_Token PSI_Token;
219 struct PSI_Token {
220 token_t type;
221 unsigned line;
222 size_t size;
223 char text[1];
224 };
225 PSI_Token *PSI_TokenAlloc(PSI_Lexer *L,token_t t);
226 #define YYMAXFILL 10
227 #define INTERFACE 0