vbscript: Added bool literals parsing support.
[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 } expression_type_t;
23
24 typedef struct _expression_t {
25     expression_type_t type;
26     struct _expression_t *next;
27 } expression_t;
28
29 typedef struct {
30     expression_t expr;
31     VARIANT_BOOL value;
32 } bool_expression_t;
33
34 typedef struct {
35     expression_t expr;
36     expression_t *obj_expr;
37     const WCHAR *identifier;
38     expression_t *args;
39 } member_expression_t;
40
41 typedef enum {
42     STAT_CALL
43 } statement_type_t;
44
45 typedef struct _statement_t {
46     statement_type_t type;
47     struct _statement_t *next;
48 } statement_t;
49
50 typedef struct {
51     statement_t stat;
52     member_expression_t *expr;
53 } call_statement_t;
54
55 typedef struct {
56     const WCHAR *code;
57     const WCHAR *ptr;
58     const WCHAR *end;
59
60     BOOL parse_complete;
61     HRESULT hres;
62
63     int last_token;
64     unsigned last_nl;
65
66     statement_t *stats;
67     statement_t *stats_tail;
68 } parser_ctx_t;
69
70 HRESULT parse_script(parser_ctx_t*,const WCHAR*) DECLSPEC_HIDDEN;
71 int parser_lex(void*,parser_ctx_t*) DECLSPEC_HIDDEN;
72 void *parser_alloc(parser_ctx_t*,size_t) DECLSPEC_HIDDEN;