forked from lcompilers/lpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparser_stype.h
More file actions
132 lines (98 loc) · 2.86 KB
/
parser_stype.h
File metadata and controls
132 lines (98 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#ifndef LPYTHON_PARSER_STYPE_H
#define LPYTHON_PARSER_STYPE_H
#include <cstring>
#include <lpython/python_ast.h>
#include <libasr/location.h>
#include <libasr/containers.h>
#include <libasr/bigint.h>
namespace LCompilers::LPython {
struct Key_Val {
LPython::AST::expr_t* key;
LPython::AST::expr_t* value;
};
struct Args {
LPython::AST::arguments_t arguments;
};
struct Arg {
bool default_value;
LPython::AST::arg_t _arg;
LPython::AST::expr_t *defaults;
};
struct Var_Kw {
Vec<Arg*> vararg;
Vec<Arg*> kwonlyargs;
Vec<Arg*> kwarg;
};
struct Args_ {
Vec<Arg*> args;
bool var_kw_val;
Var_Kw *var_kw;
};
struct Fn_Arg {
Vec<Arg*> posonlyargs;
bool args_val;
Args_ *args;
};
struct Kw_or_Star_Arg {
LPython::AST::expr_t *star_arg;
LPython::AST::keyword_t *kw_arg;
};
struct Call_Arg {
Vec<LPython::AST::expr_t*> expr;
Vec<LPython::AST::keyword_t> kw;
};
struct Key_Val_Pattern {
LPython::AST::expr_t* key;
LPython::AST::pattern_t* val;
};
union YYSTYPE {
int64_t n;
double f;
Str string;
LPython::AST::ast_t* ast;
Vec<LPython::AST::ast_t*> vec_ast;
LPython::AST::alias_t* alias;
Vec<LPython::AST::alias_t> vec_alias;
Arg *arg;
Vec<Arg*> vec_arg;
Args *args;
Vec<Args> vec_args;
Fn_Arg *fn_arg;
Args_ *args_;
Var_Kw *var_kw;
Key_Val *key_val;
Vec<Key_Val*> vec_key_val;
LPython::AST::withitem_t* withitem;
Vec<LPython::AST::withitem_t> vec_withitem;
LPython::AST::keyword_t* keyword;
Vec<LPython::AST::keyword_t> vec_keyword;
Kw_or_Star_Arg* kw_or_star;
Vec<Kw_or_Star_Arg> vec_kw_or_star;
Call_Arg *call_arg;
LPython::AST::comprehension_t* comp;
Vec<LPython::AST::comprehension_t> vec_comp;
LPython::AST::operatorType operator_type;
LPython::AST::match_case_t* match_case;
Vec<LPython::AST::match_case_t> vec_match_case;
LPython::AST::pattern_t* pattern;
Vec<LPython::AST::pattern_t*> vec_pattern;
Key_Val_Pattern *kw_val_pattern;
Vec<Key_Val_Pattern> vec_kw_val_pattern;
};
static_assert(std::is_standard_layout<YYSTYPE>::value);
static_assert(std::is_trivial<YYSTYPE>::value);
// Ensure the YYSTYPE size is equal to Vec<AST::ast_t*>, which is a required member, so
// YYSTYPE must be at least as big, but it should not be bigger, otherwise it
// would reduce performance.
// A temporary fix for PowerPC 32-bit, where the following assert fails with (16 == 12).
#if !defined(HAVE_BUILD_TO_WASM) && !defined(__ppc__)
static_assert(sizeof(YYSTYPE) == sizeof(Vec<AST::ast_t*>));
#endif
static_assert(std::is_standard_layout<Location>::value);
static_assert(std::is_trivial<Location>::value);
} // namespace LCompilers::LPython
typedef struct LCompilers::Location YYLTYPE;
#define YYLTYPE_IS_DECLARED 1
#define YYLTYPE_IS_TRIVIAL 0
#define YYINITDEPTH 2000
#endif // LPYTHON_PARSER_STYPE_H