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