wow64: In wow64_NtSetInformationToken forward TokenIntegrityLevel.
[wine.git] / dlls / vbscript / parse.h
blob64c3dee2a69c5696d7284d40500fe7b65b657b08
1 /*
2 * Copyright 2011 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 typedef enum {
20 EXPR_ADD,
21 EXPR_AND,
22 EXPR_BOOL,
23 EXPR_BRACKETS,
24 EXPR_CALL,
25 EXPR_CONCAT,
26 EXPR_DATE,
27 EXPR_DIV,
28 EXPR_DOT,
29 EXPR_DOUBLE,
30 EXPR_EMPTY,
31 EXPR_EQUAL,
32 EXPR_EQV,
33 EXPR_EXP,
34 EXPR_GT,
35 EXPR_GTEQ,
36 EXPR_IDIV,
37 EXPR_IMP,
38 EXPR_INT,
39 EXPR_IS,
40 EXPR_LT,
41 EXPR_LTEQ,
42 EXPR_ME,
43 EXPR_MEMBER,
44 EXPR_MOD,
45 EXPR_MUL,
46 EXPR_NEG,
47 EXPR_NEQUAL,
48 EXPR_NEW,
49 EXPR_NOARG, /* not a real expression */
50 EXPR_NOT,
51 EXPR_NOTHING,
52 EXPR_NULL,
53 EXPR_OR,
54 EXPR_STRING,
55 EXPR_SUB,
56 EXPR_XOR
57 } expression_type_t;
59 typedef struct _expression_t {
60 expression_type_t type;
61 struct _expression_t *next;
62 } expression_t;
64 typedef struct {
65 expression_t expr;
66 VARIANT_BOOL value;
67 } bool_expression_t;
69 typedef struct {
70 expression_t expr;
71 LONG value;
72 } int_expression_t;
74 typedef struct {
75 expression_t expr;
76 DATE value;
77 } date_expression_t;
79 typedef struct {
80 expression_t expr;
81 double value;
82 } double_expression_t;
84 typedef struct {
85 expression_t expr;
86 const WCHAR *value;
87 } string_expression_t;
89 typedef struct {
90 expression_t expr;
91 expression_t *subexpr;
92 } unary_expression_t;
94 typedef struct {
95 expression_t expr;
96 expression_t *left;
97 expression_t *right;
98 } binary_expression_t;
100 typedef struct {
101 expression_t expr;
102 expression_t *obj_expr;
103 const WCHAR *identifier;
104 } member_expression_t;
106 typedef struct {
107 expression_t expr;
108 expression_t *call_expr;
109 expression_t *args;
110 } call_expression_t;
112 typedef enum {
113 STAT_ASSIGN,
114 STAT_CALL,
115 STAT_CONST,
116 STAT_DIM,
117 STAT_DOUNTIL,
118 STAT_DOWHILE,
119 STAT_EXITDO,
120 STAT_EXITFOR,
121 STAT_EXITFUNC,
122 STAT_EXITPROP,
123 STAT_EXITSUB,
124 STAT_FOREACH,
125 STAT_FORTO,
126 STAT_FUNC,
127 STAT_IF,
128 STAT_ONERROR,
129 STAT_REDIM,
130 STAT_SELECT,
131 STAT_SET,
132 STAT_STOP,
133 STAT_UNTIL,
134 STAT_WHILE,
135 STAT_WHILELOOP,
136 STAT_WITH,
137 STAT_RETVAL
138 } statement_type_t;
140 typedef struct _statement_t {
141 statement_type_t type;
142 unsigned loc;
143 struct _statement_t *next;
144 } statement_t;
146 typedef struct {
147 statement_t stat;
148 call_expression_t *expr;
149 } call_statement_t;
151 typedef struct {
152 statement_t stat;
153 expression_t *left_expr;
154 expression_t *value_expr;
155 } assign_statement_t;
157 typedef struct _dim_list_t {
158 unsigned val;
159 struct _dim_list_t *next;
160 } dim_list_t;
162 typedef struct _dim_decl_t {
163 const WCHAR *name;
164 BOOL is_array;
165 BOOL is_public; /* Used only for class members. */
166 dim_list_t *dims;
167 struct _dim_decl_t *next;
168 } dim_decl_t;
170 typedef struct _dim_statement_t {
171 statement_t stat;
172 dim_decl_t *dim_decls;
173 } dim_statement_t;
175 typedef struct _redim_decl_t {
176 const WCHAR *identifier;
177 expression_t *dims;
178 struct _redim_decl_t *next;
179 } redim_decl_t;
181 typedef struct {
182 statement_t stat;
183 BOOL preserve;
184 redim_decl_t *redim_decls;
185 } redim_statement_t;
187 typedef struct _arg_decl_t {
188 const WCHAR *name;
189 BOOL by_ref;
190 struct _arg_decl_t *next;
191 } arg_decl_t;
193 typedef struct _function_decl_t {
194 const WCHAR *name;
195 function_type_t type;
196 BOOL is_public;
197 BOOL is_default;
198 arg_decl_t *args;
199 statement_t *body;
200 struct _function_decl_t *next;
201 struct _function_decl_t *next_prop_func;
202 } function_decl_t;
204 typedef struct {
205 statement_t stat;
206 function_decl_t *func_decl;
207 } function_statement_t;
209 typedef struct _class_decl_t {
210 const WCHAR *name;
211 function_decl_t *funcs;
212 dim_decl_t *props;
213 struct _class_decl_t *next;
214 } class_decl_t;
216 typedef struct _elseif_decl_t {
217 expression_t *expr;
218 statement_t *stat;
219 unsigned loc;
220 struct _elseif_decl_t *next;
221 } elseif_decl_t;
223 typedef struct {
224 statement_t stat;
225 expression_t *expr;
226 statement_t *if_stat;
227 elseif_decl_t *elseifs;
228 statement_t *else_stat;
229 } if_statement_t;
231 typedef struct {
232 statement_t stat;
233 expression_t *expr;
234 statement_t *body;
235 } while_statement_t;
237 typedef struct {
238 statement_t stat;
239 const WCHAR *identifier;
240 expression_t *from_expr;
241 expression_t *to_expr;
242 expression_t *step_expr;
243 statement_t *body;
244 } forto_statement_t;
246 typedef struct {
247 statement_t stat;
248 const WCHAR *identifier;
249 expression_t *group_expr;
250 statement_t *body;
251 } foreach_statement_t;
253 typedef struct {
254 statement_t stat;
255 BOOL resume_next;
256 } onerror_statement_t;
258 typedef struct _const_decl_t {
259 const WCHAR *name;
260 expression_t *value_expr;
261 struct _const_decl_t *next;
262 } const_decl_t;
264 typedef struct {
265 statement_t stat;
266 const_decl_t *decls;
267 } const_statement_t;
269 typedef struct _case_clausule_t {
270 expression_t *expr;
271 statement_t *stat;
272 struct _case_clausule_t *next;
273 } case_clausule_t;
275 typedef struct {
276 statement_t stat;
277 expression_t *expr;
278 case_clausule_t *case_clausules;
279 } select_statement_t;
281 typedef struct {
282 statement_t stat;
283 expression_t *expr;
284 statement_t *body;
285 } with_statement_t;
287 typedef struct {
288 statement_t stat;
289 expression_t *expr;
290 } retval_statement_t;
292 typedef struct {
293 const WCHAR *code;
294 const WCHAR *ptr;
295 const WCHAR *end;
297 BOOL option_explicit;
298 BOOL is_html;
299 HRESULT hres;
300 int error_loc;
301 LCID lcid;
303 int last_token;
304 unsigned last_nl;
306 statement_t *stats;
307 statement_t *stats_tail;
308 class_decl_t *class_decls;
310 heap_pool_t heap;
311 } parser_ctx_t;
313 HRESULT parse_script(parser_ctx_t*,const WCHAR*,const WCHAR*,DWORD);
314 void parser_release(parser_ctx_t*);
315 int parser_lex(void*,unsigned*,parser_ctx_t*);
316 void *parser_alloc(parser_ctx_t*,size_t);