yarp 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/CONTRIBUTING.md +51 -0
- data/LICENSE.md +7 -0
- data/Makefile.in +79 -0
- data/README.md +86 -0
- data/config.h.in +25 -0
- data/config.yml +2147 -0
- data/configure +4487 -0
- data/docs/build_system.md +85 -0
- data/docs/building.md +26 -0
- data/docs/configuration.md +56 -0
- data/docs/design.md +53 -0
- data/docs/encoding.md +116 -0
- data/docs/extension.md +20 -0
- data/docs/fuzzing.md +93 -0
- data/docs/heredocs.md +36 -0
- data/docs/mapping.md +117 -0
- data/docs/ripper.md +36 -0
- data/docs/serialization.md +130 -0
- data/docs/testing.md +55 -0
- data/ext/yarp/api_node.c +3680 -0
- data/ext/yarp/api_pack.c +256 -0
- data/ext/yarp/extconf.rb +131 -0
- data/ext/yarp/extension.c +547 -0
- data/ext/yarp/extension.h +18 -0
- data/include/yarp/ast.h +1412 -0
- data/include/yarp/defines.h +54 -0
- data/include/yarp/diagnostic.h +24 -0
- data/include/yarp/enc/yp_encoding.h +94 -0
- data/include/yarp/node.h +36 -0
- data/include/yarp/pack.h +141 -0
- data/include/yarp/parser.h +389 -0
- data/include/yarp/regexp.h +19 -0
- data/include/yarp/unescape.h +42 -0
- data/include/yarp/util/yp_buffer.h +39 -0
- data/include/yarp/util/yp_char.h +75 -0
- data/include/yarp/util/yp_constant_pool.h +64 -0
- data/include/yarp/util/yp_list.h +67 -0
- data/include/yarp/util/yp_memchr.h +14 -0
- data/include/yarp/util/yp_newline_list.h +54 -0
- data/include/yarp/util/yp_state_stack.h +24 -0
- data/include/yarp/util/yp_string.h +57 -0
- data/include/yarp/util/yp_string_list.h +28 -0
- data/include/yarp/util/yp_strpbrk.h +29 -0
- data/include/yarp/version.h +5 -0
- data/include/yarp.h +69 -0
- data/lib/yarp/lex_compat.rb +759 -0
- data/lib/yarp/node.rb +7428 -0
- data/lib/yarp/pack.rb +185 -0
- data/lib/yarp/ripper_compat.rb +174 -0
- data/lib/yarp/serialize.rb +389 -0
- data/lib/yarp.rb +330 -0
- data/src/diagnostic.c +25 -0
- data/src/enc/yp_big5.c +79 -0
- data/src/enc/yp_euc_jp.c +85 -0
- data/src/enc/yp_gbk.c +88 -0
- data/src/enc/yp_shift_jis.c +83 -0
- data/src/enc/yp_tables.c +509 -0
- data/src/enc/yp_unicode.c +2320 -0
- data/src/enc/yp_windows_31j.c +83 -0
- data/src/node.c +2011 -0
- data/src/pack.c +493 -0
- data/src/prettyprint.c +1782 -0
- data/src/regexp.c +580 -0
- data/src/serialize.c +1576 -0
- data/src/token_type.c +347 -0
- data/src/unescape.c +576 -0
- data/src/util/yp_buffer.c +78 -0
- data/src/util/yp_char.c +229 -0
- data/src/util/yp_constant_pool.c +147 -0
- data/src/util/yp_list.c +50 -0
- data/src/util/yp_memchr.c +31 -0
- data/src/util/yp_newline_list.c +119 -0
- data/src/util/yp_state_stack.c +25 -0
- data/src/util/yp_string.c +207 -0
- data/src/util/yp_string_list.c +32 -0
- data/src/util/yp_strncasecmp.c +20 -0
- data/src/util/yp_strpbrk.c +66 -0
- data/src/yarp.c +13211 -0
- data/yarp.gemspec +100 -0
- metadata +125 -0
data/include/yarp/ast.h
ADDED
@@ -0,0 +1,1412 @@
|
|
1
|
+
/******************************************************************************/
|
2
|
+
/* This file is generated by the bin/template script and should not be */
|
3
|
+
/* modified manually. See */
|
4
|
+
/* templates/include/yarp/ast.h.erb */
|
5
|
+
/* if you are looking to modify the */
|
6
|
+
/* template */
|
7
|
+
/******************************************************************************/
|
8
|
+
#ifndef YARP_AST_H
|
9
|
+
#define YARP_AST_H
|
10
|
+
|
11
|
+
#include "yarp/defines.h"
|
12
|
+
#include "yarp/util/yp_constant_pool.h"
|
13
|
+
#include "yarp/util/yp_string.h"
|
14
|
+
|
15
|
+
#include <assert.h>
|
16
|
+
#include <stddef.h>
|
17
|
+
#include <stdint.h>
|
18
|
+
|
19
|
+
// This enum represents every type of token in the Ruby source.
|
20
|
+
typedef enum yp_token_type {
|
21
|
+
YP_TOKEN_EOF = 1, // final token in the file
|
22
|
+
YP_TOKEN_MISSING, // a token that was expected but not found
|
23
|
+
YP_TOKEN_NOT_PROVIDED, // a token that was not present but it is okay
|
24
|
+
YP_TOKEN_AMPERSAND, // &
|
25
|
+
YP_TOKEN_AMPERSAND_AMPERSAND, // &&
|
26
|
+
YP_TOKEN_AMPERSAND_AMPERSAND_EQUAL, // &&=
|
27
|
+
YP_TOKEN_AMPERSAND_DOT, // &.
|
28
|
+
YP_TOKEN_AMPERSAND_EQUAL, // &=
|
29
|
+
YP_TOKEN_BACKTICK, // `
|
30
|
+
YP_TOKEN_BACK_REFERENCE, // a back reference
|
31
|
+
YP_TOKEN_BANG, // ! or !@
|
32
|
+
YP_TOKEN_BANG_EQUAL, // !=
|
33
|
+
YP_TOKEN_BANG_TILDE, // !~
|
34
|
+
YP_TOKEN_BRACE_LEFT, // {
|
35
|
+
YP_TOKEN_BRACE_RIGHT, // }
|
36
|
+
YP_TOKEN_BRACKET_LEFT, // [
|
37
|
+
YP_TOKEN_BRACKET_LEFT_ARRAY, // [ for the beginning of an array
|
38
|
+
YP_TOKEN_BRACKET_LEFT_RIGHT, // []
|
39
|
+
YP_TOKEN_BRACKET_LEFT_RIGHT_EQUAL, // []=
|
40
|
+
YP_TOKEN_BRACKET_RIGHT, // ]
|
41
|
+
YP_TOKEN_CARET, // ^
|
42
|
+
YP_TOKEN_CARET_EQUAL, // ^=
|
43
|
+
YP_TOKEN_CHARACTER_LITERAL, // a character literal
|
44
|
+
YP_TOKEN_CLASS_VARIABLE, // a class variable
|
45
|
+
YP_TOKEN_COLON, // :
|
46
|
+
YP_TOKEN_COLON_COLON, // ::
|
47
|
+
YP_TOKEN_COMMA, // ,
|
48
|
+
YP_TOKEN_COMMENT, // a comment
|
49
|
+
YP_TOKEN_CONSTANT, // a constant
|
50
|
+
YP_TOKEN_DOT, // .
|
51
|
+
YP_TOKEN_DOT_DOT, // ..
|
52
|
+
YP_TOKEN_DOT_DOT_DOT, // ...
|
53
|
+
YP_TOKEN_EMBDOC_BEGIN, // =begin
|
54
|
+
YP_TOKEN_EMBDOC_END, // =end
|
55
|
+
YP_TOKEN_EMBDOC_LINE, // a line inside of embedded documentation
|
56
|
+
YP_TOKEN_EMBEXPR_BEGIN, // #{
|
57
|
+
YP_TOKEN_EMBEXPR_END, // }
|
58
|
+
YP_TOKEN_EMBVAR, // #
|
59
|
+
YP_TOKEN_EQUAL, // =
|
60
|
+
YP_TOKEN_EQUAL_EQUAL, // ==
|
61
|
+
YP_TOKEN_EQUAL_EQUAL_EQUAL, // ===
|
62
|
+
YP_TOKEN_EQUAL_GREATER, // =>
|
63
|
+
YP_TOKEN_EQUAL_TILDE, // =~
|
64
|
+
YP_TOKEN_FLOAT, // a floating point number
|
65
|
+
YP_TOKEN_FLOAT_IMAGINARY, // a floating pointer number with an imaginary suffix
|
66
|
+
YP_TOKEN_FLOAT_RATIONAL, // a floating pointer number with a rational suffix
|
67
|
+
YP_TOKEN_FLOAT_RATIONAL_IMAGINARY, // a floating pointer number with a rational and imaginary suffix
|
68
|
+
YP_TOKEN_GLOBAL_VARIABLE, // a global variable
|
69
|
+
YP_TOKEN_GREATER, // >
|
70
|
+
YP_TOKEN_GREATER_EQUAL, // >=
|
71
|
+
YP_TOKEN_GREATER_GREATER, // >>
|
72
|
+
YP_TOKEN_GREATER_GREATER_EQUAL, // >>=
|
73
|
+
YP_TOKEN_HEREDOC_END, // the end of a heredoc
|
74
|
+
YP_TOKEN_HEREDOC_START, // the start of a heredoc
|
75
|
+
YP_TOKEN_IDENTIFIER, // an identifier
|
76
|
+
YP_TOKEN_IGNORED_NEWLINE, // an ignored newline
|
77
|
+
YP_TOKEN_INSTANCE_VARIABLE, // an instance variable
|
78
|
+
YP_TOKEN_INTEGER, // an integer (any base)
|
79
|
+
YP_TOKEN_INTEGER_IMAGINARY, // an integer with an imaginary suffix
|
80
|
+
YP_TOKEN_INTEGER_RATIONAL, // an integer with a rational suffix
|
81
|
+
YP_TOKEN_INTEGER_RATIONAL_IMAGINARY, // an integer with a rational and imaginary suffix
|
82
|
+
YP_TOKEN_KEYWORD_ALIAS, // alias
|
83
|
+
YP_TOKEN_KEYWORD_AND, // and
|
84
|
+
YP_TOKEN_KEYWORD_BEGIN, // begin
|
85
|
+
YP_TOKEN_KEYWORD_BEGIN_UPCASE, // BEGIN
|
86
|
+
YP_TOKEN_KEYWORD_BREAK, // break
|
87
|
+
YP_TOKEN_KEYWORD_CASE, // case
|
88
|
+
YP_TOKEN_KEYWORD_CLASS, // class
|
89
|
+
YP_TOKEN_KEYWORD_DEF, // def
|
90
|
+
YP_TOKEN_KEYWORD_DEFINED, // defined?
|
91
|
+
YP_TOKEN_KEYWORD_DO, // do
|
92
|
+
YP_TOKEN_KEYWORD_DO_LOOP, // do keyword for a predicate in a while, until, or for loop
|
93
|
+
YP_TOKEN_KEYWORD_ELSE, // else
|
94
|
+
YP_TOKEN_KEYWORD_ELSIF, // elsif
|
95
|
+
YP_TOKEN_KEYWORD_END, // end
|
96
|
+
YP_TOKEN_KEYWORD_END_UPCASE, // END
|
97
|
+
YP_TOKEN_KEYWORD_ENSURE, // ensure
|
98
|
+
YP_TOKEN_KEYWORD_FALSE, // false
|
99
|
+
YP_TOKEN_KEYWORD_FOR, // for
|
100
|
+
YP_TOKEN_KEYWORD_IF, // if
|
101
|
+
YP_TOKEN_KEYWORD_IF_MODIFIER, // if in the modifier form
|
102
|
+
YP_TOKEN_KEYWORD_IN, // in
|
103
|
+
YP_TOKEN_KEYWORD_MODULE, // module
|
104
|
+
YP_TOKEN_KEYWORD_NEXT, // next
|
105
|
+
YP_TOKEN_KEYWORD_NIL, // nil
|
106
|
+
YP_TOKEN_KEYWORD_NOT, // not
|
107
|
+
YP_TOKEN_KEYWORD_OR, // or
|
108
|
+
YP_TOKEN_KEYWORD_REDO, // redo
|
109
|
+
YP_TOKEN_KEYWORD_RESCUE, // rescue
|
110
|
+
YP_TOKEN_KEYWORD_RESCUE_MODIFIER, // rescue in the modifier form
|
111
|
+
YP_TOKEN_KEYWORD_RETRY, // retry
|
112
|
+
YP_TOKEN_KEYWORD_RETURN, // return
|
113
|
+
YP_TOKEN_KEYWORD_SELF, // self
|
114
|
+
YP_TOKEN_KEYWORD_SUPER, // super
|
115
|
+
YP_TOKEN_KEYWORD_THEN, // then
|
116
|
+
YP_TOKEN_KEYWORD_TRUE, // true
|
117
|
+
YP_TOKEN_KEYWORD_UNDEF, // undef
|
118
|
+
YP_TOKEN_KEYWORD_UNLESS, // unless
|
119
|
+
YP_TOKEN_KEYWORD_UNLESS_MODIFIER, // unless in the modifier form
|
120
|
+
YP_TOKEN_KEYWORD_UNTIL, // until
|
121
|
+
YP_TOKEN_KEYWORD_UNTIL_MODIFIER, // until in the modifier form
|
122
|
+
YP_TOKEN_KEYWORD_WHEN, // when
|
123
|
+
YP_TOKEN_KEYWORD_WHILE, // while
|
124
|
+
YP_TOKEN_KEYWORD_WHILE_MODIFIER, // while in the modifier form
|
125
|
+
YP_TOKEN_KEYWORD_YIELD, // yield
|
126
|
+
YP_TOKEN_KEYWORD___ENCODING__, // __ENCODING__
|
127
|
+
YP_TOKEN_KEYWORD___FILE__, // __FILE__
|
128
|
+
YP_TOKEN_KEYWORD___LINE__, // __LINE__
|
129
|
+
YP_TOKEN_LABEL, // a label
|
130
|
+
YP_TOKEN_LABEL_END, // the end of a label
|
131
|
+
YP_TOKEN_LAMBDA_BEGIN, // {
|
132
|
+
YP_TOKEN_LESS, // <
|
133
|
+
YP_TOKEN_LESS_EQUAL, // <=
|
134
|
+
YP_TOKEN_LESS_EQUAL_GREATER, // <=>
|
135
|
+
YP_TOKEN_LESS_LESS, // <<
|
136
|
+
YP_TOKEN_LESS_LESS_EQUAL, // <<=
|
137
|
+
YP_TOKEN_MINUS, // -
|
138
|
+
YP_TOKEN_MINUS_EQUAL, // -=
|
139
|
+
YP_TOKEN_MINUS_GREATER, // ->
|
140
|
+
YP_TOKEN_NEWLINE, // a newline character outside of other tokens
|
141
|
+
YP_TOKEN_NUMBERED_REFERENCE, // a numbered reference to a capture group in the previous regular expression match
|
142
|
+
YP_TOKEN_PARENTHESIS_LEFT, // (
|
143
|
+
YP_TOKEN_PARENTHESIS_LEFT_PARENTHESES, // ( for a parentheses node
|
144
|
+
YP_TOKEN_PARENTHESIS_RIGHT, // )
|
145
|
+
YP_TOKEN_PERCENT, // %
|
146
|
+
YP_TOKEN_PERCENT_EQUAL, // %=
|
147
|
+
YP_TOKEN_PERCENT_LOWER_I, // %i
|
148
|
+
YP_TOKEN_PERCENT_LOWER_W, // %w
|
149
|
+
YP_TOKEN_PERCENT_LOWER_X, // %x
|
150
|
+
YP_TOKEN_PERCENT_UPPER_I, // %I
|
151
|
+
YP_TOKEN_PERCENT_UPPER_W, // %W
|
152
|
+
YP_TOKEN_PIPE, // |
|
153
|
+
YP_TOKEN_PIPE_EQUAL, // |=
|
154
|
+
YP_TOKEN_PIPE_PIPE, // ||
|
155
|
+
YP_TOKEN_PIPE_PIPE_EQUAL, // ||=
|
156
|
+
YP_TOKEN_PLUS, // +
|
157
|
+
YP_TOKEN_PLUS_EQUAL, // +=
|
158
|
+
YP_TOKEN_QUESTION_MARK, // ?
|
159
|
+
YP_TOKEN_REGEXP_BEGIN, // the beginning of a regular expression
|
160
|
+
YP_TOKEN_REGEXP_END, // the end of a regular expression
|
161
|
+
YP_TOKEN_SEMICOLON, // ;
|
162
|
+
YP_TOKEN_SLASH, // /
|
163
|
+
YP_TOKEN_SLASH_EQUAL, // /=
|
164
|
+
YP_TOKEN_STAR, // *
|
165
|
+
YP_TOKEN_STAR_EQUAL, // *=
|
166
|
+
YP_TOKEN_STAR_STAR, // **
|
167
|
+
YP_TOKEN_STAR_STAR_EQUAL, // **=
|
168
|
+
YP_TOKEN_STRING_BEGIN, // the beginning of a string
|
169
|
+
YP_TOKEN_STRING_CONTENT, // the contents of a string
|
170
|
+
YP_TOKEN_STRING_END, // the end of a string
|
171
|
+
YP_TOKEN_SYMBOL_BEGIN, // the beginning of a symbol
|
172
|
+
YP_TOKEN_TILDE, // ~ or ~@
|
173
|
+
YP_TOKEN_UAMPERSAND, // unary &
|
174
|
+
YP_TOKEN_UCOLON_COLON, // unary ::
|
175
|
+
YP_TOKEN_UDOT_DOT, // unary ..
|
176
|
+
YP_TOKEN_UDOT_DOT_DOT, // unary ...
|
177
|
+
YP_TOKEN_UMINUS, // -@
|
178
|
+
YP_TOKEN_UMINUS_NUM, // -@ for a number
|
179
|
+
YP_TOKEN_UPLUS, // +@
|
180
|
+
YP_TOKEN_USTAR, // unary *
|
181
|
+
YP_TOKEN_USTAR_STAR, // unary **
|
182
|
+
YP_TOKEN_WORDS_SEP, // a separator between words in a list
|
183
|
+
YP_TOKEN___END__, // marker for the point in the file at which the parser should stop
|
184
|
+
YP_TOKEN_MAXIMUM, // the maximum token value
|
185
|
+
} yp_token_type_t;
|
186
|
+
|
187
|
+
// This struct represents a token in the Ruby source. We use it to track both
|
188
|
+
// type and location information.
|
189
|
+
typedef struct {
|
190
|
+
yp_token_type_t type;
|
191
|
+
const char *start;
|
192
|
+
const char *end;
|
193
|
+
} yp_token_t;
|
194
|
+
|
195
|
+
// This represents a range of bytes in the source string to which a node or
|
196
|
+
// token corresponds.
|
197
|
+
typedef struct {
|
198
|
+
const char *start;
|
199
|
+
const char *end;
|
200
|
+
} yp_location_t;
|
201
|
+
|
202
|
+
typedef struct {
|
203
|
+
yp_location_t *locations;
|
204
|
+
size_t size;
|
205
|
+
size_t capacity;
|
206
|
+
} yp_location_list_t;
|
207
|
+
|
208
|
+
struct yp_node;
|
209
|
+
|
210
|
+
typedef struct yp_node_list {
|
211
|
+
struct yp_node **nodes;
|
212
|
+
size_t size;
|
213
|
+
size_t capacity;
|
214
|
+
} yp_node_list_t;
|
215
|
+
|
216
|
+
enum yp_node_type {
|
217
|
+
YP_NODE_ALIAS_NODE = 1,
|
218
|
+
YP_NODE_ALTERNATION_PATTERN_NODE = 2,
|
219
|
+
YP_NODE_AND_NODE = 3,
|
220
|
+
YP_NODE_ARGUMENTS_NODE = 4,
|
221
|
+
YP_NODE_ARRAY_NODE = 5,
|
222
|
+
YP_NODE_ARRAY_PATTERN_NODE = 6,
|
223
|
+
YP_NODE_ASSOC_NODE = 7,
|
224
|
+
YP_NODE_ASSOC_SPLAT_NODE = 8,
|
225
|
+
YP_NODE_BACK_REFERENCE_READ_NODE = 9,
|
226
|
+
YP_NODE_BEGIN_NODE = 10,
|
227
|
+
YP_NODE_BLOCK_ARGUMENT_NODE = 11,
|
228
|
+
YP_NODE_BLOCK_NODE = 12,
|
229
|
+
YP_NODE_BLOCK_PARAMETER_NODE = 13,
|
230
|
+
YP_NODE_BLOCK_PARAMETERS_NODE = 14,
|
231
|
+
YP_NODE_BREAK_NODE = 15,
|
232
|
+
YP_NODE_CALL_NODE = 16,
|
233
|
+
YP_NODE_CALL_OPERATOR_AND_WRITE_NODE = 17,
|
234
|
+
YP_NODE_CALL_OPERATOR_OR_WRITE_NODE = 18,
|
235
|
+
YP_NODE_CALL_OPERATOR_WRITE_NODE = 19,
|
236
|
+
YP_NODE_CAPTURE_PATTERN_NODE = 20,
|
237
|
+
YP_NODE_CASE_NODE = 21,
|
238
|
+
YP_NODE_CLASS_NODE = 22,
|
239
|
+
YP_NODE_CLASS_VARIABLE_OPERATOR_AND_WRITE_NODE = 23,
|
240
|
+
YP_NODE_CLASS_VARIABLE_OPERATOR_OR_WRITE_NODE = 24,
|
241
|
+
YP_NODE_CLASS_VARIABLE_OPERATOR_WRITE_NODE = 25,
|
242
|
+
YP_NODE_CLASS_VARIABLE_READ_NODE = 26,
|
243
|
+
YP_NODE_CLASS_VARIABLE_WRITE_NODE = 27,
|
244
|
+
YP_NODE_CONSTANT_OPERATOR_AND_WRITE_NODE = 28,
|
245
|
+
YP_NODE_CONSTANT_OPERATOR_OR_WRITE_NODE = 29,
|
246
|
+
YP_NODE_CONSTANT_OPERATOR_WRITE_NODE = 30,
|
247
|
+
YP_NODE_CONSTANT_PATH_NODE = 31,
|
248
|
+
YP_NODE_CONSTANT_PATH_OPERATOR_AND_WRITE_NODE = 32,
|
249
|
+
YP_NODE_CONSTANT_PATH_OPERATOR_OR_WRITE_NODE = 33,
|
250
|
+
YP_NODE_CONSTANT_PATH_OPERATOR_WRITE_NODE = 34,
|
251
|
+
YP_NODE_CONSTANT_PATH_WRITE_NODE = 35,
|
252
|
+
YP_NODE_CONSTANT_READ_NODE = 36,
|
253
|
+
YP_NODE_CONSTANT_WRITE_NODE = 37,
|
254
|
+
YP_NODE_DEF_NODE = 38,
|
255
|
+
YP_NODE_DEFINED_NODE = 39,
|
256
|
+
YP_NODE_ELSE_NODE = 40,
|
257
|
+
YP_NODE_EMBEDDED_STATEMENTS_NODE = 41,
|
258
|
+
YP_NODE_EMBEDDED_VARIABLE_NODE = 42,
|
259
|
+
YP_NODE_ENSURE_NODE = 43,
|
260
|
+
YP_NODE_FALSE_NODE = 44,
|
261
|
+
YP_NODE_FIND_PATTERN_NODE = 45,
|
262
|
+
YP_NODE_FLOAT_NODE = 46,
|
263
|
+
YP_NODE_FOR_NODE = 47,
|
264
|
+
YP_NODE_FORWARDING_ARGUMENTS_NODE = 48,
|
265
|
+
YP_NODE_FORWARDING_PARAMETER_NODE = 49,
|
266
|
+
YP_NODE_FORWARDING_SUPER_NODE = 50,
|
267
|
+
YP_NODE_GLOBAL_VARIABLE_OPERATOR_AND_WRITE_NODE = 51,
|
268
|
+
YP_NODE_GLOBAL_VARIABLE_OPERATOR_OR_WRITE_NODE = 52,
|
269
|
+
YP_NODE_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE = 53,
|
270
|
+
YP_NODE_GLOBAL_VARIABLE_READ_NODE = 54,
|
271
|
+
YP_NODE_GLOBAL_VARIABLE_WRITE_NODE = 55,
|
272
|
+
YP_NODE_HASH_NODE = 56,
|
273
|
+
YP_NODE_HASH_PATTERN_NODE = 57,
|
274
|
+
YP_NODE_IF_NODE = 58,
|
275
|
+
YP_NODE_IMAGINARY_NODE = 59,
|
276
|
+
YP_NODE_IN_NODE = 60,
|
277
|
+
YP_NODE_INSTANCE_VARIABLE_OPERATOR_AND_WRITE_NODE = 61,
|
278
|
+
YP_NODE_INSTANCE_VARIABLE_OPERATOR_OR_WRITE_NODE = 62,
|
279
|
+
YP_NODE_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE = 63,
|
280
|
+
YP_NODE_INSTANCE_VARIABLE_READ_NODE = 64,
|
281
|
+
YP_NODE_INSTANCE_VARIABLE_WRITE_NODE = 65,
|
282
|
+
YP_NODE_INTEGER_NODE = 66,
|
283
|
+
YP_NODE_INTERPOLATED_REGULAR_EXPRESSION_NODE = 67,
|
284
|
+
YP_NODE_INTERPOLATED_STRING_NODE = 68,
|
285
|
+
YP_NODE_INTERPOLATED_SYMBOL_NODE = 69,
|
286
|
+
YP_NODE_INTERPOLATED_X_STRING_NODE = 70,
|
287
|
+
YP_NODE_KEYWORD_HASH_NODE = 71,
|
288
|
+
YP_NODE_KEYWORD_PARAMETER_NODE = 72,
|
289
|
+
YP_NODE_KEYWORD_REST_PARAMETER_NODE = 73,
|
290
|
+
YP_NODE_LAMBDA_NODE = 74,
|
291
|
+
YP_NODE_LOCAL_VARIABLE_OPERATOR_AND_WRITE_NODE = 75,
|
292
|
+
YP_NODE_LOCAL_VARIABLE_OPERATOR_OR_WRITE_NODE = 76,
|
293
|
+
YP_NODE_LOCAL_VARIABLE_OPERATOR_WRITE_NODE = 77,
|
294
|
+
YP_NODE_LOCAL_VARIABLE_READ_NODE = 78,
|
295
|
+
YP_NODE_LOCAL_VARIABLE_WRITE_NODE = 79,
|
296
|
+
YP_NODE_MATCH_PREDICATE_NODE = 80,
|
297
|
+
YP_NODE_MATCH_REQUIRED_NODE = 81,
|
298
|
+
YP_NODE_MISSING_NODE = 82,
|
299
|
+
YP_NODE_MODULE_NODE = 83,
|
300
|
+
YP_NODE_MULTI_WRITE_NODE = 84,
|
301
|
+
YP_NODE_NEXT_NODE = 85,
|
302
|
+
YP_NODE_NIL_NODE = 86,
|
303
|
+
YP_NODE_NO_KEYWORDS_PARAMETER_NODE = 87,
|
304
|
+
YP_NODE_NUMBERED_REFERENCE_READ_NODE = 88,
|
305
|
+
YP_NODE_OPTIONAL_PARAMETER_NODE = 89,
|
306
|
+
YP_NODE_OR_NODE = 90,
|
307
|
+
YP_NODE_PARAMETERS_NODE = 91,
|
308
|
+
YP_NODE_PARENTHESES_NODE = 92,
|
309
|
+
YP_NODE_PINNED_EXPRESSION_NODE = 93,
|
310
|
+
YP_NODE_PINNED_VARIABLE_NODE = 94,
|
311
|
+
YP_NODE_POST_EXECUTION_NODE = 95,
|
312
|
+
YP_NODE_PRE_EXECUTION_NODE = 96,
|
313
|
+
YP_NODE_PROGRAM_NODE = 97,
|
314
|
+
YP_NODE_RANGE_NODE = 98,
|
315
|
+
YP_NODE_RATIONAL_NODE = 99,
|
316
|
+
YP_NODE_REDO_NODE = 100,
|
317
|
+
YP_NODE_REGULAR_EXPRESSION_NODE = 101,
|
318
|
+
YP_NODE_REQUIRED_DESTRUCTURED_PARAMETER_NODE = 102,
|
319
|
+
YP_NODE_REQUIRED_PARAMETER_NODE = 103,
|
320
|
+
YP_NODE_RESCUE_MODIFIER_NODE = 104,
|
321
|
+
YP_NODE_RESCUE_NODE = 105,
|
322
|
+
YP_NODE_REST_PARAMETER_NODE = 106,
|
323
|
+
YP_NODE_RETRY_NODE = 107,
|
324
|
+
YP_NODE_RETURN_NODE = 108,
|
325
|
+
YP_NODE_SELF_NODE = 109,
|
326
|
+
YP_NODE_SINGLETON_CLASS_NODE = 110,
|
327
|
+
YP_NODE_SOURCE_ENCODING_NODE = 111,
|
328
|
+
YP_NODE_SOURCE_FILE_NODE = 112,
|
329
|
+
YP_NODE_SOURCE_LINE_NODE = 113,
|
330
|
+
YP_NODE_SPLAT_NODE = 114,
|
331
|
+
YP_NODE_STATEMENTS_NODE = 115,
|
332
|
+
YP_NODE_STRING_CONCAT_NODE = 116,
|
333
|
+
YP_NODE_STRING_NODE = 117,
|
334
|
+
YP_NODE_SUPER_NODE = 118,
|
335
|
+
YP_NODE_SYMBOL_NODE = 119,
|
336
|
+
YP_NODE_TRUE_NODE = 120,
|
337
|
+
YP_NODE_UNDEF_NODE = 121,
|
338
|
+
YP_NODE_UNLESS_NODE = 122,
|
339
|
+
YP_NODE_UNTIL_NODE = 123,
|
340
|
+
YP_NODE_WHEN_NODE = 124,
|
341
|
+
YP_NODE_WHILE_NODE = 125,
|
342
|
+
YP_NODE_X_STRING_NODE = 126,
|
343
|
+
YP_NODE_YIELD_NODE = 127,
|
344
|
+
};
|
345
|
+
|
346
|
+
typedef uint16_t yp_node_type_t;
|
347
|
+
typedef uint16_t yp_node_flags_t;
|
348
|
+
|
349
|
+
// We store the flags enum in every node in the tree
|
350
|
+
static const uint16_t YP_NODE_FLAG_NEWLINE = 0x1;
|
351
|
+
|
352
|
+
// For easy access, we define some macros to check node type
|
353
|
+
#define YP_NODE_TYPE(node) ((enum yp_node_type)node->type)
|
354
|
+
#define YP_NODE_TYPE_P(node, type) (YP_NODE_TYPE(node) == (type))
|
355
|
+
|
356
|
+
// This is the overall tagged union representing a node in the syntax tree.
|
357
|
+
typedef struct yp_node {
|
358
|
+
// This represents the type of the node. It somewhat maps to the nodes that
|
359
|
+
// existed in the original grammar and ripper, but it's not a 1:1 mapping.
|
360
|
+
yp_node_type_t type;
|
361
|
+
|
362
|
+
// This represents any flags on the node. Currently, this is only a newline
|
363
|
+
// flag
|
364
|
+
yp_node_flags_t flags;
|
365
|
+
|
366
|
+
// This is the location of the node in the source. It's a range of bytes
|
367
|
+
// containing a start and an end.
|
368
|
+
yp_location_t location;
|
369
|
+
} yp_node_t;
|
370
|
+
|
371
|
+
// AliasNode
|
372
|
+
typedef struct yp_alias_node {
|
373
|
+
yp_node_t base;
|
374
|
+
struct yp_node *new_name;
|
375
|
+
struct yp_node *old_name;
|
376
|
+
yp_location_t keyword_loc;
|
377
|
+
} yp_alias_node_t;
|
378
|
+
|
379
|
+
// AlternationPatternNode
|
380
|
+
typedef struct yp_alternation_pattern_node {
|
381
|
+
yp_node_t base;
|
382
|
+
struct yp_node *left;
|
383
|
+
struct yp_node *right;
|
384
|
+
yp_location_t operator_loc;
|
385
|
+
} yp_alternation_pattern_node_t;
|
386
|
+
|
387
|
+
// AndNode
|
388
|
+
typedef struct yp_and_node {
|
389
|
+
yp_node_t base;
|
390
|
+
struct yp_node *left;
|
391
|
+
struct yp_node *right;
|
392
|
+
yp_location_t operator_loc;
|
393
|
+
} yp_and_node_t;
|
394
|
+
|
395
|
+
// ArgumentsNode
|
396
|
+
typedef struct yp_arguments_node {
|
397
|
+
yp_node_t base;
|
398
|
+
struct yp_node_list arguments;
|
399
|
+
} yp_arguments_node_t;
|
400
|
+
|
401
|
+
// ArrayNode
|
402
|
+
typedef struct yp_array_node {
|
403
|
+
yp_node_t base;
|
404
|
+
struct yp_node_list elements;
|
405
|
+
yp_location_t opening_loc;
|
406
|
+
yp_location_t closing_loc;
|
407
|
+
} yp_array_node_t;
|
408
|
+
|
409
|
+
// ArrayPatternNode
|
410
|
+
typedef struct yp_array_pattern_node {
|
411
|
+
yp_node_t base;
|
412
|
+
struct yp_node *constant;
|
413
|
+
struct yp_node_list requireds;
|
414
|
+
struct yp_node *rest;
|
415
|
+
struct yp_node_list posts;
|
416
|
+
yp_location_t opening_loc;
|
417
|
+
yp_location_t closing_loc;
|
418
|
+
} yp_array_pattern_node_t;
|
419
|
+
|
420
|
+
// AssocNode
|
421
|
+
typedef struct yp_assoc_node {
|
422
|
+
yp_node_t base;
|
423
|
+
struct yp_node *key;
|
424
|
+
struct yp_node *value;
|
425
|
+
yp_location_t operator_loc;
|
426
|
+
} yp_assoc_node_t;
|
427
|
+
|
428
|
+
// AssocSplatNode
|
429
|
+
typedef struct yp_assoc_splat_node {
|
430
|
+
yp_node_t base;
|
431
|
+
struct yp_node *value;
|
432
|
+
yp_location_t operator_loc;
|
433
|
+
} yp_assoc_splat_node_t;
|
434
|
+
|
435
|
+
// BackReferenceReadNode
|
436
|
+
typedef struct yp_back_reference_read_node {
|
437
|
+
yp_node_t base;
|
438
|
+
} yp_back_reference_read_node_t;
|
439
|
+
|
440
|
+
// BeginNode
|
441
|
+
typedef struct yp_begin_node {
|
442
|
+
yp_node_t base;
|
443
|
+
yp_location_t begin_keyword_loc;
|
444
|
+
struct yp_statements_node *statements;
|
445
|
+
struct yp_rescue_node *rescue_clause;
|
446
|
+
struct yp_else_node *else_clause;
|
447
|
+
struct yp_ensure_node *ensure_clause;
|
448
|
+
yp_location_t end_keyword_loc;
|
449
|
+
} yp_begin_node_t;
|
450
|
+
|
451
|
+
// BlockArgumentNode
|
452
|
+
typedef struct yp_block_argument_node {
|
453
|
+
yp_node_t base;
|
454
|
+
struct yp_node *expression;
|
455
|
+
yp_location_t operator_loc;
|
456
|
+
} yp_block_argument_node_t;
|
457
|
+
|
458
|
+
// BlockNode
|
459
|
+
typedef struct yp_block_node {
|
460
|
+
yp_node_t base;
|
461
|
+
yp_constant_id_list_t locals;
|
462
|
+
struct yp_block_parameters_node *parameters;
|
463
|
+
struct yp_node *statements;
|
464
|
+
yp_location_t opening_loc;
|
465
|
+
yp_location_t closing_loc;
|
466
|
+
} yp_block_node_t;
|
467
|
+
|
468
|
+
// BlockParameterNode
|
469
|
+
typedef struct yp_block_parameter_node {
|
470
|
+
yp_node_t base;
|
471
|
+
yp_location_t name_loc;
|
472
|
+
yp_location_t operator_loc;
|
473
|
+
} yp_block_parameter_node_t;
|
474
|
+
|
475
|
+
// BlockParametersNode
|
476
|
+
typedef struct yp_block_parameters_node {
|
477
|
+
yp_node_t base;
|
478
|
+
struct yp_parameters_node *parameters;
|
479
|
+
yp_location_list_t locals;
|
480
|
+
yp_location_t opening_loc;
|
481
|
+
yp_location_t closing_loc;
|
482
|
+
} yp_block_parameters_node_t;
|
483
|
+
|
484
|
+
// BreakNode
|
485
|
+
typedef struct yp_break_node {
|
486
|
+
yp_node_t base;
|
487
|
+
struct yp_arguments_node *arguments;
|
488
|
+
yp_location_t keyword_loc;
|
489
|
+
} yp_break_node_t;
|
490
|
+
|
491
|
+
// CallNode
|
492
|
+
typedef struct yp_call_node {
|
493
|
+
yp_node_t base;
|
494
|
+
struct yp_node *receiver;
|
495
|
+
yp_location_t operator_loc;
|
496
|
+
yp_location_t message_loc;
|
497
|
+
yp_location_t opening_loc;
|
498
|
+
struct yp_arguments_node *arguments;
|
499
|
+
yp_location_t closing_loc;
|
500
|
+
struct yp_block_node *block;
|
501
|
+
uint32_t flags;
|
502
|
+
yp_string_t name;
|
503
|
+
} yp_call_node_t;
|
504
|
+
|
505
|
+
// CallOperatorAndWriteNode
|
506
|
+
typedef struct yp_call_operator_and_write_node {
|
507
|
+
yp_node_t base;
|
508
|
+
struct yp_call_node *target;
|
509
|
+
yp_location_t operator_loc;
|
510
|
+
struct yp_node *value;
|
511
|
+
} yp_call_operator_and_write_node_t;
|
512
|
+
|
513
|
+
// CallOperatorOrWriteNode
|
514
|
+
typedef struct yp_call_operator_or_write_node {
|
515
|
+
yp_node_t base;
|
516
|
+
struct yp_call_node *target;
|
517
|
+
struct yp_node *value;
|
518
|
+
yp_location_t operator_loc;
|
519
|
+
} yp_call_operator_or_write_node_t;
|
520
|
+
|
521
|
+
// CallOperatorWriteNode
|
522
|
+
typedef struct yp_call_operator_write_node {
|
523
|
+
yp_node_t base;
|
524
|
+
struct yp_call_node *target;
|
525
|
+
yp_location_t operator_loc;
|
526
|
+
struct yp_node *value;
|
527
|
+
yp_constant_id_t operator_id;
|
528
|
+
} yp_call_operator_write_node_t;
|
529
|
+
|
530
|
+
// CapturePatternNode
|
531
|
+
typedef struct yp_capture_pattern_node {
|
532
|
+
yp_node_t base;
|
533
|
+
struct yp_node *value;
|
534
|
+
struct yp_node *target;
|
535
|
+
yp_location_t operator_loc;
|
536
|
+
} yp_capture_pattern_node_t;
|
537
|
+
|
538
|
+
// CaseNode
|
539
|
+
typedef struct yp_case_node {
|
540
|
+
yp_node_t base;
|
541
|
+
struct yp_node *predicate;
|
542
|
+
struct yp_node_list conditions;
|
543
|
+
struct yp_else_node *consequent;
|
544
|
+
yp_location_t case_keyword_loc;
|
545
|
+
yp_location_t end_keyword_loc;
|
546
|
+
} yp_case_node_t;
|
547
|
+
|
548
|
+
// ClassNode
|
549
|
+
typedef struct yp_class_node {
|
550
|
+
yp_node_t base;
|
551
|
+
yp_constant_id_list_t locals;
|
552
|
+
yp_location_t class_keyword_loc;
|
553
|
+
struct yp_node *constant_path;
|
554
|
+
yp_location_t inheritance_operator_loc;
|
555
|
+
struct yp_node *superclass;
|
556
|
+
struct yp_node *statements;
|
557
|
+
yp_location_t end_keyword_loc;
|
558
|
+
} yp_class_node_t;
|
559
|
+
|
560
|
+
// ClassVariableOperatorAndWriteNode
|
561
|
+
typedef struct yp_class_variable_operator_and_write_node {
|
562
|
+
yp_node_t base;
|
563
|
+
yp_location_t name_loc;
|
564
|
+
yp_location_t operator_loc;
|
565
|
+
struct yp_node *value;
|
566
|
+
} yp_class_variable_operator_and_write_node_t;
|
567
|
+
|
568
|
+
// ClassVariableOperatorOrWriteNode
|
569
|
+
typedef struct yp_class_variable_operator_or_write_node {
|
570
|
+
yp_node_t base;
|
571
|
+
yp_location_t name_loc;
|
572
|
+
yp_location_t operator_loc;
|
573
|
+
struct yp_node *value;
|
574
|
+
} yp_class_variable_operator_or_write_node_t;
|
575
|
+
|
576
|
+
// ClassVariableOperatorWriteNode
|
577
|
+
typedef struct yp_class_variable_operator_write_node {
|
578
|
+
yp_node_t base;
|
579
|
+
yp_location_t name_loc;
|
580
|
+
yp_location_t operator_loc;
|
581
|
+
struct yp_node *value;
|
582
|
+
yp_constant_id_t operator;
|
583
|
+
} yp_class_variable_operator_write_node_t;
|
584
|
+
|
585
|
+
// ClassVariableReadNode
|
586
|
+
typedef struct yp_class_variable_read_node {
|
587
|
+
yp_node_t base;
|
588
|
+
} yp_class_variable_read_node_t;
|
589
|
+
|
590
|
+
// ClassVariableWriteNode
|
591
|
+
typedef struct yp_class_variable_write_node {
|
592
|
+
yp_node_t base;
|
593
|
+
yp_location_t name_loc;
|
594
|
+
struct yp_node *value;
|
595
|
+
yp_location_t operator_loc;
|
596
|
+
} yp_class_variable_write_node_t;
|
597
|
+
|
598
|
+
// ConstantOperatorAndWriteNode
|
599
|
+
typedef struct yp_constant_operator_and_write_node {
|
600
|
+
yp_node_t base;
|
601
|
+
yp_location_t name_loc;
|
602
|
+
yp_location_t operator_loc;
|
603
|
+
struct yp_node *value;
|
604
|
+
} yp_constant_operator_and_write_node_t;
|
605
|
+
|
606
|
+
// ConstantOperatorOrWriteNode
|
607
|
+
typedef struct yp_constant_operator_or_write_node {
|
608
|
+
yp_node_t base;
|
609
|
+
yp_location_t name_loc;
|
610
|
+
yp_location_t operator_loc;
|
611
|
+
struct yp_node *value;
|
612
|
+
} yp_constant_operator_or_write_node_t;
|
613
|
+
|
614
|
+
// ConstantOperatorWriteNode
|
615
|
+
typedef struct yp_constant_operator_write_node {
|
616
|
+
yp_node_t base;
|
617
|
+
yp_location_t name_loc;
|
618
|
+
yp_location_t operator_loc;
|
619
|
+
struct yp_node *value;
|
620
|
+
yp_constant_id_t operator;
|
621
|
+
} yp_constant_operator_write_node_t;
|
622
|
+
|
623
|
+
// ConstantPathNode
|
624
|
+
typedef struct yp_constant_path_node {
|
625
|
+
yp_node_t base;
|
626
|
+
struct yp_node *parent;
|
627
|
+
struct yp_node *child;
|
628
|
+
yp_location_t delimiter_loc;
|
629
|
+
} yp_constant_path_node_t;
|
630
|
+
|
631
|
+
// ConstantPathOperatorAndWriteNode
|
632
|
+
typedef struct yp_constant_path_operator_and_write_node {
|
633
|
+
yp_node_t base;
|
634
|
+
struct yp_constant_path_node *target;
|
635
|
+
yp_location_t operator_loc;
|
636
|
+
struct yp_node *value;
|
637
|
+
} yp_constant_path_operator_and_write_node_t;
|
638
|
+
|
639
|
+
// ConstantPathOperatorOrWriteNode
|
640
|
+
typedef struct yp_constant_path_operator_or_write_node {
|
641
|
+
yp_node_t base;
|
642
|
+
struct yp_constant_path_node *target;
|
643
|
+
yp_location_t operator_loc;
|
644
|
+
struct yp_node *value;
|
645
|
+
} yp_constant_path_operator_or_write_node_t;
|
646
|
+
|
647
|
+
// ConstantPathOperatorWriteNode
|
648
|
+
typedef struct yp_constant_path_operator_write_node {
|
649
|
+
yp_node_t base;
|
650
|
+
struct yp_constant_path_node *target;
|
651
|
+
yp_location_t operator_loc;
|
652
|
+
struct yp_node *value;
|
653
|
+
yp_constant_id_t operator;
|
654
|
+
} yp_constant_path_operator_write_node_t;
|
655
|
+
|
656
|
+
// ConstantPathWriteNode
|
657
|
+
typedef struct yp_constant_path_write_node {
|
658
|
+
yp_node_t base;
|
659
|
+
struct yp_constant_path_node *target;
|
660
|
+
yp_location_t operator_loc;
|
661
|
+
struct yp_node *value;
|
662
|
+
} yp_constant_path_write_node_t;
|
663
|
+
|
664
|
+
// ConstantReadNode
|
665
|
+
typedef struct yp_constant_read_node {
|
666
|
+
yp_node_t base;
|
667
|
+
} yp_constant_read_node_t;
|
668
|
+
|
669
|
+
// ConstantWriteNode
|
670
|
+
typedef struct yp_constant_write_node {
|
671
|
+
yp_node_t base;
|
672
|
+
yp_location_t name_loc;
|
673
|
+
struct yp_node *value;
|
674
|
+
yp_location_t operator_loc;
|
675
|
+
} yp_constant_write_node_t;
|
676
|
+
|
677
|
+
// DefNode
|
678
|
+
typedef struct yp_def_node {
|
679
|
+
yp_node_t base;
|
680
|
+
yp_location_t name_loc;
|
681
|
+
struct yp_node *receiver;
|
682
|
+
struct yp_parameters_node *parameters;
|
683
|
+
struct yp_node *statements;
|
684
|
+
yp_constant_id_list_t locals;
|
685
|
+
yp_location_t def_keyword_loc;
|
686
|
+
yp_location_t operator_loc;
|
687
|
+
yp_location_t lparen_loc;
|
688
|
+
yp_location_t rparen_loc;
|
689
|
+
yp_location_t equal_loc;
|
690
|
+
yp_location_t end_keyword_loc;
|
691
|
+
} yp_def_node_t;
|
692
|
+
|
693
|
+
// DefinedNode
|
694
|
+
typedef struct yp_defined_node {
|
695
|
+
yp_node_t base;
|
696
|
+
yp_location_t lparen_loc;
|
697
|
+
struct yp_node *value;
|
698
|
+
yp_location_t rparen_loc;
|
699
|
+
yp_location_t keyword_loc;
|
700
|
+
} yp_defined_node_t;
|
701
|
+
|
702
|
+
// ElseNode
|
703
|
+
typedef struct yp_else_node {
|
704
|
+
yp_node_t base;
|
705
|
+
yp_location_t else_keyword_loc;
|
706
|
+
struct yp_statements_node *statements;
|
707
|
+
yp_location_t end_keyword_loc;
|
708
|
+
} yp_else_node_t;
|
709
|
+
|
710
|
+
// EmbeddedStatementsNode
|
711
|
+
typedef struct yp_embedded_statements_node {
|
712
|
+
yp_node_t base;
|
713
|
+
yp_location_t opening_loc;
|
714
|
+
struct yp_statements_node *statements;
|
715
|
+
yp_location_t closing_loc;
|
716
|
+
} yp_embedded_statements_node_t;
|
717
|
+
|
718
|
+
// EmbeddedVariableNode
|
719
|
+
typedef struct yp_embedded_variable_node {
|
720
|
+
yp_node_t base;
|
721
|
+
yp_location_t operator_loc;
|
722
|
+
struct yp_node *variable;
|
723
|
+
} yp_embedded_variable_node_t;
|
724
|
+
|
725
|
+
// EnsureNode
|
726
|
+
typedef struct yp_ensure_node {
|
727
|
+
yp_node_t base;
|
728
|
+
yp_location_t ensure_keyword_loc;
|
729
|
+
struct yp_statements_node *statements;
|
730
|
+
yp_location_t end_keyword_loc;
|
731
|
+
} yp_ensure_node_t;
|
732
|
+
|
733
|
+
// FalseNode
|
734
|
+
typedef struct yp_false_node {
|
735
|
+
yp_node_t base;
|
736
|
+
} yp_false_node_t;
|
737
|
+
|
738
|
+
// FindPatternNode
|
739
|
+
typedef struct yp_find_pattern_node {
|
740
|
+
yp_node_t base;
|
741
|
+
struct yp_node *constant;
|
742
|
+
struct yp_node *left;
|
743
|
+
struct yp_node_list requireds;
|
744
|
+
struct yp_node *right;
|
745
|
+
yp_location_t opening_loc;
|
746
|
+
yp_location_t closing_loc;
|
747
|
+
} yp_find_pattern_node_t;
|
748
|
+
|
749
|
+
// FloatNode
|
750
|
+
typedef struct yp_float_node {
|
751
|
+
yp_node_t base;
|
752
|
+
} yp_float_node_t;
|
753
|
+
|
754
|
+
// ForNode
|
755
|
+
typedef struct yp_for_node {
|
756
|
+
yp_node_t base;
|
757
|
+
struct yp_node *index;
|
758
|
+
struct yp_node *collection;
|
759
|
+
struct yp_statements_node *statements;
|
760
|
+
yp_location_t for_keyword_loc;
|
761
|
+
yp_location_t in_keyword_loc;
|
762
|
+
yp_location_t do_keyword_loc;
|
763
|
+
yp_location_t end_keyword_loc;
|
764
|
+
} yp_for_node_t;
|
765
|
+
|
766
|
+
// ForwardingArgumentsNode
|
767
|
+
typedef struct yp_forwarding_arguments_node {
|
768
|
+
yp_node_t base;
|
769
|
+
} yp_forwarding_arguments_node_t;
|
770
|
+
|
771
|
+
// ForwardingParameterNode
|
772
|
+
typedef struct yp_forwarding_parameter_node {
|
773
|
+
yp_node_t base;
|
774
|
+
} yp_forwarding_parameter_node_t;
|
775
|
+
|
776
|
+
// ForwardingSuperNode
|
777
|
+
typedef struct yp_forwarding_super_node {
|
778
|
+
yp_node_t base;
|
779
|
+
struct yp_block_node *block;
|
780
|
+
} yp_forwarding_super_node_t;
|
781
|
+
|
782
|
+
// GlobalVariableOperatorAndWriteNode
|
783
|
+
typedef struct yp_global_variable_operator_and_write_node {
|
784
|
+
yp_node_t base;
|
785
|
+
yp_location_t name_loc;
|
786
|
+
yp_location_t operator_loc;
|
787
|
+
struct yp_node *value;
|
788
|
+
} yp_global_variable_operator_and_write_node_t;
|
789
|
+
|
790
|
+
// GlobalVariableOperatorOrWriteNode
|
791
|
+
typedef struct yp_global_variable_operator_or_write_node {
|
792
|
+
yp_node_t base;
|
793
|
+
yp_location_t name_loc;
|
794
|
+
yp_location_t operator_loc;
|
795
|
+
struct yp_node *value;
|
796
|
+
} yp_global_variable_operator_or_write_node_t;
|
797
|
+
|
798
|
+
// GlobalVariableOperatorWriteNode
|
799
|
+
typedef struct yp_global_variable_operator_write_node {
|
800
|
+
yp_node_t base;
|
801
|
+
yp_location_t name_loc;
|
802
|
+
yp_location_t operator_loc;
|
803
|
+
struct yp_node *value;
|
804
|
+
yp_constant_id_t operator;
|
805
|
+
} yp_global_variable_operator_write_node_t;
|
806
|
+
|
807
|
+
// GlobalVariableReadNode
|
808
|
+
typedef struct yp_global_variable_read_node {
|
809
|
+
yp_node_t base;
|
810
|
+
} yp_global_variable_read_node_t;
|
811
|
+
|
812
|
+
// GlobalVariableWriteNode
|
813
|
+
typedef struct yp_global_variable_write_node {
|
814
|
+
yp_node_t base;
|
815
|
+
yp_location_t name_loc;
|
816
|
+
yp_location_t operator_loc;
|
817
|
+
struct yp_node *value;
|
818
|
+
} yp_global_variable_write_node_t;
|
819
|
+
|
820
|
+
// HashNode
|
821
|
+
typedef struct yp_hash_node {
|
822
|
+
yp_node_t base;
|
823
|
+
yp_location_t opening_loc;
|
824
|
+
struct yp_node_list elements;
|
825
|
+
yp_location_t closing_loc;
|
826
|
+
} yp_hash_node_t;
|
827
|
+
|
828
|
+
// HashPatternNode
|
829
|
+
typedef struct yp_hash_pattern_node {
|
830
|
+
yp_node_t base;
|
831
|
+
struct yp_node *constant;
|
832
|
+
struct yp_node_list assocs;
|
833
|
+
struct yp_node *kwrest;
|
834
|
+
yp_location_t opening_loc;
|
835
|
+
yp_location_t closing_loc;
|
836
|
+
} yp_hash_pattern_node_t;
|
837
|
+
|
838
|
+
// IfNode
|
839
|
+
typedef struct yp_if_node {
|
840
|
+
yp_node_t base;
|
841
|
+
yp_location_t if_keyword_loc;
|
842
|
+
struct yp_node *predicate;
|
843
|
+
struct yp_statements_node *statements;
|
844
|
+
struct yp_node *consequent;
|
845
|
+
yp_location_t end_keyword_loc;
|
846
|
+
} yp_if_node_t;
|
847
|
+
|
848
|
+
// ImaginaryNode
|
849
|
+
typedef struct yp_imaginary_node {
|
850
|
+
yp_node_t base;
|
851
|
+
struct yp_node *numeric;
|
852
|
+
} yp_imaginary_node_t;
|
853
|
+
|
854
|
+
// InNode
|
855
|
+
typedef struct yp_in_node {
|
856
|
+
yp_node_t base;
|
857
|
+
struct yp_node *pattern;
|
858
|
+
struct yp_statements_node *statements;
|
859
|
+
yp_location_t in_loc;
|
860
|
+
yp_location_t then_loc;
|
861
|
+
} yp_in_node_t;
|
862
|
+
|
863
|
+
// InstanceVariableOperatorAndWriteNode
|
864
|
+
typedef struct yp_instance_variable_operator_and_write_node {
|
865
|
+
yp_node_t base;
|
866
|
+
yp_location_t name_loc;
|
867
|
+
yp_location_t operator_loc;
|
868
|
+
struct yp_node *value;
|
869
|
+
} yp_instance_variable_operator_and_write_node_t;
|
870
|
+
|
871
|
+
// InstanceVariableOperatorOrWriteNode
|
872
|
+
typedef struct yp_instance_variable_operator_or_write_node {
|
873
|
+
yp_node_t base;
|
874
|
+
yp_location_t name_loc;
|
875
|
+
yp_location_t operator_loc;
|
876
|
+
struct yp_node *value;
|
877
|
+
} yp_instance_variable_operator_or_write_node_t;
|
878
|
+
|
879
|
+
// InstanceVariableOperatorWriteNode
|
880
|
+
typedef struct yp_instance_variable_operator_write_node {
|
881
|
+
yp_node_t base;
|
882
|
+
yp_location_t name_loc;
|
883
|
+
yp_location_t operator_loc;
|
884
|
+
struct yp_node *value;
|
885
|
+
yp_constant_id_t operator;
|
886
|
+
} yp_instance_variable_operator_write_node_t;
|
887
|
+
|
888
|
+
// InstanceVariableReadNode
|
889
|
+
typedef struct yp_instance_variable_read_node {
|
890
|
+
yp_node_t base;
|
891
|
+
} yp_instance_variable_read_node_t;
|
892
|
+
|
893
|
+
// InstanceVariableWriteNode
|
894
|
+
typedef struct yp_instance_variable_write_node {
|
895
|
+
yp_node_t base;
|
896
|
+
yp_location_t name_loc;
|
897
|
+
struct yp_node *value;
|
898
|
+
yp_location_t operator_loc;
|
899
|
+
} yp_instance_variable_write_node_t;
|
900
|
+
|
901
|
+
// IntegerNode
|
902
|
+
typedef struct yp_integer_node {
|
903
|
+
yp_node_t base;
|
904
|
+
} yp_integer_node_t;
|
905
|
+
|
906
|
+
// InterpolatedRegularExpressionNode
|
907
|
+
typedef struct yp_interpolated_regular_expression_node {
|
908
|
+
yp_node_t base;
|
909
|
+
yp_location_t opening_loc;
|
910
|
+
struct yp_node_list parts;
|
911
|
+
yp_location_t closing_loc;
|
912
|
+
uint32_t flags;
|
913
|
+
} yp_interpolated_regular_expression_node_t;
|
914
|
+
|
915
|
+
// InterpolatedStringNode
|
916
|
+
typedef struct yp_interpolated_string_node {
|
917
|
+
yp_node_t base;
|
918
|
+
yp_location_t opening_loc;
|
919
|
+
struct yp_node_list parts;
|
920
|
+
yp_location_t closing_loc;
|
921
|
+
} yp_interpolated_string_node_t;
|
922
|
+
|
923
|
+
// InterpolatedSymbolNode
|
924
|
+
typedef struct yp_interpolated_symbol_node {
|
925
|
+
yp_node_t base;
|
926
|
+
yp_location_t opening_loc;
|
927
|
+
struct yp_node_list parts;
|
928
|
+
yp_location_t closing_loc;
|
929
|
+
} yp_interpolated_symbol_node_t;
|
930
|
+
|
931
|
+
// InterpolatedXStringNode
|
932
|
+
typedef struct yp_interpolated_x_string_node {
|
933
|
+
yp_node_t base;
|
934
|
+
yp_location_t opening_loc;
|
935
|
+
struct yp_node_list parts;
|
936
|
+
yp_location_t closing_loc;
|
937
|
+
} yp_interpolated_x_string_node_t;
|
938
|
+
|
939
|
+
// KeywordHashNode
|
940
|
+
typedef struct yp_keyword_hash_node {
|
941
|
+
yp_node_t base;
|
942
|
+
struct yp_node_list elements;
|
943
|
+
} yp_keyword_hash_node_t;
|
944
|
+
|
945
|
+
// KeywordParameterNode
|
946
|
+
typedef struct yp_keyword_parameter_node {
|
947
|
+
yp_node_t base;
|
948
|
+
yp_location_t name_loc;
|
949
|
+
struct yp_node *value;
|
950
|
+
} yp_keyword_parameter_node_t;
|
951
|
+
|
952
|
+
// KeywordRestParameterNode
|
953
|
+
typedef struct yp_keyword_rest_parameter_node {
|
954
|
+
yp_node_t base;
|
955
|
+
yp_location_t operator_loc;
|
956
|
+
yp_location_t name_loc;
|
957
|
+
} yp_keyword_rest_parameter_node_t;
|
958
|
+
|
959
|
+
// LambdaNode
|
960
|
+
typedef struct yp_lambda_node {
|
961
|
+
yp_node_t base;
|
962
|
+
yp_constant_id_list_t locals;
|
963
|
+
yp_location_t opening_loc;
|
964
|
+
struct yp_block_parameters_node *parameters;
|
965
|
+
struct yp_node *statements;
|
966
|
+
} yp_lambda_node_t;
|
967
|
+
|
968
|
+
// LocalVariableOperatorAndWriteNode
|
969
|
+
typedef struct yp_local_variable_operator_and_write_node {
|
970
|
+
yp_node_t base;
|
971
|
+
yp_location_t name_loc;
|
972
|
+
yp_location_t operator_loc;
|
973
|
+
struct yp_node *value;
|
974
|
+
yp_constant_id_t constant_id;
|
975
|
+
} yp_local_variable_operator_and_write_node_t;
|
976
|
+
|
977
|
+
// LocalVariableOperatorOrWriteNode
|
978
|
+
typedef struct yp_local_variable_operator_or_write_node {
|
979
|
+
yp_node_t base;
|
980
|
+
yp_location_t name_loc;
|
981
|
+
yp_location_t operator_loc;
|
982
|
+
struct yp_node *value;
|
983
|
+
yp_constant_id_t constant_id;
|
984
|
+
} yp_local_variable_operator_or_write_node_t;
|
985
|
+
|
986
|
+
// LocalVariableOperatorWriteNode
|
987
|
+
typedef struct yp_local_variable_operator_write_node {
|
988
|
+
yp_node_t base;
|
989
|
+
yp_location_t name_loc;
|
990
|
+
yp_location_t operator_loc;
|
991
|
+
struct yp_node *value;
|
992
|
+
yp_constant_id_t constant_id;
|
993
|
+
yp_constant_id_t operator_id;
|
994
|
+
} yp_local_variable_operator_write_node_t;
|
995
|
+
|
996
|
+
// LocalVariableReadNode
|
997
|
+
typedef struct yp_local_variable_read_node {
|
998
|
+
yp_node_t base;
|
999
|
+
yp_constant_id_t constant_id;
|
1000
|
+
uint32_t depth;
|
1001
|
+
} yp_local_variable_read_node_t;
|
1002
|
+
|
1003
|
+
// LocalVariableWriteNode
|
1004
|
+
typedef struct yp_local_variable_write_node {
|
1005
|
+
yp_node_t base;
|
1006
|
+
yp_constant_id_t constant_id;
|
1007
|
+
uint32_t depth;
|
1008
|
+
struct yp_node *value;
|
1009
|
+
yp_location_t name_loc;
|
1010
|
+
yp_location_t operator_loc;
|
1011
|
+
} yp_local_variable_write_node_t;
|
1012
|
+
|
1013
|
+
// MatchPredicateNode
|
1014
|
+
typedef struct yp_match_predicate_node {
|
1015
|
+
yp_node_t base;
|
1016
|
+
struct yp_node *value;
|
1017
|
+
struct yp_node *pattern;
|
1018
|
+
yp_location_t operator_loc;
|
1019
|
+
} yp_match_predicate_node_t;
|
1020
|
+
|
1021
|
+
// MatchRequiredNode
|
1022
|
+
typedef struct yp_match_required_node {
|
1023
|
+
yp_node_t base;
|
1024
|
+
struct yp_node *value;
|
1025
|
+
struct yp_node *pattern;
|
1026
|
+
yp_location_t operator_loc;
|
1027
|
+
} yp_match_required_node_t;
|
1028
|
+
|
1029
|
+
// MissingNode
|
1030
|
+
typedef struct yp_missing_node {
|
1031
|
+
yp_node_t base;
|
1032
|
+
} yp_missing_node_t;
|
1033
|
+
|
1034
|
+
// ModuleNode
|
1035
|
+
typedef struct yp_module_node {
|
1036
|
+
yp_node_t base;
|
1037
|
+
yp_constant_id_list_t locals;
|
1038
|
+
yp_location_t module_keyword_loc;
|
1039
|
+
struct yp_node *constant_path;
|
1040
|
+
struct yp_node *statements;
|
1041
|
+
yp_location_t end_keyword_loc;
|
1042
|
+
} yp_module_node_t;
|
1043
|
+
|
1044
|
+
// MultiWriteNode
|
1045
|
+
typedef struct yp_multi_write_node {
|
1046
|
+
yp_node_t base;
|
1047
|
+
struct yp_node_list targets;
|
1048
|
+
yp_location_t operator_loc;
|
1049
|
+
struct yp_node *value;
|
1050
|
+
yp_location_t lparen_loc;
|
1051
|
+
yp_location_t rparen_loc;
|
1052
|
+
} yp_multi_write_node_t;
|
1053
|
+
|
1054
|
+
// NextNode
|
1055
|
+
typedef struct yp_next_node {
|
1056
|
+
yp_node_t base;
|
1057
|
+
struct yp_arguments_node *arguments;
|
1058
|
+
yp_location_t keyword_loc;
|
1059
|
+
} yp_next_node_t;
|
1060
|
+
|
1061
|
+
// NilNode
|
1062
|
+
typedef struct yp_nil_node {
|
1063
|
+
yp_node_t base;
|
1064
|
+
} yp_nil_node_t;
|
1065
|
+
|
1066
|
+
// NoKeywordsParameterNode
|
1067
|
+
typedef struct yp_no_keywords_parameter_node {
|
1068
|
+
yp_node_t base;
|
1069
|
+
yp_location_t operator_loc;
|
1070
|
+
yp_location_t keyword_loc;
|
1071
|
+
} yp_no_keywords_parameter_node_t;
|
1072
|
+
|
1073
|
+
// NumberedReferenceReadNode
|
1074
|
+
typedef struct yp_numbered_reference_read_node {
|
1075
|
+
yp_node_t base;
|
1076
|
+
} yp_numbered_reference_read_node_t;
|
1077
|
+
|
1078
|
+
// OptionalParameterNode
|
1079
|
+
typedef struct yp_optional_parameter_node {
|
1080
|
+
yp_node_t base;
|
1081
|
+
yp_constant_id_t constant_id;
|
1082
|
+
yp_location_t name_loc;
|
1083
|
+
yp_location_t operator_loc;
|
1084
|
+
struct yp_node *value;
|
1085
|
+
} yp_optional_parameter_node_t;
|
1086
|
+
|
1087
|
+
// OrNode
|
1088
|
+
typedef struct yp_or_node {
|
1089
|
+
yp_node_t base;
|
1090
|
+
struct yp_node *left;
|
1091
|
+
struct yp_node *right;
|
1092
|
+
yp_location_t operator_loc;
|
1093
|
+
} yp_or_node_t;
|
1094
|
+
|
1095
|
+
// ParametersNode
|
1096
|
+
typedef struct yp_parameters_node {
|
1097
|
+
yp_node_t base;
|
1098
|
+
struct yp_node_list requireds;
|
1099
|
+
struct yp_node_list optionals;
|
1100
|
+
struct yp_node_list posts;
|
1101
|
+
struct yp_rest_parameter_node *rest;
|
1102
|
+
struct yp_node_list keywords;
|
1103
|
+
struct yp_node *keyword_rest;
|
1104
|
+
struct yp_block_parameter_node *block;
|
1105
|
+
} yp_parameters_node_t;
|
1106
|
+
|
1107
|
+
// ParenthesesNode
|
1108
|
+
typedef struct yp_parentheses_node {
|
1109
|
+
yp_node_t base;
|
1110
|
+
struct yp_node *statements;
|
1111
|
+
yp_location_t opening_loc;
|
1112
|
+
yp_location_t closing_loc;
|
1113
|
+
} yp_parentheses_node_t;
|
1114
|
+
|
1115
|
+
// PinnedExpressionNode
|
1116
|
+
typedef struct yp_pinned_expression_node {
|
1117
|
+
yp_node_t base;
|
1118
|
+
struct yp_node *expression;
|
1119
|
+
yp_location_t operator_loc;
|
1120
|
+
yp_location_t lparen_loc;
|
1121
|
+
yp_location_t rparen_loc;
|
1122
|
+
} yp_pinned_expression_node_t;
|
1123
|
+
|
1124
|
+
// PinnedVariableNode
|
1125
|
+
typedef struct yp_pinned_variable_node {
|
1126
|
+
yp_node_t base;
|
1127
|
+
struct yp_node *variable;
|
1128
|
+
yp_location_t operator_loc;
|
1129
|
+
} yp_pinned_variable_node_t;
|
1130
|
+
|
1131
|
+
// PostExecutionNode
|
1132
|
+
typedef struct yp_post_execution_node {
|
1133
|
+
yp_node_t base;
|
1134
|
+
struct yp_statements_node *statements;
|
1135
|
+
yp_location_t keyword_loc;
|
1136
|
+
yp_location_t opening_loc;
|
1137
|
+
yp_location_t closing_loc;
|
1138
|
+
} yp_post_execution_node_t;
|
1139
|
+
|
1140
|
+
// PreExecutionNode
|
1141
|
+
typedef struct yp_pre_execution_node {
|
1142
|
+
yp_node_t base;
|
1143
|
+
struct yp_statements_node *statements;
|
1144
|
+
yp_location_t keyword_loc;
|
1145
|
+
yp_location_t opening_loc;
|
1146
|
+
yp_location_t closing_loc;
|
1147
|
+
} yp_pre_execution_node_t;
|
1148
|
+
|
1149
|
+
// ProgramNode
|
1150
|
+
typedef struct yp_program_node {
|
1151
|
+
yp_node_t base;
|
1152
|
+
yp_constant_id_list_t locals;
|
1153
|
+
struct yp_statements_node *statements;
|
1154
|
+
} yp_program_node_t;
|
1155
|
+
|
1156
|
+
// RangeNode
|
1157
|
+
typedef struct yp_range_node {
|
1158
|
+
yp_node_t base;
|
1159
|
+
struct yp_node *left;
|
1160
|
+
struct yp_node *right;
|
1161
|
+
yp_location_t operator_loc;
|
1162
|
+
uint32_t flags;
|
1163
|
+
} yp_range_node_t;
|
1164
|
+
|
1165
|
+
// RationalNode
|
1166
|
+
typedef struct yp_rational_node {
|
1167
|
+
yp_node_t base;
|
1168
|
+
struct yp_node *numeric;
|
1169
|
+
} yp_rational_node_t;
|
1170
|
+
|
1171
|
+
// RedoNode
|
1172
|
+
typedef struct yp_redo_node {
|
1173
|
+
yp_node_t base;
|
1174
|
+
} yp_redo_node_t;
|
1175
|
+
|
1176
|
+
// RegularExpressionNode
|
1177
|
+
typedef struct yp_regular_expression_node {
|
1178
|
+
yp_node_t base;
|
1179
|
+
yp_location_t opening_loc;
|
1180
|
+
yp_location_t content_loc;
|
1181
|
+
yp_location_t closing_loc;
|
1182
|
+
yp_string_t unescaped;
|
1183
|
+
uint32_t flags;
|
1184
|
+
} yp_regular_expression_node_t;
|
1185
|
+
|
1186
|
+
// RequiredDestructuredParameterNode
|
1187
|
+
typedef struct yp_required_destructured_parameter_node {
|
1188
|
+
yp_node_t base;
|
1189
|
+
struct yp_node_list parameters;
|
1190
|
+
yp_location_t opening_loc;
|
1191
|
+
yp_location_t closing_loc;
|
1192
|
+
} yp_required_destructured_parameter_node_t;
|
1193
|
+
|
1194
|
+
// RequiredParameterNode
|
1195
|
+
typedef struct yp_required_parameter_node {
|
1196
|
+
yp_node_t base;
|
1197
|
+
yp_constant_id_t constant_id;
|
1198
|
+
} yp_required_parameter_node_t;
|
1199
|
+
|
1200
|
+
// RescueModifierNode
|
1201
|
+
typedef struct yp_rescue_modifier_node {
|
1202
|
+
yp_node_t base;
|
1203
|
+
struct yp_node *expression;
|
1204
|
+
yp_location_t keyword_loc;
|
1205
|
+
struct yp_node *rescue_expression;
|
1206
|
+
} yp_rescue_modifier_node_t;
|
1207
|
+
|
1208
|
+
// RescueNode
|
1209
|
+
typedef struct yp_rescue_node {
|
1210
|
+
yp_node_t base;
|
1211
|
+
yp_location_t keyword_loc;
|
1212
|
+
struct yp_node_list exceptions;
|
1213
|
+
yp_location_t operator_loc;
|
1214
|
+
struct yp_node *reference;
|
1215
|
+
struct yp_statements_node *statements;
|
1216
|
+
struct yp_rescue_node *consequent;
|
1217
|
+
} yp_rescue_node_t;
|
1218
|
+
|
1219
|
+
// RestParameterNode
|
1220
|
+
typedef struct yp_rest_parameter_node {
|
1221
|
+
yp_node_t base;
|
1222
|
+
yp_location_t operator_loc;
|
1223
|
+
yp_location_t name_loc;
|
1224
|
+
} yp_rest_parameter_node_t;
|
1225
|
+
|
1226
|
+
// RetryNode
|
1227
|
+
typedef struct yp_retry_node {
|
1228
|
+
yp_node_t base;
|
1229
|
+
} yp_retry_node_t;
|
1230
|
+
|
1231
|
+
// ReturnNode
|
1232
|
+
typedef struct yp_return_node {
|
1233
|
+
yp_node_t base;
|
1234
|
+
yp_location_t keyword_loc;
|
1235
|
+
struct yp_arguments_node *arguments;
|
1236
|
+
} yp_return_node_t;
|
1237
|
+
|
1238
|
+
// SelfNode
|
1239
|
+
typedef struct yp_self_node {
|
1240
|
+
yp_node_t base;
|
1241
|
+
} yp_self_node_t;
|
1242
|
+
|
1243
|
+
// SingletonClassNode
|
1244
|
+
typedef struct yp_singleton_class_node {
|
1245
|
+
yp_node_t base;
|
1246
|
+
yp_constant_id_list_t locals;
|
1247
|
+
yp_location_t class_keyword_loc;
|
1248
|
+
yp_location_t operator_loc;
|
1249
|
+
struct yp_node *expression;
|
1250
|
+
struct yp_node *statements;
|
1251
|
+
yp_location_t end_keyword_loc;
|
1252
|
+
} yp_singleton_class_node_t;
|
1253
|
+
|
1254
|
+
// SourceEncodingNode
|
1255
|
+
typedef struct yp_source_encoding_node {
|
1256
|
+
yp_node_t base;
|
1257
|
+
} yp_source_encoding_node_t;
|
1258
|
+
|
1259
|
+
// SourceFileNode
|
1260
|
+
typedef struct yp_source_file_node {
|
1261
|
+
yp_node_t base;
|
1262
|
+
yp_string_t filepath;
|
1263
|
+
} yp_source_file_node_t;
|
1264
|
+
|
1265
|
+
// SourceLineNode
|
1266
|
+
typedef struct yp_source_line_node {
|
1267
|
+
yp_node_t base;
|
1268
|
+
} yp_source_line_node_t;
|
1269
|
+
|
1270
|
+
// SplatNode
|
1271
|
+
typedef struct yp_splat_node {
|
1272
|
+
yp_node_t base;
|
1273
|
+
yp_location_t operator_loc;
|
1274
|
+
struct yp_node *expression;
|
1275
|
+
} yp_splat_node_t;
|
1276
|
+
|
1277
|
+
// StatementsNode
|
1278
|
+
typedef struct yp_statements_node {
|
1279
|
+
yp_node_t base;
|
1280
|
+
struct yp_node_list body;
|
1281
|
+
} yp_statements_node_t;
|
1282
|
+
|
1283
|
+
// StringConcatNode
|
1284
|
+
typedef struct yp_string_concat_node {
|
1285
|
+
yp_node_t base;
|
1286
|
+
struct yp_node *left;
|
1287
|
+
struct yp_node *right;
|
1288
|
+
} yp_string_concat_node_t;
|
1289
|
+
|
1290
|
+
// StringNode
|
1291
|
+
typedef struct yp_string_node {
|
1292
|
+
yp_node_t base;
|
1293
|
+
yp_location_t opening_loc;
|
1294
|
+
yp_location_t content_loc;
|
1295
|
+
yp_location_t closing_loc;
|
1296
|
+
yp_string_t unescaped;
|
1297
|
+
} yp_string_node_t;
|
1298
|
+
|
1299
|
+
// SuperNode
|
1300
|
+
typedef struct yp_super_node {
|
1301
|
+
yp_node_t base;
|
1302
|
+
yp_location_t keyword_loc;
|
1303
|
+
yp_location_t lparen_loc;
|
1304
|
+
struct yp_arguments_node *arguments;
|
1305
|
+
yp_location_t rparen_loc;
|
1306
|
+
struct yp_block_node *block;
|
1307
|
+
} yp_super_node_t;
|
1308
|
+
|
1309
|
+
// SymbolNode
|
1310
|
+
typedef struct yp_symbol_node {
|
1311
|
+
yp_node_t base;
|
1312
|
+
yp_location_t opening_loc;
|
1313
|
+
yp_location_t value_loc;
|
1314
|
+
yp_location_t closing_loc;
|
1315
|
+
yp_string_t unescaped;
|
1316
|
+
} yp_symbol_node_t;
|
1317
|
+
|
1318
|
+
// TrueNode
|
1319
|
+
typedef struct yp_true_node {
|
1320
|
+
yp_node_t base;
|
1321
|
+
} yp_true_node_t;
|
1322
|
+
|
1323
|
+
// UndefNode
|
1324
|
+
typedef struct yp_undef_node {
|
1325
|
+
yp_node_t base;
|
1326
|
+
struct yp_node_list names;
|
1327
|
+
yp_location_t keyword_loc;
|
1328
|
+
} yp_undef_node_t;
|
1329
|
+
|
1330
|
+
// UnlessNode
|
1331
|
+
typedef struct yp_unless_node {
|
1332
|
+
yp_node_t base;
|
1333
|
+
yp_location_t keyword_loc;
|
1334
|
+
struct yp_node *predicate;
|
1335
|
+
struct yp_statements_node *statements;
|
1336
|
+
struct yp_else_node *consequent;
|
1337
|
+
yp_location_t end_keyword_loc;
|
1338
|
+
} yp_unless_node_t;
|
1339
|
+
|
1340
|
+
// UntilNode
|
1341
|
+
typedef struct yp_until_node {
|
1342
|
+
yp_node_t base;
|
1343
|
+
yp_location_t keyword_loc;
|
1344
|
+
struct yp_node *predicate;
|
1345
|
+
struct yp_statements_node *statements;
|
1346
|
+
uint32_t flags;
|
1347
|
+
} yp_until_node_t;
|
1348
|
+
|
1349
|
+
// WhenNode
|
1350
|
+
typedef struct yp_when_node {
|
1351
|
+
yp_node_t base;
|
1352
|
+
yp_location_t keyword_loc;
|
1353
|
+
struct yp_node_list conditions;
|
1354
|
+
struct yp_statements_node *statements;
|
1355
|
+
} yp_when_node_t;
|
1356
|
+
|
1357
|
+
// WhileNode
|
1358
|
+
typedef struct yp_while_node {
|
1359
|
+
yp_node_t base;
|
1360
|
+
yp_location_t keyword_loc;
|
1361
|
+
struct yp_node *predicate;
|
1362
|
+
struct yp_statements_node *statements;
|
1363
|
+
uint32_t flags;
|
1364
|
+
} yp_while_node_t;
|
1365
|
+
|
1366
|
+
// XStringNode
|
1367
|
+
typedef struct yp_x_string_node {
|
1368
|
+
yp_node_t base;
|
1369
|
+
yp_location_t opening_loc;
|
1370
|
+
yp_location_t content_loc;
|
1371
|
+
yp_location_t closing_loc;
|
1372
|
+
yp_string_t unescaped;
|
1373
|
+
} yp_x_string_node_t;
|
1374
|
+
|
1375
|
+
// YieldNode
|
1376
|
+
typedef struct yp_yield_node {
|
1377
|
+
yp_node_t base;
|
1378
|
+
yp_location_t keyword_loc;
|
1379
|
+
yp_location_t lparen_loc;
|
1380
|
+
struct yp_arguments_node *arguments;
|
1381
|
+
yp_location_t rparen_loc;
|
1382
|
+
} yp_yield_node_t;
|
1383
|
+
|
1384
|
+
// CallNodeFlags
|
1385
|
+
typedef enum {
|
1386
|
+
YP_CALL_NODE_FLAGS_SAFE_NAVIGATION = 1 << 0,
|
1387
|
+
YP_CALL_NODE_FLAGS_VARIABLE_CALL = 1 << 1,
|
1388
|
+
} yp_call_node_flags_t;
|
1389
|
+
|
1390
|
+
// LoopFlags
|
1391
|
+
typedef enum {
|
1392
|
+
YP_LOOP_FLAGS_BEGIN_MODIFIER = 1 << 0,
|
1393
|
+
} yp_loop_flags_t;
|
1394
|
+
|
1395
|
+
// RangeNodeFlags
|
1396
|
+
typedef enum {
|
1397
|
+
YP_RANGE_NODE_FLAGS_EXCLUDE_END = 1 << 0,
|
1398
|
+
} yp_range_node_flags_t;
|
1399
|
+
|
1400
|
+
// RegularExpressionFlags
|
1401
|
+
typedef enum {
|
1402
|
+
YP_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE = 1 << 0,
|
1403
|
+
YP_REGULAR_EXPRESSION_FLAGS_MULTI_LINE = 1 << 1,
|
1404
|
+
YP_REGULAR_EXPRESSION_FLAGS_EXTENDED = 1 << 2,
|
1405
|
+
YP_REGULAR_EXPRESSION_FLAGS_EUC_JP = 1 << 3,
|
1406
|
+
YP_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT = 1 << 4,
|
1407
|
+
YP_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J = 1 << 5,
|
1408
|
+
YP_REGULAR_EXPRESSION_FLAGS_UTF_8 = 1 << 6,
|
1409
|
+
YP_REGULAR_EXPRESSION_FLAGS_ONCE = 1 << 7,
|
1410
|
+
} yp_regular_expression_flags_t;
|
1411
|
+
|
1412
|
+
#endif // YARP_AST_H
|