wbemprox: Add support for enumerating class methods.
[wine/multimedia.git] / dlls / vbscript / parse.h
blobdf8f9b5fb52ea39ba7a4e1791e06ef8d2b81222b
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_CONCAT,
25 EXPR_DIV,
26 EXPR_DOUBLE,
27 EXPR_EMPTY,
28 EXPR_EQUAL,
29 EXPR_EQV,
30 EXPR_EXP,
31 EXPR_GT,
32 EXPR_GTEQ,
33 EXPR_IDIV,
34 EXPR_IMP,
35 EXPR_IS,
36 EXPR_LT,
37 EXPR_LTEQ,
38 EXPR_ME,
39 EXPR_MEMBER,
40 EXPR_MOD,
41 EXPR_MUL,
42 EXPR_NEG,
43 EXPR_NEQUAL,
44 EXPR_NEW,
45 EXPR_NOT,
46 EXPR_NOTHING,
47 EXPR_NULL,
48 EXPR_OR,
49 EXPR_STRING,
50 EXPR_SUB,
51 EXPR_ULONG,
52 EXPR_USHORT,
53 EXPR_XOR
54 } expression_type_t;
56 typedef struct _expression_t {
57 expression_type_t type;
58 struct _expression_t *next;
59 } expression_t;
61 typedef struct {
62 expression_t expr;
63 VARIANT_BOOL value;
64 } bool_expression_t;
66 typedef struct {
67 expression_t expr;
68 LONG value;
69 } int_expression_t;
71 typedef struct {
72 expression_t expr;
73 double value;
74 } double_expression_t;
76 typedef struct {
77 expression_t expr;
78 const WCHAR *value;
79 } string_expression_t;
81 typedef struct {
82 expression_t expr;
83 expression_t *subexpr;
84 } unary_expression_t;
86 typedef struct {
87 expression_t expr;
88 expression_t *left;
89 expression_t *right;
90 } binary_expression_t;
92 typedef struct {
93 expression_t expr;
94 expression_t *obj_expr;
95 const WCHAR *identifier;
96 expression_t *args;
97 } member_expression_t;
99 typedef enum {
100 STAT_ASSIGN,
101 STAT_CALL,
102 STAT_CONST,
103 STAT_DIM,
104 STAT_DOUNTIL,
105 STAT_DOWHILE,
106 STAT_EXITDO,
107 STAT_EXITFOR,
108 STAT_EXITFUNC,
109 STAT_EXITPROP,
110 STAT_EXITSUB,
111 STAT_FOREACH,
112 STAT_FORTO,
113 STAT_FUNC,
114 STAT_IF,
115 STAT_ONERROR,
116 STAT_SELECT,
117 STAT_SET,
118 STAT_STOP,
119 STAT_UNTIL,
120 STAT_WHILE,
121 STAT_WHILELOOP
122 } statement_type_t;
124 typedef struct _statement_t {
125 statement_type_t type;
126 struct _statement_t *next;
127 } statement_t;
129 typedef struct {
130 statement_t stat;
131 member_expression_t *expr;
132 BOOL is_strict;
133 } call_statement_t;
135 typedef struct {
136 statement_t stat;
137 member_expression_t *member_expr;
138 expression_t *value_expr;
139 } assign_statement_t;
141 typedef struct _dim_decl_t {
142 const WCHAR *name;
143 struct _dim_decl_t *next;
144 } dim_decl_t;
146 typedef struct _dim_statement_t {
147 statement_t stat;
148 dim_decl_t *dim_decls;
149 } dim_statement_t;
151 typedef struct _arg_decl_t {
152 const WCHAR *name;
153 BOOL by_ref;
154 struct _arg_decl_t *next;
155 } arg_decl_t;
157 typedef struct _function_decl_t {
158 const WCHAR *name;
159 function_type_t type;
160 BOOL is_public;
161 arg_decl_t *args;
162 statement_t *body;
163 struct _function_decl_t *next;
164 struct _function_decl_t *next_prop_func;
165 } function_decl_t;
167 typedef struct {
168 statement_t stat;
169 function_decl_t *func_decl;
170 } function_statement_t;
172 typedef struct _class_prop_decl_t {
173 BOOL is_public;
174 const WCHAR *name;
175 struct _class_prop_decl_t *next;
176 } class_prop_decl_t;
178 typedef struct _class_decl_t {
179 const WCHAR *name;
180 function_decl_t *funcs;
181 class_prop_decl_t *props;
182 struct _class_decl_t *next;
183 } class_decl_t;
185 typedef struct _elseif_decl_t {
186 expression_t *expr;
187 statement_t *stat;
188 struct _elseif_decl_t *next;
189 } elseif_decl_t;
191 typedef struct {
192 statement_t stat;
193 expression_t *expr;
194 statement_t *if_stat;
195 elseif_decl_t *elseifs;
196 statement_t *else_stat;
197 } if_statement_t;
199 typedef struct {
200 statement_t stat;
201 expression_t *expr;
202 statement_t *body;
203 } while_statement_t;
205 typedef struct {
206 statement_t stat;
207 const WCHAR *identifier;
208 expression_t *from_expr;
209 expression_t *to_expr;
210 expression_t *step_expr;
211 statement_t *body;
212 } forto_statement_t;
214 typedef struct {
215 statement_t stat;
216 const WCHAR *identifier;
217 expression_t *group_expr;
218 statement_t *body;
219 } foreach_statement_t;
221 typedef struct {
222 statement_t stat;
223 BOOL resume_next;
224 } onerror_statement_t;
226 typedef struct _const_decl_t {
227 const WCHAR *name;
228 expression_t *value_expr;
229 struct _const_decl_t *next;
230 } const_decl_t;
232 typedef struct {
233 statement_t stat;
234 const_decl_t *decls;
235 } const_statement_t;
237 typedef struct _case_clausule_t {
238 expression_t *expr;
239 statement_t *stat;
240 struct _case_clausule_t *next;
241 } case_clausule_t;
243 typedef struct {
244 statement_t stat;
245 expression_t *expr;
246 case_clausule_t *case_clausules;
247 } select_statement_t;
249 typedef struct {
250 const WCHAR *code;
251 const WCHAR *ptr;
252 const WCHAR *end;
254 BOOL option_explicit;
255 BOOL parse_complete;
256 HRESULT hres;
258 int last_token;
259 unsigned last_nl;
261 statement_t *stats;
262 statement_t *stats_tail;
263 class_decl_t *class_decls;
265 vbsheap_t heap;
266 } parser_ctx_t;
268 HRESULT parse_script(parser_ctx_t*,const WCHAR*) DECLSPEC_HIDDEN;
269 void parser_release(parser_ctx_t*) DECLSPEC_HIDDEN;
270 int parser_lex(void*,parser_ctx_t*) DECLSPEC_HIDDEN;
271 void *parser_alloc(parser_ctx_t*,size_t) DECLSPEC_HIDDEN;