include: Add ID2D1PathGeometry1 definition.
[wine.git] / dlls / vbscript / parse.h
blob32cfcfe75c5696f335c4e4443e205072ba16863f
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 {
176 statement_t stat;
177 const WCHAR *identifier;
178 BOOL preserve;
179 expression_t *dims;
180 } redim_statement_t;
182 typedef struct _arg_decl_t {
183 const WCHAR *name;
184 BOOL by_ref;
185 struct _arg_decl_t *next;
186 } arg_decl_t;
188 typedef struct _function_decl_t {
189 const WCHAR *name;
190 function_type_t type;
191 BOOL is_public;
192 BOOL is_default;
193 arg_decl_t *args;
194 statement_t *body;
195 struct _function_decl_t *next;
196 struct _function_decl_t *next_prop_func;
197 } function_decl_t;
199 typedef struct {
200 statement_t stat;
201 function_decl_t *func_decl;
202 } function_statement_t;
204 typedef struct _class_decl_t {
205 const WCHAR *name;
206 function_decl_t *funcs;
207 dim_decl_t *props;
208 struct _class_decl_t *next;
209 } class_decl_t;
211 typedef struct _elseif_decl_t {
212 expression_t *expr;
213 statement_t *stat;
214 unsigned loc;
215 struct _elseif_decl_t *next;
216 } elseif_decl_t;
218 typedef struct {
219 statement_t stat;
220 expression_t *expr;
221 statement_t *if_stat;
222 elseif_decl_t *elseifs;
223 statement_t *else_stat;
224 } if_statement_t;
226 typedef struct {
227 statement_t stat;
228 expression_t *expr;
229 statement_t *body;
230 } while_statement_t;
232 typedef struct {
233 statement_t stat;
234 const WCHAR *identifier;
235 expression_t *from_expr;
236 expression_t *to_expr;
237 expression_t *step_expr;
238 statement_t *body;
239 } forto_statement_t;
241 typedef struct {
242 statement_t stat;
243 const WCHAR *identifier;
244 expression_t *group_expr;
245 statement_t *body;
246 } foreach_statement_t;
248 typedef struct {
249 statement_t stat;
250 BOOL resume_next;
251 } onerror_statement_t;
253 typedef struct _const_decl_t {
254 const WCHAR *name;
255 expression_t *value_expr;
256 struct _const_decl_t *next;
257 } const_decl_t;
259 typedef struct {
260 statement_t stat;
261 const_decl_t *decls;
262 } const_statement_t;
264 typedef struct _case_clausule_t {
265 expression_t *expr;
266 statement_t *stat;
267 struct _case_clausule_t *next;
268 } case_clausule_t;
270 typedef struct {
271 statement_t stat;
272 expression_t *expr;
273 case_clausule_t *case_clausules;
274 } select_statement_t;
276 typedef struct {
277 statement_t stat;
278 expression_t *expr;
279 statement_t *body;
280 } with_statement_t;
282 typedef struct {
283 statement_t stat;
284 expression_t *expr;
285 } retval_statement_t;
287 typedef struct {
288 const WCHAR *code;
289 const WCHAR *ptr;
290 const WCHAR *end;
292 BOOL option_explicit;
293 BOOL is_html;
294 HRESULT hres;
295 int error_loc;
296 LCID lcid;
298 int last_token;
299 unsigned last_nl;
301 statement_t *stats;
302 statement_t *stats_tail;
303 class_decl_t *class_decls;
305 heap_pool_t heap;
306 } parser_ctx_t;
308 HRESULT parse_script(parser_ctx_t*,const WCHAR*,const WCHAR*,DWORD) DECLSPEC_HIDDEN;
309 void parser_release(parser_ctx_t*) DECLSPEC_HIDDEN;
310 int parser_lex(void*,unsigned*,parser_ctx_t*) DECLSPEC_HIDDEN;
311 void *parser_alloc(parser_ctx_t*,size_t) DECLSPEC_HIDDEN;