vbscript: Added parser support for string literals.
[wine] / dlls / vbscript / parse.h
1 /*
2  * Copyright 2011 Jacek Caban for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  */
18
19 typedef enum {
20     EXPR_BOOL,
21     EXPR_MEMBER,
22     EXPR_STRING
23 } expression_type_t;
24
25 typedef struct _expression_t {
26     expression_type_t type;
27     struct _expression_t *next;
28 } expression_t;
29
30 typedef struct {
31     expression_t expr;
32     VARIANT_BOOL value;
33 } bool_expression_t;
34
35 typedef struct {
36     expression_t expr;
37     const WCHAR *value;
38 } string_expression_t;
39
40 typedef struct {
41     expression_t expr;
42     expression_t *obj_expr;
43     const WCHAR *identifier;
44     expression_t *args;
45 } member_expression_t;
46
47 typedef enum {
48     STAT_CALL
49 } statement_type_t;
50
51 typedef struct _statement_t {
52     statement_type_t type;
53     struct _statement_t *next;
54 } statement_t;
55
56 typedef struct {
57     statement_t stat;
58     member_expression_t *expr;
59 } call_statement_t;
60
61 typedef struct {
62     const WCHAR *code;
63     const WCHAR *ptr;
64     const WCHAR *end;
65
66     BOOL parse_complete;
67     HRESULT hres;
68
69     int last_token;
70     unsigned last_nl;
71
72     statement_t *stats;
73     statement_t *stats_tail;
74 } parser_ctx_t;
75
76 HRESULT parse_script(parser_ctx_t*,const WCHAR*) DECLSPEC_HIDDEN;
77 int parser_lex(void*,parser_ctx_t*) DECLSPEC_HIDDEN;
78 void *parser_alloc(parser_ctx_t*,size_t) DECLSPEC_HIDDEN;