po: Update Lithuanian translation.
[wine.git] / dlls / vbscript / parse.h
blob4bf82cbedb32964583007d8384f8360c38819485
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_DIV,
27 EXPR_DOT,
28 EXPR_DOUBLE,
29 EXPR_EMPTY,
30 EXPR_EQUAL,
31 EXPR_EQV,
32 EXPR_EXP,
33 EXPR_GT,
34 EXPR_GTEQ,
35 EXPR_IDIV,
36 EXPR_IMP,
37 EXPR_INT,
38 EXPR_IS,
39 EXPR_LT,
40 EXPR_LTEQ,
41 EXPR_ME,
42 EXPR_MEMBER,
43 EXPR_MOD,
44 EXPR_MUL,
45 EXPR_NEG,
46 EXPR_NEQUAL,
47 EXPR_NEW,
48 EXPR_NOARG, /* not a real expression */
49 EXPR_NOT,
50 EXPR_NOTHING,
51 EXPR_NULL,
52 EXPR_OR,
53 EXPR_STRING,
54 EXPR_SUB,
55 EXPR_XOR
56 } expression_type_t;
58 typedef struct _expression_t {
59 expression_type_t type;
60 struct _expression_t *next;
61 } expression_t;
63 typedef struct {
64 expression_t expr;
65 VARIANT_BOOL value;
66 } bool_expression_t;
68 typedef struct {
69 expression_t expr;
70 LONG value;
71 } int_expression_t;
73 typedef struct {
74 expression_t expr;
75 double value;
76 } double_expression_t;
78 typedef struct {
79 expression_t expr;
80 const WCHAR *value;
81 } string_expression_t;
83 typedef struct {
84 expression_t expr;
85 expression_t *subexpr;
86 } unary_expression_t;
88 typedef struct {
89 expression_t expr;
90 expression_t *left;
91 expression_t *right;
92 } binary_expression_t;
94 typedef struct {
95 expression_t expr;
96 expression_t *obj_expr;
97 const WCHAR *identifier;
98 } member_expression_t;
100 typedef struct {
101 expression_t expr;
102 expression_t *call_expr;
103 expression_t *args;
104 } call_expression_t;
106 typedef enum {
107 STAT_ASSIGN,
108 STAT_CALL,
109 STAT_CONST,
110 STAT_DIM,
111 STAT_DOUNTIL,
112 STAT_DOWHILE,
113 STAT_EXITDO,
114 STAT_EXITFOR,
115 STAT_EXITFUNC,
116 STAT_EXITPROP,
117 STAT_EXITSUB,
118 STAT_FOREACH,
119 STAT_FORTO,
120 STAT_FUNC,
121 STAT_IF,
122 STAT_ONERROR,
123 STAT_REDIM,
124 STAT_SELECT,
125 STAT_SET,
126 STAT_STOP,
127 STAT_UNTIL,
128 STAT_WHILE,
129 STAT_WHILELOOP,
130 STAT_WITH,
131 STAT_RETVAL
132 } statement_type_t;
134 typedef struct _statement_t {
135 statement_type_t type;
136 struct _statement_t *next;
137 } statement_t;
139 typedef struct {
140 statement_t stat;
141 call_expression_t *expr;
142 BOOL is_strict;
143 } call_statement_t;
145 typedef struct {
146 statement_t stat;
147 call_expression_t *left_expr;
148 expression_t *value_expr;
149 } assign_statement_t;
151 typedef struct _dim_list_t {
152 unsigned val;
153 struct _dim_list_t *next;
154 } dim_list_t;
156 typedef struct _dim_decl_t {
157 const WCHAR *name;
158 BOOL is_array;
159 BOOL is_public; /* Used only for class members. */
160 dim_list_t *dims;
161 struct _dim_decl_t *next;
162 } dim_decl_t;
164 typedef struct _dim_statement_t {
165 statement_t stat;
166 dim_decl_t *dim_decls;
167 } dim_statement_t;
169 typedef struct {
170 statement_t stat;
171 const WCHAR *identifier;
172 BOOL preserve;
173 expression_t *dims;
174 } redim_statement_t;
176 typedef struct _arg_decl_t {
177 const WCHAR *name;
178 BOOL by_ref;
179 struct _arg_decl_t *next;
180 } arg_decl_t;
182 typedef struct _function_decl_t {
183 const WCHAR *name;
184 function_type_t type;
185 BOOL is_public;
186 arg_decl_t *args;
187 statement_t *body;
188 struct _function_decl_t *next;
189 struct _function_decl_t *next_prop_func;
190 } function_decl_t;
192 typedef struct {
193 statement_t stat;
194 function_decl_t *func_decl;
195 } function_statement_t;
197 typedef struct _class_decl_t {
198 const WCHAR *name;
199 function_decl_t *funcs;
200 dim_decl_t *props;
201 struct _class_decl_t *next;
202 } class_decl_t;
204 typedef struct _elseif_decl_t {
205 expression_t *expr;
206 statement_t *stat;
207 struct _elseif_decl_t *next;
208 } elseif_decl_t;
210 typedef struct {
211 statement_t stat;
212 expression_t *expr;
213 statement_t *if_stat;
214 elseif_decl_t *elseifs;
215 statement_t *else_stat;
216 } if_statement_t;
218 typedef struct {
219 statement_t stat;
220 expression_t *expr;
221 statement_t *body;
222 } while_statement_t;
224 typedef struct {
225 statement_t stat;
226 const WCHAR *identifier;
227 expression_t *from_expr;
228 expression_t *to_expr;
229 expression_t *step_expr;
230 statement_t *body;
231 } forto_statement_t;
233 typedef struct {
234 statement_t stat;
235 const WCHAR *identifier;
236 expression_t *group_expr;
237 statement_t *body;
238 } foreach_statement_t;
240 typedef struct {
241 statement_t stat;
242 BOOL resume_next;
243 } onerror_statement_t;
245 typedef struct _const_decl_t {
246 const WCHAR *name;
247 expression_t *value_expr;
248 struct _const_decl_t *next;
249 } const_decl_t;
251 typedef struct {
252 statement_t stat;
253 const_decl_t *decls;
254 } const_statement_t;
256 typedef struct _case_clausule_t {
257 expression_t *expr;
258 statement_t *stat;
259 struct _case_clausule_t *next;
260 } case_clausule_t;
262 typedef struct {
263 statement_t stat;
264 expression_t *expr;
265 case_clausule_t *case_clausules;
266 } select_statement_t;
268 typedef struct {
269 statement_t stat;
270 expression_t *expr;
271 statement_t *body;
272 } with_statement_t;
274 typedef struct {
275 statement_t stat;
276 expression_t *expr;
277 } retval_statement_t;
279 typedef struct {
280 const WCHAR *code;
281 const WCHAR *ptr;
282 const WCHAR *end;
284 BOOL option_explicit;
285 BOOL parse_complete;
286 BOOL is_html;
287 HRESULT hres;
289 int last_token;
290 unsigned last_nl;
292 statement_t *stats;
293 statement_t *stats_tail;
294 class_decl_t *class_decls;
296 heap_pool_t heap;
297 } parser_ctx_t;
299 HRESULT parse_script(parser_ctx_t*,const WCHAR*,const WCHAR*,DWORD) DECLSPEC_HIDDEN;
300 void parser_release(parser_ctx_t*) DECLSPEC_HIDDEN;
301 int parser_lex(void*,parser_ctx_t*) DECLSPEC_HIDDEN;
302 void *parser_alloc(parser_ctx_t*,size_t) DECLSPEC_HIDDEN;