gdi32: Avoid redundant computation of the gradient bounding rectangle.
[wine/multimedia.git] / dlls / vbscript / parse.h
blobb97ee13db70868fcc3543f493f027f5525da3914
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_CONCAT,
24 EXPR_DIV,
25 EXPR_DOUBLE,
26 EXPR_EMPTY,
27 EXPR_EQUAL,
28 EXPR_EQV,
29 EXPR_EXP,
30 EXPR_GT,
31 EXPR_GTEQ,
32 EXPR_IDIV,
33 EXPR_IMP,
34 EXPR_IS,
35 EXPR_LT,
36 EXPR_LTEQ,
37 EXPR_ME,
38 EXPR_MEMBER,
39 EXPR_MOD,
40 EXPR_MUL,
41 EXPR_NEG,
42 EXPR_NEQUAL,
43 EXPR_NEW,
44 EXPR_NOT,
45 EXPR_NOTHING,
46 EXPR_NULL,
47 EXPR_OR,
48 EXPR_STRING,
49 EXPR_SUB,
50 EXPR_ULONG,
51 EXPR_USHORT,
52 EXPR_XOR
53 } expression_type_t;
55 typedef struct _expression_t {
56 expression_type_t type;
57 struct _expression_t *next;
58 } expression_t;
60 typedef struct {
61 expression_t expr;
62 VARIANT_BOOL value;
63 } bool_expression_t;
65 typedef struct {
66 expression_t expr;
67 LONG value;
68 } int_expression_t;
70 typedef struct {
71 expression_t expr;
72 double value;
73 } double_expression_t;
75 typedef struct {
76 expression_t expr;
77 const WCHAR *value;
78 } string_expression_t;
80 typedef struct {
81 expression_t expr;
82 expression_t *subexpr;
83 } unary_expression_t;
85 typedef struct {
86 expression_t expr;
87 expression_t *left;
88 expression_t *right;
89 } binary_expression_t;
91 typedef struct {
92 expression_t expr;
93 expression_t *obj_expr;
94 const WCHAR *identifier;
95 expression_t *args;
96 } member_expression_t;
98 typedef enum {
99 STAT_ASSIGN,
100 STAT_CALL,
101 STAT_CONST,
102 STAT_DIM,
103 STAT_DOUNTIL,
104 STAT_DOWHILE,
105 STAT_EXITDO,
106 STAT_EXITFOR,
107 STAT_EXITFUNC,
108 STAT_EXITPROP,
109 STAT_EXITSUB,
110 STAT_FOREACH,
111 STAT_FORTO,
112 STAT_FUNC,
113 STAT_IF,
114 STAT_ONERROR,
115 STAT_SET,
116 STAT_STOP,
117 STAT_UNTIL,
118 STAT_WHILE,
119 STAT_WHILELOOP
120 } statement_type_t;
122 typedef struct _statement_t {
123 statement_type_t type;
124 struct _statement_t *next;
125 } statement_t;
127 typedef struct {
128 statement_t stat;
129 member_expression_t *expr;
130 } call_statement_t;
132 typedef struct {
133 statement_t stat;
134 member_expression_t *member_expr;
135 expression_t *value_expr;
136 } assign_statement_t;
138 typedef struct _dim_decl_t {
139 const WCHAR *name;
140 struct _dim_decl_t *next;
141 } dim_decl_t;
143 typedef struct _dim_statement_t {
144 statement_t stat;
145 dim_decl_t *dim_decls;
146 } dim_statement_t;
148 typedef struct _arg_decl_t {
149 const WCHAR *name;
150 BOOL by_ref;
151 struct _arg_decl_t *next;
152 } arg_decl_t;
154 typedef struct _function_decl_t {
155 const WCHAR *name;
156 function_type_t type;
157 BOOL is_public;
158 arg_decl_t *args;
159 statement_t *body;
160 struct _function_decl_t *next;
161 struct _function_decl_t *next_prop_func;
162 } function_decl_t;
164 typedef struct {
165 statement_t stat;
166 function_decl_t *func_decl;
167 } function_statement_t;
169 typedef struct _class_prop_decl_t {
170 BOOL is_public;
171 const WCHAR *name;
172 struct _class_prop_decl_t *next;
173 } class_prop_decl_t;
175 typedef struct _class_decl_t {
176 const WCHAR *name;
177 function_decl_t *funcs;
178 class_prop_decl_t *props;
179 struct _class_decl_t *next;
180 } class_decl_t;
182 typedef struct _elseif_decl_t {
183 expression_t *expr;
184 statement_t *stat;
185 struct _elseif_decl_t *next;
186 } elseif_decl_t;
188 typedef struct {
189 statement_t stat;
190 expression_t *expr;
191 statement_t *if_stat;
192 elseif_decl_t *elseifs;
193 statement_t *else_stat;
194 } if_statement_t;
196 typedef struct {
197 statement_t stat;
198 expression_t *expr;
199 statement_t *body;
200 } while_statement_t;
202 typedef struct {
203 statement_t stat;
204 const WCHAR *identifier;
205 expression_t *from_expr;
206 expression_t *to_expr;
207 expression_t *step_expr;
208 statement_t *body;
209 } forto_statement_t;
211 typedef struct {
212 statement_t stat;
213 const WCHAR *identifier;
214 expression_t *group_expr;
215 statement_t *body;
216 } foreach_statement_t;
218 typedef struct {
219 statement_t stat;
220 BOOL resume_next;
221 } onerror_statement_t;
223 typedef struct _const_decl_t {
224 const WCHAR *name;
225 expression_t *value_expr;
226 struct _const_decl_t *next;
227 } const_decl_t;
229 typedef struct {
230 statement_t stat;
231 const_decl_t *decls;
232 } const_statement_t;
234 typedef struct {
235 const WCHAR *code;
236 const WCHAR *ptr;
237 const WCHAR *end;
239 BOOL option_explicit;
240 BOOL parse_complete;
241 HRESULT hres;
243 int last_token;
244 unsigned last_nl;
246 statement_t *stats;
247 statement_t *stats_tail;
248 class_decl_t *class_decls;
250 vbsheap_t heap;
251 } parser_ctx_t;
253 HRESULT parse_script(parser_ctx_t*,const WCHAR*) DECLSPEC_HIDDEN;
254 void parser_release(parser_ctx_t*) DECLSPEC_HIDDEN;
255 int parser_lex(void*,parser_ctx_t*) DECLSPEC_HIDDEN;
256 void *parser_alloc(parser_ctx_t*,size_t) DECLSPEC_HIDDEN;