yarp 0.12.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -8
  3. data/CONTRIBUTING.md +2 -2
  4. data/Makefile +5 -5
  5. data/README.md +11 -12
  6. data/config.yml +6 -2
  7. data/docs/build_system.md +21 -21
  8. data/docs/building.md +4 -4
  9. data/docs/configuration.md +25 -21
  10. data/docs/design.md +2 -2
  11. data/docs/encoding.md +17 -17
  12. data/docs/fuzzing.md +4 -4
  13. data/docs/heredocs.md +3 -3
  14. data/docs/mapping.md +94 -94
  15. data/docs/ripper.md +4 -4
  16. data/docs/ruby_api.md +11 -11
  17. data/docs/serialization.md +17 -16
  18. data/docs/testing.md +6 -6
  19. data/ext/prism/api_node.c +4725 -0
  20. data/ext/{yarp → prism}/api_pack.c +82 -82
  21. data/ext/{yarp → prism}/extconf.rb +13 -13
  22. data/ext/{yarp → prism}/extension.c +175 -168
  23. data/ext/prism/extension.h +18 -0
  24. data/include/prism/ast.h +1932 -0
  25. data/include/prism/defines.h +45 -0
  26. data/include/prism/diagnostic.h +231 -0
  27. data/include/{yarp/enc/yp_encoding.h → prism/enc/pm_encoding.h} +40 -40
  28. data/include/prism/node.h +41 -0
  29. data/include/prism/pack.h +141 -0
  30. data/include/{yarp → prism}/parser.h +143 -142
  31. data/include/prism/regexp.h +19 -0
  32. data/include/prism/unescape.h +48 -0
  33. data/include/prism/util/pm_buffer.h +51 -0
  34. data/include/{yarp/util/yp_char.h → prism/util/pm_char.h} +20 -20
  35. data/include/{yarp/util/yp_constant_pool.h → prism/util/pm_constant_pool.h} +26 -22
  36. data/include/{yarp/util/yp_list.h → prism/util/pm_list.h} +21 -21
  37. data/include/prism/util/pm_memchr.h +14 -0
  38. data/include/{yarp/util/yp_newline_list.h → prism/util/pm_newline_list.h} +11 -11
  39. data/include/prism/util/pm_state_stack.h +24 -0
  40. data/include/{yarp/util/yp_string.h → prism/util/pm_string.h} +20 -20
  41. data/include/prism/util/pm_string_list.h +25 -0
  42. data/include/{yarp/util/yp_strpbrk.h → prism/util/pm_strpbrk.h} +7 -7
  43. data/include/prism/version.h +4 -0
  44. data/include/prism.h +82 -0
  45. data/lib/prism/compiler.rb +465 -0
  46. data/lib/prism/debug.rb +157 -0
  47. data/lib/{yarp/desugar_visitor.rb → prism/desugar_compiler.rb} +4 -2
  48. data/lib/prism/dispatcher.rb +2051 -0
  49. data/lib/prism/dsl.rb +750 -0
  50. data/lib/{yarp → prism}/ffi.rb +66 -67
  51. data/lib/{yarp → prism}/lex_compat.rb +40 -43
  52. data/lib/{yarp/mutation_visitor.rb → prism/mutation_compiler.rb} +3 -3
  53. data/lib/{yarp → prism}/node.rb +2012 -2593
  54. data/lib/prism/node_ext.rb +55 -0
  55. data/lib/prism/node_inspector.rb +68 -0
  56. data/lib/{yarp → prism}/pack.rb +1 -1
  57. data/lib/{yarp → prism}/parse_result/comments.rb +1 -1
  58. data/lib/{yarp → prism}/parse_result/newlines.rb +1 -1
  59. data/lib/prism/parse_result.rb +266 -0
  60. data/lib/{yarp → prism}/pattern.rb +14 -14
  61. data/lib/{yarp → prism}/ripper_compat.rb +5 -5
  62. data/lib/{yarp → prism}/serialize.rb +12 -7
  63. data/lib/prism/visitor.rb +470 -0
  64. data/lib/prism.rb +64 -0
  65. data/lib/yarp.rb +2 -614
  66. data/src/diagnostic.c +213 -208
  67. data/src/enc/pm_big5.c +52 -0
  68. data/src/enc/pm_euc_jp.c +58 -0
  69. data/src/enc/{yp_gbk.c → pm_gbk.c} +16 -16
  70. data/src/enc/pm_shift_jis.c +56 -0
  71. data/src/enc/{yp_tables.c → pm_tables.c} +69 -69
  72. data/src/enc/{yp_unicode.c → pm_unicode.c} +40 -40
  73. data/src/enc/pm_windows_31j.c +56 -0
  74. data/src/node.c +1293 -1233
  75. data/src/pack.c +247 -247
  76. data/src/prettyprint.c +1479 -1479
  77. data/src/{yarp.c → prism.c} +5205 -5083
  78. data/src/regexp.c +132 -132
  79. data/src/serialize.c +1121 -1121
  80. data/src/token_type.c +169 -167
  81. data/src/unescape.c +106 -87
  82. data/src/util/pm_buffer.c +103 -0
  83. data/src/util/{yp_char.c → pm_char.c} +72 -72
  84. data/src/util/{yp_constant_pool.c → pm_constant_pool.c} +85 -64
  85. data/src/util/{yp_list.c → pm_list.c} +10 -10
  86. data/src/util/{yp_memchr.c → pm_memchr.c} +6 -4
  87. data/src/util/{yp_newline_list.c → pm_newline_list.c} +21 -21
  88. data/src/util/{yp_state_stack.c → pm_state_stack.c} +4 -4
  89. data/src/util/{yp_string.c → pm_string.c} +38 -38
  90. data/src/util/pm_string_list.c +29 -0
  91. data/src/util/{yp_strncasecmp.c → pm_strncasecmp.c} +1 -1
  92. data/src/util/{yp_strpbrk.c → pm_strpbrk.c} +8 -8
  93. data/yarp.gemspec +68 -59
  94. metadata +70 -61
  95. data/ext/yarp/api_node.c +0 -4728
  96. data/ext/yarp/extension.h +0 -18
  97. data/include/yarp/ast.h +0 -1929
  98. data/include/yarp/defines.h +0 -45
  99. data/include/yarp/diagnostic.h +0 -226
  100. data/include/yarp/node.h +0 -42
  101. data/include/yarp/pack.h +0 -141
  102. data/include/yarp/regexp.h +0 -19
  103. data/include/yarp/unescape.h +0 -44
  104. data/include/yarp/util/yp_buffer.h +0 -51
  105. data/include/yarp/util/yp_memchr.h +0 -14
  106. data/include/yarp/util/yp_state_stack.h +0 -24
  107. data/include/yarp/util/yp_string_list.h +0 -25
  108. data/include/yarp/version.h +0 -4
  109. data/include/yarp.h +0 -82
  110. data/src/enc/yp_big5.c +0 -52
  111. data/src/enc/yp_euc_jp.c +0 -58
  112. data/src/enc/yp_shift_jis.c +0 -56
  113. data/src/enc/yp_windows_31j.c +0 -56
  114. data/src/util/yp_buffer.c +0 -101
  115. data/src/util/yp_string_list.c +0 -29
data/include/yarp/ast.h DELETED
@@ -1,1929 +0,0 @@
1
- /******************************************************************************/
2
- /* This file is generated by the templates/template.rb script and should not */
3
- /* be 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 uint8_t *start;
192
- const uint8_t *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 uint8_t *start;
199
- const uint8_t *end;
200
- } yp_location_t;
201
-
202
- struct yp_node;
203
-
204
- typedef struct yp_node_list {
205
- struct yp_node **nodes;
206
- size_t size;
207
- size_t capacity;
208
- } yp_node_list_t;
209
-
210
- enum yp_node_type {
211
- YP_ALIAS_GLOBAL_VARIABLE_NODE = 1,
212
- YP_ALIAS_METHOD_NODE = 2,
213
- YP_ALTERNATION_PATTERN_NODE = 3,
214
- YP_AND_NODE = 4,
215
- YP_ARGUMENTS_NODE = 5,
216
- YP_ARRAY_NODE = 6,
217
- YP_ARRAY_PATTERN_NODE = 7,
218
- YP_ASSOC_NODE = 8,
219
- YP_ASSOC_SPLAT_NODE = 9,
220
- YP_BACK_REFERENCE_READ_NODE = 10,
221
- YP_BEGIN_NODE = 11,
222
- YP_BLOCK_ARGUMENT_NODE = 12,
223
- YP_BLOCK_LOCAL_VARIABLE_NODE = 13,
224
- YP_BLOCK_NODE = 14,
225
- YP_BLOCK_PARAMETER_NODE = 15,
226
- YP_BLOCK_PARAMETERS_NODE = 16,
227
- YP_BREAK_NODE = 17,
228
- YP_CALL_AND_WRITE_NODE = 18,
229
- YP_CALL_NODE = 19,
230
- YP_CALL_OPERATOR_WRITE_NODE = 20,
231
- YP_CALL_OR_WRITE_NODE = 21,
232
- YP_CAPTURE_PATTERN_NODE = 22,
233
- YP_CASE_NODE = 23,
234
- YP_CLASS_NODE = 24,
235
- YP_CLASS_VARIABLE_AND_WRITE_NODE = 25,
236
- YP_CLASS_VARIABLE_OPERATOR_WRITE_NODE = 26,
237
- YP_CLASS_VARIABLE_OR_WRITE_NODE = 27,
238
- YP_CLASS_VARIABLE_READ_NODE = 28,
239
- YP_CLASS_VARIABLE_TARGET_NODE = 29,
240
- YP_CLASS_VARIABLE_WRITE_NODE = 30,
241
- YP_CONSTANT_AND_WRITE_NODE = 31,
242
- YP_CONSTANT_OPERATOR_WRITE_NODE = 32,
243
- YP_CONSTANT_OR_WRITE_NODE = 33,
244
- YP_CONSTANT_PATH_AND_WRITE_NODE = 34,
245
- YP_CONSTANT_PATH_NODE = 35,
246
- YP_CONSTANT_PATH_OPERATOR_WRITE_NODE = 36,
247
- YP_CONSTANT_PATH_OR_WRITE_NODE = 37,
248
- YP_CONSTANT_PATH_TARGET_NODE = 38,
249
- YP_CONSTANT_PATH_WRITE_NODE = 39,
250
- YP_CONSTANT_READ_NODE = 40,
251
- YP_CONSTANT_TARGET_NODE = 41,
252
- YP_CONSTANT_WRITE_NODE = 42,
253
- YP_DEF_NODE = 43,
254
- YP_DEFINED_NODE = 44,
255
- YP_ELSE_NODE = 45,
256
- YP_EMBEDDED_STATEMENTS_NODE = 46,
257
- YP_EMBEDDED_VARIABLE_NODE = 47,
258
- YP_ENSURE_NODE = 48,
259
- YP_FALSE_NODE = 49,
260
- YP_FIND_PATTERN_NODE = 50,
261
- YP_FLIP_FLOP_NODE = 51,
262
- YP_FLOAT_NODE = 52,
263
- YP_FOR_NODE = 53,
264
- YP_FORWARDING_ARGUMENTS_NODE = 54,
265
- YP_FORWARDING_PARAMETER_NODE = 55,
266
- YP_FORWARDING_SUPER_NODE = 56,
267
- YP_GLOBAL_VARIABLE_AND_WRITE_NODE = 57,
268
- YP_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE = 58,
269
- YP_GLOBAL_VARIABLE_OR_WRITE_NODE = 59,
270
- YP_GLOBAL_VARIABLE_READ_NODE = 60,
271
- YP_GLOBAL_VARIABLE_TARGET_NODE = 61,
272
- YP_GLOBAL_VARIABLE_WRITE_NODE = 62,
273
- YP_HASH_NODE = 63,
274
- YP_HASH_PATTERN_NODE = 64,
275
- YP_IF_NODE = 65,
276
- YP_IMAGINARY_NODE = 66,
277
- YP_IMPLICIT_NODE = 67,
278
- YP_IN_NODE = 68,
279
- YP_INSTANCE_VARIABLE_AND_WRITE_NODE = 69,
280
- YP_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE = 70,
281
- YP_INSTANCE_VARIABLE_OR_WRITE_NODE = 71,
282
- YP_INSTANCE_VARIABLE_READ_NODE = 72,
283
- YP_INSTANCE_VARIABLE_TARGET_NODE = 73,
284
- YP_INSTANCE_VARIABLE_WRITE_NODE = 74,
285
- YP_INTEGER_NODE = 75,
286
- YP_INTERPOLATED_MATCH_LAST_LINE_NODE = 76,
287
- YP_INTERPOLATED_REGULAR_EXPRESSION_NODE = 77,
288
- YP_INTERPOLATED_STRING_NODE = 78,
289
- YP_INTERPOLATED_SYMBOL_NODE = 79,
290
- YP_INTERPOLATED_X_STRING_NODE = 80,
291
- YP_KEYWORD_HASH_NODE = 81,
292
- YP_KEYWORD_PARAMETER_NODE = 82,
293
- YP_KEYWORD_REST_PARAMETER_NODE = 83,
294
- YP_LAMBDA_NODE = 84,
295
- YP_LOCAL_VARIABLE_AND_WRITE_NODE = 85,
296
- YP_LOCAL_VARIABLE_OPERATOR_WRITE_NODE = 86,
297
- YP_LOCAL_VARIABLE_OR_WRITE_NODE = 87,
298
- YP_LOCAL_VARIABLE_READ_NODE = 88,
299
- YP_LOCAL_VARIABLE_TARGET_NODE = 89,
300
- YP_LOCAL_VARIABLE_WRITE_NODE = 90,
301
- YP_MATCH_LAST_LINE_NODE = 91,
302
- YP_MATCH_PREDICATE_NODE = 92,
303
- YP_MATCH_REQUIRED_NODE = 93,
304
- YP_MATCH_WRITE_NODE = 94,
305
- YP_MISSING_NODE = 95,
306
- YP_MODULE_NODE = 96,
307
- YP_MULTI_TARGET_NODE = 97,
308
- YP_MULTI_WRITE_NODE = 98,
309
- YP_NEXT_NODE = 99,
310
- YP_NIL_NODE = 100,
311
- YP_NO_KEYWORDS_PARAMETER_NODE = 101,
312
- YP_NUMBERED_REFERENCE_READ_NODE = 102,
313
- YP_OPTIONAL_PARAMETER_NODE = 103,
314
- YP_OR_NODE = 104,
315
- YP_PARAMETERS_NODE = 105,
316
- YP_PARENTHESES_NODE = 106,
317
- YP_PINNED_EXPRESSION_NODE = 107,
318
- YP_PINNED_VARIABLE_NODE = 108,
319
- YP_POST_EXECUTION_NODE = 109,
320
- YP_PRE_EXECUTION_NODE = 110,
321
- YP_PROGRAM_NODE = 111,
322
- YP_RANGE_NODE = 112,
323
- YP_RATIONAL_NODE = 113,
324
- YP_REDO_NODE = 114,
325
- YP_REGULAR_EXPRESSION_NODE = 115,
326
- YP_REQUIRED_DESTRUCTURED_PARAMETER_NODE = 116,
327
- YP_REQUIRED_PARAMETER_NODE = 117,
328
- YP_RESCUE_MODIFIER_NODE = 118,
329
- YP_RESCUE_NODE = 119,
330
- YP_REST_PARAMETER_NODE = 120,
331
- YP_RETRY_NODE = 121,
332
- YP_RETURN_NODE = 122,
333
- YP_SELF_NODE = 123,
334
- YP_SINGLETON_CLASS_NODE = 124,
335
- YP_SOURCE_ENCODING_NODE = 125,
336
- YP_SOURCE_FILE_NODE = 126,
337
- YP_SOURCE_LINE_NODE = 127,
338
- YP_SPLAT_NODE = 128,
339
- YP_STATEMENTS_NODE = 129,
340
- YP_STRING_CONCAT_NODE = 130,
341
- YP_STRING_NODE = 131,
342
- YP_SUPER_NODE = 132,
343
- YP_SYMBOL_NODE = 133,
344
- YP_TRUE_NODE = 134,
345
- YP_UNDEF_NODE = 135,
346
- YP_UNLESS_NODE = 136,
347
- YP_UNTIL_NODE = 137,
348
- YP_WHEN_NODE = 138,
349
- YP_WHILE_NODE = 139,
350
- YP_X_STRING_NODE = 140,
351
- YP_YIELD_NODE = 141,
352
- YP_SCOPE_NODE
353
- };
354
-
355
- typedef uint16_t yp_node_type_t;
356
- typedef uint16_t yp_node_flags_t;
357
-
358
- // We store the flags enum in every node in the tree. Some flags are common to
359
- // all nodes (the ones listed below). Others are specific to certain node types.
360
- static const yp_node_flags_t YP_NODE_FLAG_NEWLINE = 0x1;
361
- static const yp_node_flags_t YP_NODE_FLAG_STATIC_LITERAL = 0x2;
362
-
363
- // For easy access, we define some macros to check node type
364
- #define YP_NODE_TYPE(node) ((enum yp_node_type)node->type)
365
- #define YP_NODE_TYPE_P(node, type) (YP_NODE_TYPE(node) == (type))
366
-
367
- // This is the overall tagged union representing a node in the syntax tree.
368
- typedef struct yp_node {
369
- // This represents the type of the node. It somewhat maps to the nodes that
370
- // existed in the original grammar and ripper, but it's not a 1:1 mapping.
371
- yp_node_type_t type;
372
-
373
- // This represents any flags on the node
374
- yp_node_flags_t flags;
375
-
376
- // This is the location of the node in the source. It's a range of bytes
377
- // containing a start and an end.
378
- yp_location_t location;
379
- } yp_node_t;
380
-
381
- // AliasGlobalVariableNode
382
- //
383
- // Type: YP_ALIAS_GLOBAL_VARIABLE_NODE
384
- typedef struct yp_alias_global_variable_node {
385
- yp_node_t base;
386
- struct yp_node *new_name;
387
- struct yp_node *old_name;
388
- yp_location_t keyword_loc;
389
- } yp_alias_global_variable_node_t;
390
-
391
- // AliasMethodNode
392
- //
393
- // Type: YP_ALIAS_METHOD_NODE
394
- typedef struct yp_alias_method_node {
395
- yp_node_t base;
396
- struct yp_node *new_name;
397
- struct yp_node *old_name;
398
- yp_location_t keyword_loc;
399
- } yp_alias_method_node_t;
400
-
401
- // AlternationPatternNode
402
- //
403
- // Type: YP_ALTERNATION_PATTERN_NODE
404
- typedef struct yp_alternation_pattern_node {
405
- yp_node_t base;
406
- struct yp_node *left;
407
- struct yp_node *right;
408
- yp_location_t operator_loc;
409
- } yp_alternation_pattern_node_t;
410
-
411
- // AndNode
412
- //
413
- // Type: YP_AND_NODE
414
- typedef struct yp_and_node {
415
- yp_node_t base;
416
- struct yp_node *left;
417
- struct yp_node *right;
418
- yp_location_t operator_loc;
419
- } yp_and_node_t;
420
-
421
- // ArgumentsNode
422
- //
423
- // Type: YP_ARGUMENTS_NODE
424
- typedef struct yp_arguments_node {
425
- yp_node_t base;
426
- struct yp_node_list arguments;
427
- } yp_arguments_node_t;
428
-
429
- // ArrayNode
430
- //
431
- // Type: YP_ARRAY_NODE
432
- typedef struct yp_array_node {
433
- yp_node_t base;
434
- struct yp_node_list elements;
435
- yp_location_t opening_loc;
436
- yp_location_t closing_loc;
437
- } yp_array_node_t;
438
-
439
- // ArrayPatternNode
440
- //
441
- // Type: YP_ARRAY_PATTERN_NODE
442
- typedef struct yp_array_pattern_node {
443
- yp_node_t base;
444
- struct yp_node *constant;
445
- struct yp_node_list requireds;
446
- struct yp_node *rest;
447
- struct yp_node_list posts;
448
- yp_location_t opening_loc;
449
- yp_location_t closing_loc;
450
- } yp_array_pattern_node_t;
451
-
452
- // AssocNode
453
- //
454
- // Type: YP_ASSOC_NODE
455
- typedef struct yp_assoc_node {
456
- yp_node_t base;
457
- struct yp_node *key;
458
- struct yp_node *value;
459
- yp_location_t operator_loc;
460
- } yp_assoc_node_t;
461
-
462
- // AssocSplatNode
463
- //
464
- // Type: YP_ASSOC_SPLAT_NODE
465
- typedef struct yp_assoc_splat_node {
466
- yp_node_t base;
467
- struct yp_node *value;
468
- yp_location_t operator_loc;
469
- } yp_assoc_splat_node_t;
470
-
471
- // BackReferenceReadNode
472
- //
473
- // Type: YP_BACK_REFERENCE_READ_NODE
474
- typedef struct yp_back_reference_read_node {
475
- yp_node_t base;
476
- } yp_back_reference_read_node_t;
477
-
478
- // BeginNode
479
- //
480
- // Type: YP_BEGIN_NODE
481
- typedef struct yp_begin_node {
482
- yp_node_t base;
483
- yp_location_t begin_keyword_loc;
484
- struct yp_statements_node *statements;
485
- struct yp_rescue_node *rescue_clause;
486
- struct yp_else_node *else_clause;
487
- struct yp_ensure_node *ensure_clause;
488
- yp_location_t end_keyword_loc;
489
- } yp_begin_node_t;
490
-
491
- // BlockArgumentNode
492
- //
493
- // Type: YP_BLOCK_ARGUMENT_NODE
494
- typedef struct yp_block_argument_node {
495
- yp_node_t base;
496
- struct yp_node *expression;
497
- yp_location_t operator_loc;
498
- } yp_block_argument_node_t;
499
-
500
- // BlockLocalVariableNode
501
- //
502
- // Type: YP_BLOCK_LOCAL_VARIABLE_NODE
503
- typedef struct yp_block_local_variable_node {
504
- yp_node_t base;
505
- yp_constant_id_t name;
506
- } yp_block_local_variable_node_t;
507
-
508
- // BlockNode
509
- //
510
- // Type: YP_BLOCK_NODE
511
- typedef struct yp_block_node {
512
- yp_node_t base;
513
- yp_constant_id_list_t locals;
514
- struct yp_block_parameters_node *parameters;
515
- struct yp_node *body;
516
- yp_location_t opening_loc;
517
- yp_location_t closing_loc;
518
- } yp_block_node_t;
519
-
520
- // BlockParameterNode
521
- //
522
- // Type: YP_BLOCK_PARAMETER_NODE
523
- typedef struct yp_block_parameter_node {
524
- yp_node_t base;
525
- yp_constant_id_t name;
526
- yp_location_t name_loc;
527
- yp_location_t operator_loc;
528
- } yp_block_parameter_node_t;
529
-
530
- // BlockParametersNode
531
- //
532
- // Type: YP_BLOCK_PARAMETERS_NODE
533
- typedef struct yp_block_parameters_node {
534
- yp_node_t base;
535
- struct yp_parameters_node *parameters;
536
- struct yp_node_list locals;
537
- yp_location_t opening_loc;
538
- yp_location_t closing_loc;
539
- } yp_block_parameters_node_t;
540
-
541
- // BreakNode
542
- //
543
- // Type: YP_BREAK_NODE
544
- typedef struct yp_break_node {
545
- yp_node_t base;
546
- struct yp_arguments_node *arguments;
547
- yp_location_t keyword_loc;
548
- } yp_break_node_t;
549
-
550
- // CallAndWriteNode
551
- //
552
- // Type: YP_CALL_AND_WRITE_NODE
553
- // Flags:
554
- // YP_CALL_NODE_FLAGS_SAFE_NAVIGATION
555
- // YP_CALL_NODE_FLAGS_VARIABLE_CALL
556
- typedef struct yp_call_and_write_node {
557
- yp_node_t base;
558
- struct yp_node *receiver;
559
- yp_location_t call_operator_loc;
560
- yp_location_t message_loc;
561
- yp_location_t opening_loc;
562
- struct yp_arguments_node *arguments;
563
- yp_location_t closing_loc;
564
- yp_string_t read_name;
565
- yp_string_t write_name;
566
- yp_location_t operator_loc;
567
- struct yp_node *value;
568
- } yp_call_and_write_node_t;
569
-
570
- // CallNode
571
- //
572
- // Type: YP_CALL_NODE
573
- // Flags:
574
- // YP_CALL_NODE_FLAGS_SAFE_NAVIGATION
575
- // YP_CALL_NODE_FLAGS_VARIABLE_CALL
576
- typedef struct yp_call_node {
577
- yp_node_t base;
578
- struct yp_node *receiver;
579
- yp_location_t call_operator_loc;
580
- yp_location_t message_loc;
581
- yp_location_t opening_loc;
582
- struct yp_arguments_node *arguments;
583
- yp_location_t closing_loc;
584
- struct yp_block_node *block;
585
- yp_string_t name;
586
- } yp_call_node_t;
587
-
588
- // CallOperatorWriteNode
589
- //
590
- // Type: YP_CALL_OPERATOR_WRITE_NODE
591
- // Flags:
592
- // YP_CALL_NODE_FLAGS_SAFE_NAVIGATION
593
- // YP_CALL_NODE_FLAGS_VARIABLE_CALL
594
- typedef struct yp_call_operator_write_node {
595
- yp_node_t base;
596
- struct yp_node *receiver;
597
- yp_location_t call_operator_loc;
598
- yp_location_t message_loc;
599
- yp_location_t opening_loc;
600
- struct yp_arguments_node *arguments;
601
- yp_location_t closing_loc;
602
- yp_string_t read_name;
603
- yp_string_t write_name;
604
- yp_constant_id_t operator;
605
- yp_location_t operator_loc;
606
- struct yp_node *value;
607
- } yp_call_operator_write_node_t;
608
-
609
- // CallOrWriteNode
610
- //
611
- // Type: YP_CALL_OR_WRITE_NODE
612
- // Flags:
613
- // YP_CALL_NODE_FLAGS_SAFE_NAVIGATION
614
- // YP_CALL_NODE_FLAGS_VARIABLE_CALL
615
- typedef struct yp_call_or_write_node {
616
- yp_node_t base;
617
- struct yp_node *receiver;
618
- yp_location_t call_operator_loc;
619
- yp_location_t message_loc;
620
- yp_location_t opening_loc;
621
- struct yp_arguments_node *arguments;
622
- yp_location_t closing_loc;
623
- yp_string_t read_name;
624
- yp_string_t write_name;
625
- yp_location_t operator_loc;
626
- struct yp_node *value;
627
- } yp_call_or_write_node_t;
628
-
629
- // CapturePatternNode
630
- //
631
- // Type: YP_CAPTURE_PATTERN_NODE
632
- typedef struct yp_capture_pattern_node {
633
- yp_node_t base;
634
- struct yp_node *value;
635
- struct yp_node *target;
636
- yp_location_t operator_loc;
637
- } yp_capture_pattern_node_t;
638
-
639
- // CaseNode
640
- //
641
- // Type: YP_CASE_NODE
642
- typedef struct yp_case_node {
643
- yp_node_t base;
644
- struct yp_node *predicate;
645
- struct yp_node_list conditions;
646
- struct yp_else_node *consequent;
647
- yp_location_t case_keyword_loc;
648
- yp_location_t end_keyword_loc;
649
- } yp_case_node_t;
650
-
651
- // ClassNode
652
- //
653
- // Type: YP_CLASS_NODE
654
- typedef struct yp_class_node {
655
- yp_node_t base;
656
- yp_constant_id_list_t locals;
657
- yp_location_t class_keyword_loc;
658
- struct yp_node *constant_path;
659
- yp_location_t inheritance_operator_loc;
660
- struct yp_node *superclass;
661
- struct yp_node *body;
662
- yp_location_t end_keyword_loc;
663
- yp_constant_id_t name;
664
- } yp_class_node_t;
665
-
666
- // ClassVariableAndWriteNode
667
- //
668
- // Type: YP_CLASS_VARIABLE_AND_WRITE_NODE
669
- typedef struct yp_class_variable_and_write_node {
670
- yp_node_t base;
671
- yp_constant_id_t name;
672
- yp_location_t name_loc;
673
- yp_location_t operator_loc;
674
- struct yp_node *value;
675
- } yp_class_variable_and_write_node_t;
676
-
677
- // ClassVariableOperatorWriteNode
678
- //
679
- // Type: YP_CLASS_VARIABLE_OPERATOR_WRITE_NODE
680
- typedef struct yp_class_variable_operator_write_node {
681
- yp_node_t base;
682
- yp_constant_id_t name;
683
- yp_location_t name_loc;
684
- yp_location_t operator_loc;
685
- struct yp_node *value;
686
- yp_constant_id_t operator;
687
- } yp_class_variable_operator_write_node_t;
688
-
689
- // ClassVariableOrWriteNode
690
- //
691
- // Type: YP_CLASS_VARIABLE_OR_WRITE_NODE
692
- typedef struct yp_class_variable_or_write_node {
693
- yp_node_t base;
694
- yp_constant_id_t name;
695
- yp_location_t name_loc;
696
- yp_location_t operator_loc;
697
- struct yp_node *value;
698
- } yp_class_variable_or_write_node_t;
699
-
700
- // ClassVariableReadNode
701
- //
702
- // Type: YP_CLASS_VARIABLE_READ_NODE
703
- typedef struct yp_class_variable_read_node {
704
- yp_node_t base;
705
- yp_constant_id_t name;
706
- } yp_class_variable_read_node_t;
707
-
708
- // ClassVariableTargetNode
709
- //
710
- // Type: YP_CLASS_VARIABLE_TARGET_NODE
711
- typedef struct yp_class_variable_target_node {
712
- yp_node_t base;
713
- yp_constant_id_t name;
714
- } yp_class_variable_target_node_t;
715
-
716
- // ClassVariableWriteNode
717
- //
718
- // Type: YP_CLASS_VARIABLE_WRITE_NODE
719
- typedef struct yp_class_variable_write_node {
720
- yp_node_t base;
721
- yp_constant_id_t name;
722
- yp_location_t name_loc;
723
- struct yp_node *value;
724
- yp_location_t operator_loc;
725
- } yp_class_variable_write_node_t;
726
-
727
- // ConstantAndWriteNode
728
- //
729
- // Type: YP_CONSTANT_AND_WRITE_NODE
730
- typedef struct yp_constant_and_write_node {
731
- yp_node_t base;
732
- yp_constant_id_t name;
733
- yp_location_t name_loc;
734
- yp_location_t operator_loc;
735
- struct yp_node *value;
736
- } yp_constant_and_write_node_t;
737
-
738
- // ConstantOperatorWriteNode
739
- //
740
- // Type: YP_CONSTANT_OPERATOR_WRITE_NODE
741
- typedef struct yp_constant_operator_write_node {
742
- yp_node_t base;
743
- yp_constant_id_t name;
744
- yp_location_t name_loc;
745
- yp_location_t operator_loc;
746
- struct yp_node *value;
747
- yp_constant_id_t operator;
748
- } yp_constant_operator_write_node_t;
749
-
750
- // ConstantOrWriteNode
751
- //
752
- // Type: YP_CONSTANT_OR_WRITE_NODE
753
- typedef struct yp_constant_or_write_node {
754
- yp_node_t base;
755
- yp_constant_id_t name;
756
- yp_location_t name_loc;
757
- yp_location_t operator_loc;
758
- struct yp_node *value;
759
- } yp_constant_or_write_node_t;
760
-
761
- // ConstantPathAndWriteNode
762
- //
763
- // Type: YP_CONSTANT_PATH_AND_WRITE_NODE
764
- typedef struct yp_constant_path_and_write_node {
765
- yp_node_t base;
766
- struct yp_constant_path_node *target;
767
- yp_location_t operator_loc;
768
- struct yp_node *value;
769
- } yp_constant_path_and_write_node_t;
770
-
771
- // ConstantPathNode
772
- //
773
- // Type: YP_CONSTANT_PATH_NODE
774
- typedef struct yp_constant_path_node {
775
- yp_node_t base;
776
- struct yp_node *parent;
777
- struct yp_node *child;
778
- yp_location_t delimiter_loc;
779
- } yp_constant_path_node_t;
780
-
781
- // ConstantPathOperatorWriteNode
782
- //
783
- // Type: YP_CONSTANT_PATH_OPERATOR_WRITE_NODE
784
- typedef struct yp_constant_path_operator_write_node {
785
- yp_node_t base;
786
- struct yp_constant_path_node *target;
787
- yp_location_t operator_loc;
788
- struct yp_node *value;
789
- yp_constant_id_t operator;
790
- } yp_constant_path_operator_write_node_t;
791
-
792
- // ConstantPathOrWriteNode
793
- //
794
- // Type: YP_CONSTANT_PATH_OR_WRITE_NODE
795
- typedef struct yp_constant_path_or_write_node {
796
- yp_node_t base;
797
- struct yp_constant_path_node *target;
798
- yp_location_t operator_loc;
799
- struct yp_node *value;
800
- } yp_constant_path_or_write_node_t;
801
-
802
- // ConstantPathTargetNode
803
- //
804
- // Type: YP_CONSTANT_PATH_TARGET_NODE
805
- typedef struct yp_constant_path_target_node {
806
- yp_node_t base;
807
- struct yp_node *parent;
808
- struct yp_node *child;
809
- yp_location_t delimiter_loc;
810
- } yp_constant_path_target_node_t;
811
-
812
- // ConstantPathWriteNode
813
- //
814
- // Type: YP_CONSTANT_PATH_WRITE_NODE
815
- typedef struct yp_constant_path_write_node {
816
- yp_node_t base;
817
- struct yp_constant_path_node *target;
818
- yp_location_t operator_loc;
819
- struct yp_node *value;
820
- } yp_constant_path_write_node_t;
821
-
822
- // ConstantReadNode
823
- //
824
- // Type: YP_CONSTANT_READ_NODE
825
- typedef struct yp_constant_read_node {
826
- yp_node_t base;
827
- yp_constant_id_t name;
828
- } yp_constant_read_node_t;
829
-
830
- // ConstantTargetNode
831
- //
832
- // Type: YP_CONSTANT_TARGET_NODE
833
- typedef struct yp_constant_target_node {
834
- yp_node_t base;
835
- yp_constant_id_t name;
836
- } yp_constant_target_node_t;
837
-
838
- // ConstantWriteNode
839
- //
840
- // Type: YP_CONSTANT_WRITE_NODE
841
- typedef struct yp_constant_write_node {
842
- yp_node_t base;
843
- yp_constant_id_t name;
844
- yp_location_t name_loc;
845
- struct yp_node *value;
846
- yp_location_t operator_loc;
847
- } yp_constant_write_node_t;
848
-
849
- // DefNode
850
- //
851
- // Type: YP_DEF_NODE
852
- typedef struct yp_def_node {
853
- yp_node_t base;
854
- yp_constant_id_t name;
855
- yp_location_t name_loc;
856
- struct yp_node *receiver;
857
- struct yp_parameters_node *parameters;
858
- struct yp_node *body;
859
- yp_constant_id_list_t locals;
860
- yp_location_t def_keyword_loc;
861
- yp_location_t operator_loc;
862
- yp_location_t lparen_loc;
863
- yp_location_t rparen_loc;
864
- yp_location_t equal_loc;
865
- yp_location_t end_keyword_loc;
866
- } yp_def_node_t;
867
-
868
- // DefinedNode
869
- //
870
- // Type: YP_DEFINED_NODE
871
- typedef struct yp_defined_node {
872
- yp_node_t base;
873
- yp_location_t lparen_loc;
874
- struct yp_node *value;
875
- yp_location_t rparen_loc;
876
- yp_location_t keyword_loc;
877
- } yp_defined_node_t;
878
-
879
- // ElseNode
880
- //
881
- // Type: YP_ELSE_NODE
882
- typedef struct yp_else_node {
883
- yp_node_t base;
884
- yp_location_t else_keyword_loc;
885
- struct yp_statements_node *statements;
886
- yp_location_t end_keyword_loc;
887
- } yp_else_node_t;
888
-
889
- // EmbeddedStatementsNode
890
- //
891
- // Type: YP_EMBEDDED_STATEMENTS_NODE
892
- typedef struct yp_embedded_statements_node {
893
- yp_node_t base;
894
- yp_location_t opening_loc;
895
- struct yp_statements_node *statements;
896
- yp_location_t closing_loc;
897
- } yp_embedded_statements_node_t;
898
-
899
- // EmbeddedVariableNode
900
- //
901
- // Type: YP_EMBEDDED_VARIABLE_NODE
902
- typedef struct yp_embedded_variable_node {
903
- yp_node_t base;
904
- yp_location_t operator_loc;
905
- struct yp_node *variable;
906
- } yp_embedded_variable_node_t;
907
-
908
- // EnsureNode
909
- //
910
- // Type: YP_ENSURE_NODE
911
- typedef struct yp_ensure_node {
912
- yp_node_t base;
913
- yp_location_t ensure_keyword_loc;
914
- struct yp_statements_node *statements;
915
- yp_location_t end_keyword_loc;
916
- } yp_ensure_node_t;
917
-
918
- // FalseNode
919
- //
920
- // Type: YP_FALSE_NODE
921
- typedef struct yp_false_node {
922
- yp_node_t base;
923
- } yp_false_node_t;
924
-
925
- // FindPatternNode
926
- //
927
- // Type: YP_FIND_PATTERN_NODE
928
- typedef struct yp_find_pattern_node {
929
- yp_node_t base;
930
- struct yp_node *constant;
931
- struct yp_node *left;
932
- struct yp_node_list requireds;
933
- struct yp_node *right;
934
- yp_location_t opening_loc;
935
- yp_location_t closing_loc;
936
- } yp_find_pattern_node_t;
937
-
938
- // FlipFlopNode
939
- //
940
- // Type: YP_FLIP_FLOP_NODE
941
- // Flags:
942
- // YP_RANGE_FLAGS_EXCLUDE_END
943
- typedef struct yp_flip_flop_node {
944
- yp_node_t base;
945
- struct yp_node *left;
946
- struct yp_node *right;
947
- yp_location_t operator_loc;
948
- } yp_flip_flop_node_t;
949
-
950
- // FloatNode
951
- //
952
- // Type: YP_FLOAT_NODE
953
- typedef struct yp_float_node {
954
- yp_node_t base;
955
- } yp_float_node_t;
956
-
957
- // ForNode
958
- //
959
- // Type: YP_FOR_NODE
960
- typedef struct yp_for_node {
961
- yp_node_t base;
962
- struct yp_node *index;
963
- struct yp_node *collection;
964
- struct yp_statements_node *statements;
965
- yp_location_t for_keyword_loc;
966
- yp_location_t in_keyword_loc;
967
- yp_location_t do_keyword_loc;
968
- yp_location_t end_keyword_loc;
969
- } yp_for_node_t;
970
-
971
- // ForwardingArgumentsNode
972
- //
973
- // Type: YP_FORWARDING_ARGUMENTS_NODE
974
- typedef struct yp_forwarding_arguments_node {
975
- yp_node_t base;
976
- } yp_forwarding_arguments_node_t;
977
-
978
- // ForwardingParameterNode
979
- //
980
- // Type: YP_FORWARDING_PARAMETER_NODE
981
- typedef struct yp_forwarding_parameter_node {
982
- yp_node_t base;
983
- } yp_forwarding_parameter_node_t;
984
-
985
- // ForwardingSuperNode
986
- //
987
- // Type: YP_FORWARDING_SUPER_NODE
988
- typedef struct yp_forwarding_super_node {
989
- yp_node_t base;
990
- struct yp_block_node *block;
991
- } yp_forwarding_super_node_t;
992
-
993
- // GlobalVariableAndWriteNode
994
- //
995
- // Type: YP_GLOBAL_VARIABLE_AND_WRITE_NODE
996
- typedef struct yp_global_variable_and_write_node {
997
- yp_node_t base;
998
- yp_constant_id_t name;
999
- yp_location_t name_loc;
1000
- yp_location_t operator_loc;
1001
- struct yp_node *value;
1002
- } yp_global_variable_and_write_node_t;
1003
-
1004
- // GlobalVariableOperatorWriteNode
1005
- //
1006
- // Type: YP_GLOBAL_VARIABLE_OPERATOR_WRITE_NODE
1007
- typedef struct yp_global_variable_operator_write_node {
1008
- yp_node_t base;
1009
- yp_constant_id_t name;
1010
- yp_location_t name_loc;
1011
- yp_location_t operator_loc;
1012
- struct yp_node *value;
1013
- yp_constant_id_t operator;
1014
- } yp_global_variable_operator_write_node_t;
1015
-
1016
- // GlobalVariableOrWriteNode
1017
- //
1018
- // Type: YP_GLOBAL_VARIABLE_OR_WRITE_NODE
1019
- typedef struct yp_global_variable_or_write_node {
1020
- yp_node_t base;
1021
- yp_constant_id_t name;
1022
- yp_location_t name_loc;
1023
- yp_location_t operator_loc;
1024
- struct yp_node *value;
1025
- } yp_global_variable_or_write_node_t;
1026
-
1027
- // GlobalVariableReadNode
1028
- //
1029
- // Type: YP_GLOBAL_VARIABLE_READ_NODE
1030
- typedef struct yp_global_variable_read_node {
1031
- yp_node_t base;
1032
- yp_constant_id_t name;
1033
- } yp_global_variable_read_node_t;
1034
-
1035
- // GlobalVariableTargetNode
1036
- //
1037
- // Type: YP_GLOBAL_VARIABLE_TARGET_NODE
1038
- typedef struct yp_global_variable_target_node {
1039
- yp_node_t base;
1040
- yp_constant_id_t name;
1041
- } yp_global_variable_target_node_t;
1042
-
1043
- // GlobalVariableWriteNode
1044
- //
1045
- // Type: YP_GLOBAL_VARIABLE_WRITE_NODE
1046
- typedef struct yp_global_variable_write_node {
1047
- yp_node_t base;
1048
- yp_constant_id_t name;
1049
- yp_location_t name_loc;
1050
- struct yp_node *value;
1051
- yp_location_t operator_loc;
1052
- } yp_global_variable_write_node_t;
1053
-
1054
- // HashNode
1055
- //
1056
- // Type: YP_HASH_NODE
1057
- typedef struct yp_hash_node {
1058
- yp_node_t base;
1059
- yp_location_t opening_loc;
1060
- struct yp_node_list elements;
1061
- yp_location_t closing_loc;
1062
- } yp_hash_node_t;
1063
-
1064
- // HashPatternNode
1065
- //
1066
- // Type: YP_HASH_PATTERN_NODE
1067
- typedef struct yp_hash_pattern_node {
1068
- yp_node_t base;
1069
- struct yp_node *constant;
1070
- struct yp_node_list assocs;
1071
- struct yp_node *kwrest;
1072
- yp_location_t opening_loc;
1073
- yp_location_t closing_loc;
1074
- } yp_hash_pattern_node_t;
1075
-
1076
- // IfNode
1077
- //
1078
- // Type: YP_IF_NODE
1079
- typedef struct yp_if_node {
1080
- yp_node_t base;
1081
- yp_location_t if_keyword_loc;
1082
- struct yp_node *predicate;
1083
- struct yp_statements_node *statements;
1084
- struct yp_node *consequent;
1085
- yp_location_t end_keyword_loc;
1086
- } yp_if_node_t;
1087
-
1088
- // ImaginaryNode
1089
- //
1090
- // Type: YP_IMAGINARY_NODE
1091
- typedef struct yp_imaginary_node {
1092
- yp_node_t base;
1093
- struct yp_node *numeric;
1094
- } yp_imaginary_node_t;
1095
-
1096
- // ImplicitNode
1097
- //
1098
- // Type: YP_IMPLICIT_NODE
1099
- typedef struct yp_implicit_node {
1100
- yp_node_t base;
1101
- struct yp_node *value;
1102
- } yp_implicit_node_t;
1103
-
1104
- // InNode
1105
- //
1106
- // Type: YP_IN_NODE
1107
- typedef struct yp_in_node {
1108
- yp_node_t base;
1109
- struct yp_node *pattern;
1110
- struct yp_statements_node *statements;
1111
- yp_location_t in_loc;
1112
- yp_location_t then_loc;
1113
- } yp_in_node_t;
1114
-
1115
- // InstanceVariableAndWriteNode
1116
- //
1117
- // Type: YP_INSTANCE_VARIABLE_AND_WRITE_NODE
1118
- typedef struct yp_instance_variable_and_write_node {
1119
- yp_node_t base;
1120
- yp_constant_id_t name;
1121
- yp_location_t name_loc;
1122
- yp_location_t operator_loc;
1123
- struct yp_node *value;
1124
- } yp_instance_variable_and_write_node_t;
1125
-
1126
- // InstanceVariableOperatorWriteNode
1127
- //
1128
- // Type: YP_INSTANCE_VARIABLE_OPERATOR_WRITE_NODE
1129
- typedef struct yp_instance_variable_operator_write_node {
1130
- yp_node_t base;
1131
- yp_constant_id_t name;
1132
- yp_location_t name_loc;
1133
- yp_location_t operator_loc;
1134
- struct yp_node *value;
1135
- yp_constant_id_t operator;
1136
- } yp_instance_variable_operator_write_node_t;
1137
-
1138
- // InstanceVariableOrWriteNode
1139
- //
1140
- // Type: YP_INSTANCE_VARIABLE_OR_WRITE_NODE
1141
- typedef struct yp_instance_variable_or_write_node {
1142
- yp_node_t base;
1143
- yp_constant_id_t name;
1144
- yp_location_t name_loc;
1145
- yp_location_t operator_loc;
1146
- struct yp_node *value;
1147
- } yp_instance_variable_or_write_node_t;
1148
-
1149
- // InstanceVariableReadNode
1150
- //
1151
- // Type: YP_INSTANCE_VARIABLE_READ_NODE
1152
- typedef struct yp_instance_variable_read_node {
1153
- yp_node_t base;
1154
- yp_constant_id_t name;
1155
- } yp_instance_variable_read_node_t;
1156
-
1157
- // InstanceVariableTargetNode
1158
- //
1159
- // Type: YP_INSTANCE_VARIABLE_TARGET_NODE
1160
- typedef struct yp_instance_variable_target_node {
1161
- yp_node_t base;
1162
- yp_constant_id_t name;
1163
- } yp_instance_variable_target_node_t;
1164
-
1165
- // InstanceVariableWriteNode
1166
- //
1167
- // Type: YP_INSTANCE_VARIABLE_WRITE_NODE
1168
- typedef struct yp_instance_variable_write_node {
1169
- yp_node_t base;
1170
- yp_constant_id_t name;
1171
- yp_location_t name_loc;
1172
- struct yp_node *value;
1173
- yp_location_t operator_loc;
1174
- } yp_instance_variable_write_node_t;
1175
-
1176
- // IntegerNode
1177
- //
1178
- // Type: YP_INTEGER_NODE
1179
- // Flags:
1180
- // YP_INTEGER_BASE_FLAGS_BINARY
1181
- // YP_INTEGER_BASE_FLAGS_OCTAL
1182
- // YP_INTEGER_BASE_FLAGS_DECIMAL
1183
- // YP_INTEGER_BASE_FLAGS_HEXADECIMAL
1184
- typedef struct yp_integer_node {
1185
- yp_node_t base;
1186
- } yp_integer_node_t;
1187
-
1188
- // InterpolatedMatchLastLineNode
1189
- //
1190
- // Type: YP_INTERPOLATED_MATCH_LAST_LINE_NODE
1191
- // Flags:
1192
- // YP_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE
1193
- // YP_REGULAR_EXPRESSION_FLAGS_EXTENDED
1194
- // YP_REGULAR_EXPRESSION_FLAGS_MULTI_LINE
1195
- // YP_REGULAR_EXPRESSION_FLAGS_EUC_JP
1196
- // YP_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT
1197
- // YP_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J
1198
- // YP_REGULAR_EXPRESSION_FLAGS_UTF_8
1199
- // YP_REGULAR_EXPRESSION_FLAGS_ONCE
1200
- typedef struct yp_interpolated_match_last_line_node {
1201
- yp_node_t base;
1202
- yp_location_t opening_loc;
1203
- struct yp_node_list parts;
1204
- yp_location_t closing_loc;
1205
- } yp_interpolated_match_last_line_node_t;
1206
-
1207
- // InterpolatedRegularExpressionNode
1208
- //
1209
- // Type: YP_INTERPOLATED_REGULAR_EXPRESSION_NODE
1210
- // Flags:
1211
- // YP_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE
1212
- // YP_REGULAR_EXPRESSION_FLAGS_EXTENDED
1213
- // YP_REGULAR_EXPRESSION_FLAGS_MULTI_LINE
1214
- // YP_REGULAR_EXPRESSION_FLAGS_EUC_JP
1215
- // YP_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT
1216
- // YP_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J
1217
- // YP_REGULAR_EXPRESSION_FLAGS_UTF_8
1218
- // YP_REGULAR_EXPRESSION_FLAGS_ONCE
1219
- typedef struct yp_interpolated_regular_expression_node {
1220
- yp_node_t base;
1221
- yp_location_t opening_loc;
1222
- struct yp_node_list parts;
1223
- yp_location_t closing_loc;
1224
- } yp_interpolated_regular_expression_node_t;
1225
-
1226
- // InterpolatedStringNode
1227
- //
1228
- // Type: YP_INTERPOLATED_STRING_NODE
1229
- typedef struct yp_interpolated_string_node {
1230
- yp_node_t base;
1231
- yp_location_t opening_loc;
1232
- struct yp_node_list parts;
1233
- yp_location_t closing_loc;
1234
- } yp_interpolated_string_node_t;
1235
-
1236
- // InterpolatedSymbolNode
1237
- //
1238
- // Type: YP_INTERPOLATED_SYMBOL_NODE
1239
- typedef struct yp_interpolated_symbol_node {
1240
- yp_node_t base;
1241
- yp_location_t opening_loc;
1242
- struct yp_node_list parts;
1243
- yp_location_t closing_loc;
1244
- } yp_interpolated_symbol_node_t;
1245
-
1246
- // InterpolatedXStringNode
1247
- //
1248
- // Type: YP_INTERPOLATED_X_STRING_NODE
1249
- typedef struct yp_interpolated_x_string_node {
1250
- yp_node_t base;
1251
- yp_location_t opening_loc;
1252
- struct yp_node_list parts;
1253
- yp_location_t closing_loc;
1254
- } yp_interpolated_x_string_node_t;
1255
-
1256
- // KeywordHashNode
1257
- //
1258
- // Type: YP_KEYWORD_HASH_NODE
1259
- typedef struct yp_keyword_hash_node {
1260
- yp_node_t base;
1261
- struct yp_node_list elements;
1262
- } yp_keyword_hash_node_t;
1263
-
1264
- // KeywordParameterNode
1265
- //
1266
- // Type: YP_KEYWORD_PARAMETER_NODE
1267
- typedef struct yp_keyword_parameter_node {
1268
- yp_node_t base;
1269
- yp_constant_id_t name;
1270
- yp_location_t name_loc;
1271
- struct yp_node *value;
1272
- } yp_keyword_parameter_node_t;
1273
-
1274
- // KeywordRestParameterNode
1275
- //
1276
- // Type: YP_KEYWORD_REST_PARAMETER_NODE
1277
- typedef struct yp_keyword_rest_parameter_node {
1278
- yp_node_t base;
1279
- yp_constant_id_t name;
1280
- yp_location_t name_loc;
1281
- yp_location_t operator_loc;
1282
- } yp_keyword_rest_parameter_node_t;
1283
-
1284
- // LambdaNode
1285
- //
1286
- // Type: YP_LAMBDA_NODE
1287
- typedef struct yp_lambda_node {
1288
- yp_node_t base;
1289
- yp_constant_id_list_t locals;
1290
- yp_location_t operator_loc;
1291
- yp_location_t opening_loc;
1292
- yp_location_t closing_loc;
1293
- struct yp_block_parameters_node *parameters;
1294
- struct yp_node *body;
1295
- } yp_lambda_node_t;
1296
-
1297
- // LocalVariableAndWriteNode
1298
- //
1299
- // Type: YP_LOCAL_VARIABLE_AND_WRITE_NODE
1300
- typedef struct yp_local_variable_and_write_node {
1301
- yp_node_t base;
1302
- yp_location_t name_loc;
1303
- yp_location_t operator_loc;
1304
- struct yp_node *value;
1305
- yp_constant_id_t name;
1306
- uint32_t depth;
1307
- } yp_local_variable_and_write_node_t;
1308
-
1309
- // LocalVariableOperatorWriteNode
1310
- //
1311
- // Type: YP_LOCAL_VARIABLE_OPERATOR_WRITE_NODE
1312
- typedef struct yp_local_variable_operator_write_node {
1313
- yp_node_t base;
1314
- yp_location_t name_loc;
1315
- yp_location_t operator_loc;
1316
- struct yp_node *value;
1317
- yp_constant_id_t name;
1318
- yp_constant_id_t operator;
1319
- uint32_t depth;
1320
- } yp_local_variable_operator_write_node_t;
1321
-
1322
- // LocalVariableOrWriteNode
1323
- //
1324
- // Type: YP_LOCAL_VARIABLE_OR_WRITE_NODE
1325
- typedef struct yp_local_variable_or_write_node {
1326
- yp_node_t base;
1327
- yp_location_t name_loc;
1328
- yp_location_t operator_loc;
1329
- struct yp_node *value;
1330
- yp_constant_id_t name;
1331
- uint32_t depth;
1332
- } yp_local_variable_or_write_node_t;
1333
-
1334
- // LocalVariableReadNode
1335
- //
1336
- // Type: YP_LOCAL_VARIABLE_READ_NODE
1337
- typedef struct yp_local_variable_read_node {
1338
- yp_node_t base;
1339
- yp_constant_id_t name;
1340
- uint32_t depth;
1341
- } yp_local_variable_read_node_t;
1342
-
1343
- // LocalVariableTargetNode
1344
- //
1345
- // Type: YP_LOCAL_VARIABLE_TARGET_NODE
1346
- typedef struct yp_local_variable_target_node {
1347
- yp_node_t base;
1348
- yp_constant_id_t name;
1349
- uint32_t depth;
1350
- } yp_local_variable_target_node_t;
1351
-
1352
- // LocalVariableWriteNode
1353
- //
1354
- // Type: YP_LOCAL_VARIABLE_WRITE_NODE
1355
- typedef struct yp_local_variable_write_node {
1356
- yp_node_t base;
1357
- yp_constant_id_t name;
1358
- uint32_t depth;
1359
- yp_location_t name_loc;
1360
- struct yp_node *value;
1361
- yp_location_t operator_loc;
1362
- } yp_local_variable_write_node_t;
1363
-
1364
- // MatchLastLineNode
1365
- //
1366
- // Type: YP_MATCH_LAST_LINE_NODE
1367
- // Flags:
1368
- // YP_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE
1369
- // YP_REGULAR_EXPRESSION_FLAGS_EXTENDED
1370
- // YP_REGULAR_EXPRESSION_FLAGS_MULTI_LINE
1371
- // YP_REGULAR_EXPRESSION_FLAGS_EUC_JP
1372
- // YP_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT
1373
- // YP_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J
1374
- // YP_REGULAR_EXPRESSION_FLAGS_UTF_8
1375
- // YP_REGULAR_EXPRESSION_FLAGS_ONCE
1376
- typedef struct yp_match_last_line_node {
1377
- yp_node_t base;
1378
- yp_location_t opening_loc;
1379
- yp_location_t content_loc;
1380
- yp_location_t closing_loc;
1381
- yp_string_t unescaped;
1382
- } yp_match_last_line_node_t;
1383
-
1384
- // MatchPredicateNode
1385
- //
1386
- // Type: YP_MATCH_PREDICATE_NODE
1387
- typedef struct yp_match_predicate_node {
1388
- yp_node_t base;
1389
- struct yp_node *value;
1390
- struct yp_node *pattern;
1391
- yp_location_t operator_loc;
1392
- } yp_match_predicate_node_t;
1393
-
1394
- // MatchRequiredNode
1395
- //
1396
- // Type: YP_MATCH_REQUIRED_NODE
1397
- typedef struct yp_match_required_node {
1398
- yp_node_t base;
1399
- struct yp_node *value;
1400
- struct yp_node *pattern;
1401
- yp_location_t operator_loc;
1402
- } yp_match_required_node_t;
1403
-
1404
- // MatchWriteNode
1405
- //
1406
- // Type: YP_MATCH_WRITE_NODE
1407
- typedef struct yp_match_write_node {
1408
- yp_node_t base;
1409
- struct yp_call_node *call;
1410
- yp_constant_id_list_t locals;
1411
- } yp_match_write_node_t;
1412
-
1413
- // MissingNode
1414
- //
1415
- // Type: YP_MISSING_NODE
1416
- typedef struct yp_missing_node {
1417
- yp_node_t base;
1418
- } yp_missing_node_t;
1419
-
1420
- // ModuleNode
1421
- //
1422
- // Type: YP_MODULE_NODE
1423
- typedef struct yp_module_node {
1424
- yp_node_t base;
1425
- yp_constant_id_list_t locals;
1426
- yp_location_t module_keyword_loc;
1427
- struct yp_node *constant_path;
1428
- struct yp_node *body;
1429
- yp_location_t end_keyword_loc;
1430
- yp_constant_id_t name;
1431
- } yp_module_node_t;
1432
-
1433
- // MultiTargetNode
1434
- //
1435
- // Type: YP_MULTI_TARGET_NODE
1436
- typedef struct yp_multi_target_node {
1437
- yp_node_t base;
1438
- struct yp_node_list targets;
1439
- yp_location_t lparen_loc;
1440
- yp_location_t rparen_loc;
1441
- } yp_multi_target_node_t;
1442
-
1443
- // MultiWriteNode
1444
- //
1445
- // Type: YP_MULTI_WRITE_NODE
1446
- typedef struct yp_multi_write_node {
1447
- yp_node_t base;
1448
- struct yp_node_list targets;
1449
- yp_location_t lparen_loc;
1450
- yp_location_t rparen_loc;
1451
- yp_location_t operator_loc;
1452
- struct yp_node *value;
1453
- } yp_multi_write_node_t;
1454
-
1455
- // NextNode
1456
- //
1457
- // Type: YP_NEXT_NODE
1458
- typedef struct yp_next_node {
1459
- yp_node_t base;
1460
- struct yp_arguments_node *arguments;
1461
- yp_location_t keyword_loc;
1462
- } yp_next_node_t;
1463
-
1464
- // NilNode
1465
- //
1466
- // Type: YP_NIL_NODE
1467
- typedef struct yp_nil_node {
1468
- yp_node_t base;
1469
- } yp_nil_node_t;
1470
-
1471
- // NoKeywordsParameterNode
1472
- //
1473
- // Type: YP_NO_KEYWORDS_PARAMETER_NODE
1474
- typedef struct yp_no_keywords_parameter_node {
1475
- yp_node_t base;
1476
- yp_location_t operator_loc;
1477
- yp_location_t keyword_loc;
1478
- } yp_no_keywords_parameter_node_t;
1479
-
1480
- // NumberedReferenceReadNode
1481
- //
1482
- // Type: YP_NUMBERED_REFERENCE_READ_NODE
1483
- typedef struct yp_numbered_reference_read_node {
1484
- yp_node_t base;
1485
- uint32_t number;
1486
- } yp_numbered_reference_read_node_t;
1487
-
1488
- // OptionalParameterNode
1489
- //
1490
- // Type: YP_OPTIONAL_PARAMETER_NODE
1491
- typedef struct yp_optional_parameter_node {
1492
- yp_node_t base;
1493
- yp_constant_id_t name;
1494
- yp_location_t name_loc;
1495
- yp_location_t operator_loc;
1496
- struct yp_node *value;
1497
- } yp_optional_parameter_node_t;
1498
-
1499
- // OrNode
1500
- //
1501
- // Type: YP_OR_NODE
1502
- typedef struct yp_or_node {
1503
- yp_node_t base;
1504
- struct yp_node *left;
1505
- struct yp_node *right;
1506
- yp_location_t operator_loc;
1507
- } yp_or_node_t;
1508
-
1509
- // ParametersNode
1510
- //
1511
- // Type: YP_PARAMETERS_NODE
1512
- typedef struct yp_parameters_node {
1513
- yp_node_t base;
1514
- struct yp_node_list requireds;
1515
- struct yp_node_list optionals;
1516
- struct yp_rest_parameter_node *rest;
1517
- struct yp_node_list posts;
1518
- struct yp_node_list keywords;
1519
- struct yp_node *keyword_rest;
1520
- struct yp_block_parameter_node *block;
1521
- } yp_parameters_node_t;
1522
-
1523
- // ParenthesesNode
1524
- //
1525
- // Type: YP_PARENTHESES_NODE
1526
- typedef struct yp_parentheses_node {
1527
- yp_node_t base;
1528
- struct yp_node *body;
1529
- yp_location_t opening_loc;
1530
- yp_location_t closing_loc;
1531
- } yp_parentheses_node_t;
1532
-
1533
- // PinnedExpressionNode
1534
- //
1535
- // Type: YP_PINNED_EXPRESSION_NODE
1536
- typedef struct yp_pinned_expression_node {
1537
- yp_node_t base;
1538
- struct yp_node *expression;
1539
- yp_location_t operator_loc;
1540
- yp_location_t lparen_loc;
1541
- yp_location_t rparen_loc;
1542
- } yp_pinned_expression_node_t;
1543
-
1544
- // PinnedVariableNode
1545
- //
1546
- // Type: YP_PINNED_VARIABLE_NODE
1547
- typedef struct yp_pinned_variable_node {
1548
- yp_node_t base;
1549
- struct yp_node *variable;
1550
- yp_location_t operator_loc;
1551
- } yp_pinned_variable_node_t;
1552
-
1553
- // PostExecutionNode
1554
- //
1555
- // Type: YP_POST_EXECUTION_NODE
1556
- typedef struct yp_post_execution_node {
1557
- yp_node_t base;
1558
- struct yp_statements_node *statements;
1559
- yp_location_t keyword_loc;
1560
- yp_location_t opening_loc;
1561
- yp_location_t closing_loc;
1562
- } yp_post_execution_node_t;
1563
-
1564
- // PreExecutionNode
1565
- //
1566
- // Type: YP_PRE_EXECUTION_NODE
1567
- typedef struct yp_pre_execution_node {
1568
- yp_node_t base;
1569
- struct yp_statements_node *statements;
1570
- yp_location_t keyword_loc;
1571
- yp_location_t opening_loc;
1572
- yp_location_t closing_loc;
1573
- } yp_pre_execution_node_t;
1574
-
1575
- // ProgramNode
1576
- //
1577
- // Type: YP_PROGRAM_NODE
1578
- typedef struct yp_program_node {
1579
- yp_node_t base;
1580
- yp_constant_id_list_t locals;
1581
- struct yp_statements_node *statements;
1582
- } yp_program_node_t;
1583
-
1584
- // RangeNode
1585
- //
1586
- // Type: YP_RANGE_NODE
1587
- // Flags:
1588
- // YP_RANGE_FLAGS_EXCLUDE_END
1589
- typedef struct yp_range_node {
1590
- yp_node_t base;
1591
- struct yp_node *left;
1592
- struct yp_node *right;
1593
- yp_location_t operator_loc;
1594
- } yp_range_node_t;
1595
-
1596
- // RationalNode
1597
- //
1598
- // Type: YP_RATIONAL_NODE
1599
- typedef struct yp_rational_node {
1600
- yp_node_t base;
1601
- struct yp_node *numeric;
1602
- } yp_rational_node_t;
1603
-
1604
- // RedoNode
1605
- //
1606
- // Type: YP_REDO_NODE
1607
- typedef struct yp_redo_node {
1608
- yp_node_t base;
1609
- } yp_redo_node_t;
1610
-
1611
- // RegularExpressionNode
1612
- //
1613
- // Type: YP_REGULAR_EXPRESSION_NODE
1614
- // Flags:
1615
- // YP_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE
1616
- // YP_REGULAR_EXPRESSION_FLAGS_EXTENDED
1617
- // YP_REGULAR_EXPRESSION_FLAGS_MULTI_LINE
1618
- // YP_REGULAR_EXPRESSION_FLAGS_EUC_JP
1619
- // YP_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT
1620
- // YP_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J
1621
- // YP_REGULAR_EXPRESSION_FLAGS_UTF_8
1622
- // YP_REGULAR_EXPRESSION_FLAGS_ONCE
1623
- typedef struct yp_regular_expression_node {
1624
- yp_node_t base;
1625
- yp_location_t opening_loc;
1626
- yp_location_t content_loc;
1627
- yp_location_t closing_loc;
1628
- yp_string_t unescaped;
1629
- } yp_regular_expression_node_t;
1630
-
1631
- // RequiredDestructuredParameterNode
1632
- //
1633
- // Type: YP_REQUIRED_DESTRUCTURED_PARAMETER_NODE
1634
- typedef struct yp_required_destructured_parameter_node {
1635
- yp_node_t base;
1636
- struct yp_node_list parameters;
1637
- yp_location_t opening_loc;
1638
- yp_location_t closing_loc;
1639
- } yp_required_destructured_parameter_node_t;
1640
-
1641
- // RequiredParameterNode
1642
- //
1643
- // Type: YP_REQUIRED_PARAMETER_NODE
1644
- typedef struct yp_required_parameter_node {
1645
- yp_node_t base;
1646
- yp_constant_id_t name;
1647
- } yp_required_parameter_node_t;
1648
-
1649
- // RescueModifierNode
1650
- //
1651
- // Type: YP_RESCUE_MODIFIER_NODE
1652
- typedef struct yp_rescue_modifier_node {
1653
- yp_node_t base;
1654
- struct yp_node *expression;
1655
- yp_location_t keyword_loc;
1656
- struct yp_node *rescue_expression;
1657
- } yp_rescue_modifier_node_t;
1658
-
1659
- // RescueNode
1660
- //
1661
- // Type: YP_RESCUE_NODE
1662
- typedef struct yp_rescue_node {
1663
- yp_node_t base;
1664
- yp_location_t keyword_loc;
1665
- struct yp_node_list exceptions;
1666
- yp_location_t operator_loc;
1667
- struct yp_node *reference;
1668
- struct yp_statements_node *statements;
1669
- struct yp_rescue_node *consequent;
1670
- } yp_rescue_node_t;
1671
-
1672
- // RestParameterNode
1673
- //
1674
- // Type: YP_REST_PARAMETER_NODE
1675
- typedef struct yp_rest_parameter_node {
1676
- yp_node_t base;
1677
- yp_constant_id_t name;
1678
- yp_location_t name_loc;
1679
- yp_location_t operator_loc;
1680
- } yp_rest_parameter_node_t;
1681
-
1682
- // RetryNode
1683
- //
1684
- // Type: YP_RETRY_NODE
1685
- typedef struct yp_retry_node {
1686
- yp_node_t base;
1687
- } yp_retry_node_t;
1688
-
1689
- // ReturnNode
1690
- //
1691
- // Type: YP_RETURN_NODE
1692
- typedef struct yp_return_node {
1693
- yp_node_t base;
1694
- yp_location_t keyword_loc;
1695
- struct yp_arguments_node *arguments;
1696
- } yp_return_node_t;
1697
-
1698
- // SelfNode
1699
- //
1700
- // Type: YP_SELF_NODE
1701
- typedef struct yp_self_node {
1702
- yp_node_t base;
1703
- } yp_self_node_t;
1704
-
1705
- // SingletonClassNode
1706
- //
1707
- // Type: YP_SINGLETON_CLASS_NODE
1708
- typedef struct yp_singleton_class_node {
1709
- yp_node_t base;
1710
- yp_constant_id_list_t locals;
1711
- yp_location_t class_keyword_loc;
1712
- yp_location_t operator_loc;
1713
- struct yp_node *expression;
1714
- struct yp_node *body;
1715
- yp_location_t end_keyword_loc;
1716
- } yp_singleton_class_node_t;
1717
-
1718
- // SourceEncodingNode
1719
- //
1720
- // Type: YP_SOURCE_ENCODING_NODE
1721
- typedef struct yp_source_encoding_node {
1722
- yp_node_t base;
1723
- } yp_source_encoding_node_t;
1724
-
1725
- // SourceFileNode
1726
- //
1727
- // Type: YP_SOURCE_FILE_NODE
1728
- typedef struct yp_source_file_node {
1729
- yp_node_t base;
1730
- yp_string_t filepath;
1731
- } yp_source_file_node_t;
1732
-
1733
- // SourceLineNode
1734
- //
1735
- // Type: YP_SOURCE_LINE_NODE
1736
- typedef struct yp_source_line_node {
1737
- yp_node_t base;
1738
- } yp_source_line_node_t;
1739
-
1740
- // SplatNode
1741
- //
1742
- // Type: YP_SPLAT_NODE
1743
- typedef struct yp_splat_node {
1744
- yp_node_t base;
1745
- yp_location_t operator_loc;
1746
- struct yp_node *expression;
1747
- } yp_splat_node_t;
1748
-
1749
- // StatementsNode
1750
- //
1751
- // Type: YP_STATEMENTS_NODE
1752
- typedef struct yp_statements_node {
1753
- yp_node_t base;
1754
- struct yp_node_list body;
1755
- } yp_statements_node_t;
1756
-
1757
- // StringConcatNode
1758
- //
1759
- // Type: YP_STRING_CONCAT_NODE
1760
- typedef struct yp_string_concat_node {
1761
- yp_node_t base;
1762
- struct yp_node *left;
1763
- struct yp_node *right;
1764
- } yp_string_concat_node_t;
1765
-
1766
- // StringNode
1767
- //
1768
- // Type: YP_STRING_NODE
1769
- // Flags:
1770
- // YP_STRING_FLAGS_FROZEN
1771
- typedef struct yp_string_node {
1772
- yp_node_t base;
1773
- yp_location_t opening_loc;
1774
- yp_location_t content_loc;
1775
- yp_location_t closing_loc;
1776
- yp_string_t unescaped;
1777
- } yp_string_node_t;
1778
-
1779
- // SuperNode
1780
- //
1781
- // Type: YP_SUPER_NODE
1782
- typedef struct yp_super_node {
1783
- yp_node_t base;
1784
- yp_location_t keyword_loc;
1785
- yp_location_t lparen_loc;
1786
- struct yp_arguments_node *arguments;
1787
- yp_location_t rparen_loc;
1788
- struct yp_block_node *block;
1789
- } yp_super_node_t;
1790
-
1791
- // SymbolNode
1792
- //
1793
- // Type: YP_SYMBOL_NODE
1794
- typedef struct yp_symbol_node {
1795
- yp_node_t base;
1796
- yp_location_t opening_loc;
1797
- yp_location_t value_loc;
1798
- yp_location_t closing_loc;
1799
- yp_string_t unescaped;
1800
- } yp_symbol_node_t;
1801
-
1802
- // TrueNode
1803
- //
1804
- // Type: YP_TRUE_NODE
1805
- typedef struct yp_true_node {
1806
- yp_node_t base;
1807
- } yp_true_node_t;
1808
-
1809
- // UndefNode
1810
- //
1811
- // Type: YP_UNDEF_NODE
1812
- typedef struct yp_undef_node {
1813
- yp_node_t base;
1814
- struct yp_node_list names;
1815
- yp_location_t keyword_loc;
1816
- } yp_undef_node_t;
1817
-
1818
- // UnlessNode
1819
- //
1820
- // Type: YP_UNLESS_NODE
1821
- typedef struct yp_unless_node {
1822
- yp_node_t base;
1823
- yp_location_t keyword_loc;
1824
- struct yp_node *predicate;
1825
- struct yp_statements_node *statements;
1826
- struct yp_else_node *consequent;
1827
- yp_location_t end_keyword_loc;
1828
- } yp_unless_node_t;
1829
-
1830
- // UntilNode
1831
- //
1832
- // Type: YP_UNTIL_NODE
1833
- // Flags:
1834
- // YP_LOOP_FLAGS_BEGIN_MODIFIER
1835
- typedef struct yp_until_node {
1836
- yp_node_t base;
1837
- yp_location_t keyword_loc;
1838
- yp_location_t closing_loc;
1839
- struct yp_node *predicate;
1840
- struct yp_statements_node *statements;
1841
- } yp_until_node_t;
1842
-
1843
- // WhenNode
1844
- //
1845
- // Type: YP_WHEN_NODE
1846
- typedef struct yp_when_node {
1847
- yp_node_t base;
1848
- yp_location_t keyword_loc;
1849
- struct yp_node_list conditions;
1850
- struct yp_statements_node *statements;
1851
- } yp_when_node_t;
1852
-
1853
- // WhileNode
1854
- //
1855
- // Type: YP_WHILE_NODE
1856
- // Flags:
1857
- // YP_LOOP_FLAGS_BEGIN_MODIFIER
1858
- typedef struct yp_while_node {
1859
- yp_node_t base;
1860
- yp_location_t keyword_loc;
1861
- yp_location_t closing_loc;
1862
- struct yp_node *predicate;
1863
- struct yp_statements_node *statements;
1864
- } yp_while_node_t;
1865
-
1866
- // XStringNode
1867
- //
1868
- // Type: YP_X_STRING_NODE
1869
- typedef struct yp_x_string_node {
1870
- yp_node_t base;
1871
- yp_location_t opening_loc;
1872
- yp_location_t content_loc;
1873
- yp_location_t closing_loc;
1874
- yp_string_t unescaped;
1875
- } yp_x_string_node_t;
1876
-
1877
- // YieldNode
1878
- //
1879
- // Type: YP_YIELD_NODE
1880
- typedef struct yp_yield_node {
1881
- yp_node_t base;
1882
- yp_location_t keyword_loc;
1883
- yp_location_t lparen_loc;
1884
- struct yp_arguments_node *arguments;
1885
- yp_location_t rparen_loc;
1886
- } yp_yield_node_t;
1887
-
1888
- // CallNodeFlags
1889
- typedef enum {
1890
- YP_CALL_NODE_FLAGS_SAFE_NAVIGATION = 1 << 2,
1891
- YP_CALL_NODE_FLAGS_VARIABLE_CALL = 1 << 3,
1892
- } yp_call_node_flags_t;
1893
-
1894
- // IntegerBaseFlags
1895
- typedef enum {
1896
- YP_INTEGER_BASE_FLAGS_BINARY = 1 << 2,
1897
- YP_INTEGER_BASE_FLAGS_OCTAL = 1 << 3,
1898
- YP_INTEGER_BASE_FLAGS_DECIMAL = 1 << 4,
1899
- YP_INTEGER_BASE_FLAGS_HEXADECIMAL = 1 << 5,
1900
- } yp_integer_base_flags_t;
1901
-
1902
- // LoopFlags
1903
- typedef enum {
1904
- YP_LOOP_FLAGS_BEGIN_MODIFIER = 1 << 2,
1905
- } yp_loop_flags_t;
1906
-
1907
- // RangeFlags
1908
- typedef enum {
1909
- YP_RANGE_FLAGS_EXCLUDE_END = 1 << 2,
1910
- } yp_range_flags_t;
1911
-
1912
- // RegularExpressionFlags
1913
- typedef enum {
1914
- YP_REGULAR_EXPRESSION_FLAGS_IGNORE_CASE = 1 << 2,
1915
- YP_REGULAR_EXPRESSION_FLAGS_EXTENDED = 1 << 3,
1916
- YP_REGULAR_EXPRESSION_FLAGS_MULTI_LINE = 1 << 4,
1917
- YP_REGULAR_EXPRESSION_FLAGS_EUC_JP = 1 << 5,
1918
- YP_REGULAR_EXPRESSION_FLAGS_ASCII_8BIT = 1 << 6,
1919
- YP_REGULAR_EXPRESSION_FLAGS_WINDOWS_31J = 1 << 7,
1920
- YP_REGULAR_EXPRESSION_FLAGS_UTF_8 = 1 << 8,
1921
- YP_REGULAR_EXPRESSION_FLAGS_ONCE = 1 << 9,
1922
- } yp_regular_expression_flags_t;
1923
-
1924
- // StringFlags
1925
- typedef enum {
1926
- YP_STRING_FLAGS_FROZEN = 1 << 2,
1927
- } yp_string_flags_t;
1928
-
1929
- #endif // YARP_AST_H