yarp 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -8
- data/CONTRIBUTING.md +2 -2
- data/Makefile +5 -5
- data/README.md +11 -12
- data/config.yml +6 -2
- data/docs/build_system.md +21 -21
- data/docs/building.md +4 -4
- data/docs/configuration.md +25 -21
- data/docs/design.md +2 -2
- data/docs/encoding.md +17 -17
- data/docs/fuzzing.md +4 -4
- data/docs/heredocs.md +3 -3
- data/docs/mapping.md +94 -94
- data/docs/ripper.md +4 -4
- data/docs/ruby_api.md +11 -11
- data/docs/serialization.md +17 -16
- data/docs/testing.md +6 -6
- data/ext/prism/api_node.c +4725 -0
- data/ext/{yarp → prism}/api_pack.c +82 -82
- data/ext/{yarp → prism}/extconf.rb +13 -13
- data/ext/{yarp → prism}/extension.c +175 -168
- data/ext/prism/extension.h +18 -0
- data/include/prism/ast.h +1932 -0
- data/include/prism/defines.h +45 -0
- data/include/prism/diagnostic.h +231 -0
- data/include/{yarp/enc/yp_encoding.h → prism/enc/pm_encoding.h} +40 -40
- data/include/prism/node.h +41 -0
- data/include/prism/pack.h +141 -0
- data/include/{yarp → prism}/parser.h +143 -142
- data/include/prism/regexp.h +19 -0
- data/include/prism/unescape.h +48 -0
- data/include/prism/util/pm_buffer.h +51 -0
- data/include/{yarp/util/yp_char.h → prism/util/pm_char.h} +20 -20
- data/include/{yarp/util/yp_constant_pool.h → prism/util/pm_constant_pool.h} +26 -22
- data/include/{yarp/util/yp_list.h → prism/util/pm_list.h} +21 -21
- data/include/prism/util/pm_memchr.h +14 -0
- data/include/{yarp/util/yp_newline_list.h → prism/util/pm_newline_list.h} +11 -11
- data/include/prism/util/pm_state_stack.h +24 -0
- data/include/{yarp/util/yp_string.h → prism/util/pm_string.h} +20 -20
- data/include/prism/util/pm_string_list.h +25 -0
- data/include/{yarp/util/yp_strpbrk.h → prism/util/pm_strpbrk.h} +7 -7
- data/include/prism/version.h +4 -0
- data/include/prism.h +82 -0
- data/lib/prism/compiler.rb +465 -0
- data/lib/prism/debug.rb +157 -0
- data/lib/{yarp/desugar_visitor.rb → prism/desugar_compiler.rb} +4 -2
- data/lib/prism/dispatcher.rb +2051 -0
- data/lib/prism/dsl.rb +750 -0
- data/lib/{yarp → prism}/ffi.rb +66 -67
- data/lib/{yarp → prism}/lex_compat.rb +40 -43
- data/lib/{yarp/mutation_visitor.rb → prism/mutation_compiler.rb} +3 -3
- data/lib/{yarp → prism}/node.rb +2012 -2593
- data/lib/prism/node_ext.rb +55 -0
- data/lib/prism/node_inspector.rb +68 -0
- data/lib/{yarp → prism}/pack.rb +1 -1
- data/lib/{yarp → prism}/parse_result/comments.rb +1 -1
- data/lib/{yarp → prism}/parse_result/newlines.rb +1 -1
- data/lib/prism/parse_result.rb +266 -0
- data/lib/{yarp → prism}/pattern.rb +14 -14
- data/lib/{yarp → prism}/ripper_compat.rb +5 -5
- data/lib/{yarp → prism}/serialize.rb +12 -7
- data/lib/prism/visitor.rb +470 -0
- data/lib/prism.rb +64 -0
- data/lib/yarp.rb +2 -614
- data/src/diagnostic.c +213 -208
- data/src/enc/pm_big5.c +52 -0
- data/src/enc/pm_euc_jp.c +58 -0
- data/src/enc/{yp_gbk.c → pm_gbk.c} +16 -16
- data/src/enc/pm_shift_jis.c +56 -0
- data/src/enc/{yp_tables.c → pm_tables.c} +69 -69
- data/src/enc/{yp_unicode.c → pm_unicode.c} +40 -40
- data/src/enc/pm_windows_31j.c +56 -0
- data/src/node.c +1293 -1233
- data/src/pack.c +247 -247
- data/src/prettyprint.c +1479 -1479
- data/src/{yarp.c → prism.c} +5205 -5083
- data/src/regexp.c +132 -132
- data/src/serialize.c +1121 -1121
- data/src/token_type.c +169 -167
- data/src/unescape.c +106 -87
- data/src/util/pm_buffer.c +103 -0
- data/src/util/{yp_char.c → pm_char.c} +72 -72
- data/src/util/{yp_constant_pool.c → pm_constant_pool.c} +85 -64
- data/src/util/{yp_list.c → pm_list.c} +10 -10
- data/src/util/{yp_memchr.c → pm_memchr.c} +6 -4
- data/src/util/{yp_newline_list.c → pm_newline_list.c} +21 -21
- data/src/util/{yp_state_stack.c → pm_state_stack.c} +4 -4
- data/src/util/{yp_string.c → pm_string.c} +38 -38
- data/src/util/pm_string_list.c +29 -0
- data/src/util/{yp_strncasecmp.c → pm_strncasecmp.c} +1 -1
- data/src/util/{yp_strpbrk.c → pm_strpbrk.c} +8 -8
- data/yarp.gemspec +68 -59
- metadata +70 -61
- data/ext/yarp/api_node.c +0 -4728
- data/ext/yarp/extension.h +0 -18
- data/include/yarp/ast.h +0 -1929
- data/include/yarp/defines.h +0 -45
- data/include/yarp/diagnostic.h +0 -226
- data/include/yarp/node.h +0 -42
- data/include/yarp/pack.h +0 -141
- data/include/yarp/regexp.h +0 -19
- data/include/yarp/unescape.h +0 -44
- data/include/yarp/util/yp_buffer.h +0 -51
- data/include/yarp/util/yp_memchr.h +0 -14
- data/include/yarp/util/yp_state_stack.h +0 -24
- data/include/yarp/util/yp_string_list.h +0 -25
- data/include/yarp/version.h +0 -4
- data/include/yarp.h +0 -82
- data/src/enc/yp_big5.c +0 -52
- data/src/enc/yp_euc_jp.c +0 -58
- data/src/enc/yp_shift_jis.c +0 -56
- data/src/enc/yp_windows_31j.c +0 -56
- data/src/util/yp_buffer.c +0 -101
- data/src/util/yp_string_list.c +0 -29
@@ -1,9 +1,9 @@
|
|
1
|
-
#include "
|
1
|
+
#include "prism/extension.h"
|
2
2
|
|
3
|
-
static VALUE
|
4
|
-
static VALUE
|
5
|
-
static VALUE
|
6
|
-
static VALUE
|
3
|
+
static VALUE rb_cPrism;
|
4
|
+
static VALUE rb_cPrismPack;
|
5
|
+
static VALUE rb_cPrismPackDirective;
|
6
|
+
static VALUE rb_cPrismPackFormat;
|
7
7
|
|
8
8
|
static VALUE v3_2_0_symbol;
|
9
9
|
static VALUE pack_symbol;
|
@@ -20,49 +20,49 @@ static VALUE unpack_symbol;
|
|
20
20
|
#endif
|
21
21
|
|
22
22
|
static VALUE
|
23
|
-
pack_type_to_symbol(
|
23
|
+
pack_type_to_symbol(pm_pack_type type) {
|
24
24
|
switch (type) {
|
25
|
-
case
|
25
|
+
case PM_PACK_SPACE:
|
26
26
|
return ID2SYM(rb_intern("SPACE"));
|
27
|
-
case
|
27
|
+
case PM_PACK_COMMENT:
|
28
28
|
return ID2SYM(rb_intern("COMMENT"));
|
29
|
-
case
|
29
|
+
case PM_PACK_INTEGER:
|
30
30
|
return ID2SYM(rb_intern("INTEGER"));
|
31
|
-
case
|
31
|
+
case PM_PACK_UTF8:
|
32
32
|
return ID2SYM(rb_intern("UTF8"));
|
33
|
-
case
|
33
|
+
case PM_PACK_BER:
|
34
34
|
return ID2SYM(rb_intern("BER"));
|
35
|
-
case
|
35
|
+
case PM_PACK_FLOAT:
|
36
36
|
return ID2SYM(rb_intern("FLOAT"));
|
37
|
-
case
|
37
|
+
case PM_PACK_STRING_SPACE_PADDED:
|
38
38
|
return ID2SYM(rb_intern("STRING_SPACE_PADDED"));
|
39
|
-
case
|
39
|
+
case PM_PACK_STRING_NULL_PADDED:
|
40
40
|
return ID2SYM(rb_intern("STRING_NULL_PADDED"));
|
41
|
-
case
|
41
|
+
case PM_PACK_STRING_NULL_TERMINATED:
|
42
42
|
return ID2SYM(rb_intern("STRING_NULL_TERMINATED"));
|
43
|
-
case
|
43
|
+
case PM_PACK_STRING_MSB:
|
44
44
|
return ID2SYM(rb_intern("STRING_MSB"));
|
45
|
-
case
|
45
|
+
case PM_PACK_STRING_LSB:
|
46
46
|
return ID2SYM(rb_intern("STRING_LSB"));
|
47
|
-
case
|
47
|
+
case PM_PACK_STRING_HEX_HIGH:
|
48
48
|
return ID2SYM(rb_intern("STRING_HEX_HIGH"));
|
49
|
-
case
|
49
|
+
case PM_PACK_STRING_HEX_LOW:
|
50
50
|
return ID2SYM(rb_intern("STRING_HEX_LOW"));
|
51
|
-
case
|
51
|
+
case PM_PACK_STRING_UU:
|
52
52
|
return ID2SYM(rb_intern("STRING_UU"));
|
53
|
-
case
|
53
|
+
case PM_PACK_STRING_MIME:
|
54
54
|
return ID2SYM(rb_intern("STRING_MIME"));
|
55
|
-
case
|
55
|
+
case PM_PACK_STRING_BASE64:
|
56
56
|
return ID2SYM(rb_intern("STRING_BASE64"));
|
57
|
-
case
|
57
|
+
case PM_PACK_STRING_FIXED:
|
58
58
|
return ID2SYM(rb_intern("STRING_FIXED"));
|
59
|
-
case
|
59
|
+
case PM_PACK_STRING_POINTER:
|
60
60
|
return ID2SYM(rb_intern("STRING_POINTER"));
|
61
|
-
case
|
61
|
+
case PM_PACK_MOVE:
|
62
62
|
return ID2SYM(rb_intern("MOVE"));
|
63
|
-
case
|
63
|
+
case PM_PACK_BACK:
|
64
64
|
return ID2SYM(rb_intern("BACK"));
|
65
|
-
case
|
65
|
+
case PM_PACK_NULL:
|
66
66
|
return ID2SYM(rb_intern("NULL"));
|
67
67
|
default:
|
68
68
|
return Qnil;
|
@@ -70,13 +70,13 @@ pack_type_to_symbol(yp_pack_type type) {
|
|
70
70
|
}
|
71
71
|
|
72
72
|
static VALUE
|
73
|
-
pack_signed_to_symbol(
|
73
|
+
pack_signed_to_symbol(pm_pack_signed signed_type) {
|
74
74
|
switch (signed_type) {
|
75
|
-
case
|
75
|
+
case PM_PACK_UNSIGNED:
|
76
76
|
return ID2SYM(rb_intern("UNSIGNED"));
|
77
|
-
case
|
77
|
+
case PM_PACK_SIGNED:
|
78
78
|
return ID2SYM(rb_intern("SIGNED"));
|
79
|
-
case
|
79
|
+
case PM_PACK_SIGNED_NA:
|
80
80
|
return ID2SYM(rb_intern("SIGNED_NA"));
|
81
81
|
default:
|
82
82
|
return Qnil;
|
@@ -84,17 +84,17 @@ pack_signed_to_symbol(yp_pack_signed signed_type) {
|
|
84
84
|
}
|
85
85
|
|
86
86
|
static VALUE
|
87
|
-
pack_endian_to_symbol(
|
87
|
+
pack_endian_to_symbol(pm_pack_endian endian) {
|
88
88
|
switch (endian) {
|
89
|
-
case
|
89
|
+
case PM_PACK_AGNOSTIC_ENDIAN:
|
90
90
|
return ID2SYM(rb_intern("AGNOSTIC_ENDIAN"));
|
91
|
-
case
|
91
|
+
case PM_PACK_LITTLE_ENDIAN:
|
92
92
|
return ID2SYM(rb_intern("LITTLE_ENDIAN"));
|
93
|
-
case
|
93
|
+
case PM_PACK_BIG_ENDIAN:
|
94
94
|
return ID2SYM(rb_intern("BIG_ENDIAN"));
|
95
|
-
case
|
95
|
+
case PM_PACK_NATIVE_ENDIAN:
|
96
96
|
return ID2SYM(rb_intern("NATIVE_ENDIAN"));
|
97
|
-
case
|
97
|
+
case PM_PACK_ENDIAN_NA:
|
98
98
|
return ID2SYM(rb_intern("ENDIAN_NA"));
|
99
99
|
default:
|
100
100
|
return Qnil;
|
@@ -102,27 +102,27 @@ pack_endian_to_symbol(yp_pack_endian endian) {
|
|
102
102
|
}
|
103
103
|
|
104
104
|
static VALUE
|
105
|
-
pack_size_to_symbol(
|
105
|
+
pack_size_to_symbol(pm_pack_size size) {
|
106
106
|
switch (size) {
|
107
|
-
case
|
107
|
+
case PM_PACK_SIZE_SHORT:
|
108
108
|
return ID2SYM(rb_intern("SIZE_SHORT"));
|
109
|
-
case
|
109
|
+
case PM_PACK_SIZE_INT:
|
110
110
|
return ID2SYM(rb_intern("SIZE_INT"));
|
111
|
-
case
|
111
|
+
case PM_PACK_SIZE_LONG:
|
112
112
|
return ID2SYM(rb_intern("SIZE_LONG"));
|
113
|
-
case
|
113
|
+
case PM_PACK_SIZE_LONG_LONG:
|
114
114
|
return ID2SYM(rb_intern("SIZE_LONG_LONG"));
|
115
|
-
case
|
115
|
+
case PM_PACK_SIZE_8:
|
116
116
|
return ID2SYM(rb_intern("SIZE_8"));
|
117
|
-
case
|
117
|
+
case PM_PACK_SIZE_16:
|
118
118
|
return ID2SYM(rb_intern("SIZE_16"));
|
119
|
-
case
|
119
|
+
case PM_PACK_SIZE_32:
|
120
120
|
return ID2SYM(rb_intern("SIZE_32"));
|
121
|
-
case
|
121
|
+
case PM_PACK_SIZE_64:
|
122
122
|
return ID2SYM(rb_intern("SIZE_64"));
|
123
|
-
case
|
123
|
+
case PM_PACK_SIZE_P:
|
124
124
|
return ID2SYM(rb_intern("SIZE_P"));
|
125
|
-
case
|
125
|
+
case PM_PACK_SIZE_NA:
|
126
126
|
return ID2SYM(rb_intern("SIZE_NA"));
|
127
127
|
default:
|
128
128
|
return Qnil;
|
@@ -130,15 +130,15 @@ pack_size_to_symbol(yp_pack_size size) {
|
|
130
130
|
}
|
131
131
|
|
132
132
|
static VALUE
|
133
|
-
pack_length_type_to_symbol(
|
133
|
+
pack_length_type_to_symbol(pm_pack_length_type length_type) {
|
134
134
|
switch (length_type) {
|
135
|
-
case
|
135
|
+
case PM_PACK_LENGTH_FIXED:
|
136
136
|
return ID2SYM(rb_intern("LENGTH_FIXED"));
|
137
|
-
case
|
137
|
+
case PM_PACK_LENGTH_MAX:
|
138
138
|
return ID2SYM(rb_intern("LENGTH_MAX"));
|
139
|
-
case
|
139
|
+
case PM_PACK_LENGTH_RELATIVE:
|
140
140
|
return ID2SYM(rb_intern("LENGTH_RELATIVE"));
|
141
|
-
case
|
141
|
+
case PM_PACK_LENGTH_NA:
|
142
142
|
return ID2SYM(rb_intern("LENGTH_NA"));
|
143
143
|
default:
|
144
144
|
return Qnil;
|
@@ -146,16 +146,16 @@ pack_length_type_to_symbol(yp_pack_length_type length_type) {
|
|
146
146
|
}
|
147
147
|
|
148
148
|
static VALUE
|
149
|
-
pack_encoding_to_ruby(
|
149
|
+
pack_encoding_to_ruby(pm_pack_encoding encoding) {
|
150
150
|
int index;
|
151
151
|
switch (encoding) {
|
152
|
-
case
|
152
|
+
case PM_PACK_ENCODING_ASCII_8BIT:
|
153
153
|
index = rb_ascii8bit_encindex();
|
154
154
|
break;
|
155
|
-
case
|
155
|
+
case PM_PACK_ENCODING_US_ASCII:
|
156
156
|
index = rb_usascii_encindex();
|
157
157
|
break;
|
158
|
-
case
|
158
|
+
case PM_PACK_ENCODING_UTF_8:
|
159
159
|
index = rb_utf8_encindex();
|
160
160
|
break;
|
161
161
|
default:
|
@@ -170,11 +170,11 @@ pack_parse(VALUE self, VALUE version_symbol, VALUE variant_symbol, VALUE format_
|
|
170
170
|
rb_raise(rb_eArgError, "invalid version");
|
171
171
|
}
|
172
172
|
|
173
|
-
|
173
|
+
pm_pack_variant variant;
|
174
174
|
if (variant_symbol == pack_symbol) {
|
175
|
-
variant =
|
175
|
+
variant = PM_PACK_VARIANT_PACK;
|
176
176
|
} else if (variant_symbol == unpack_symbol) {
|
177
|
-
variant =
|
177
|
+
variant = PM_PACK_VARIANT_UNPACK;
|
178
178
|
} else {
|
179
179
|
rb_raise(rb_eArgError, "invalid variant");
|
180
180
|
}
|
@@ -183,43 +183,43 @@ pack_parse(VALUE self, VALUE version_symbol, VALUE variant_symbol, VALUE format_
|
|
183
183
|
|
184
184
|
const char *format = RSTRING_PTR(format_string);
|
185
185
|
const char *format_end = format + RSTRING_LEN(format_string);
|
186
|
-
|
186
|
+
pm_pack_encoding encoding = PM_PACK_ENCODING_START;
|
187
187
|
|
188
188
|
VALUE directives_array = rb_ary_new();
|
189
189
|
|
190
190
|
while (format < format_end) {
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
191
|
+
pm_pack_type type;
|
192
|
+
pm_pack_signed signed_type;
|
193
|
+
pm_pack_endian endian;
|
194
|
+
pm_pack_size size;
|
195
|
+
pm_pack_length_type length_type;
|
196
196
|
uint64_t length;
|
197
197
|
|
198
198
|
const char *directive_start = format;
|
199
199
|
|
200
|
-
|
200
|
+
pm_pack_result parse_result = pm_pack_parse(variant, &format, format_end, &type, &signed_type, &endian,
|
201
201
|
&size, &length_type, &length, &encoding);
|
202
202
|
|
203
203
|
const char *directive_end = format;
|
204
204
|
|
205
205
|
switch (parse_result) {
|
206
|
-
case
|
206
|
+
case PM_PACK_OK:
|
207
207
|
break;
|
208
|
-
case
|
208
|
+
case PM_PACK_ERROR_UNSUPPORTED_DIRECTIVE:
|
209
209
|
rb_raise(rb_eArgError, "unsupported directive");
|
210
|
-
case
|
210
|
+
case PM_PACK_ERROR_UNKNOWN_DIRECTIVE:
|
211
211
|
rb_raise(rb_eArgError, "unsupported directive");
|
212
|
-
case
|
212
|
+
case PM_PACK_ERROR_LENGTH_TOO_BIG:
|
213
213
|
rb_raise(rb_eRangeError, "pack length too big");
|
214
|
-
case
|
214
|
+
case PM_PACK_ERROR_BANG_NOT_ALLOWED:
|
215
215
|
rb_raise(rb_eRangeError, "bang not allowed");
|
216
|
-
case
|
216
|
+
case PM_PACK_ERROR_DOUBLE_ENDIAN:
|
217
217
|
rb_raise(rb_eRangeError, "double endian");
|
218
218
|
default:
|
219
219
|
rb_bug("parse result");
|
220
220
|
}
|
221
221
|
|
222
|
-
if (type ==
|
222
|
+
if (type == PM_PACK_END) {
|
223
223
|
break;
|
224
224
|
}
|
225
225
|
|
@@ -233,22 +233,22 @@ pack_parse(VALUE self, VALUE version_symbol, VALUE variant_symbol, VALUE format_
|
|
233
233
|
pack_length_type_to_symbol(length_type),
|
234
234
|
UINT64T2NUM(length) };
|
235
235
|
|
236
|
-
rb_ary_push(directives_array, rb_class_new_instance(9, directive_args,
|
236
|
+
rb_ary_push(directives_array, rb_class_new_instance(9, directive_args, rb_cPrismPackDirective));
|
237
237
|
}
|
238
238
|
|
239
239
|
VALUE format_args[2];
|
240
240
|
format_args[0] = directives_array;
|
241
241
|
format_args[1] = pack_encoding_to_ruby(encoding);
|
242
|
-
return rb_class_new_instance(2, format_args,
|
242
|
+
return rb_class_new_instance(2, format_args, rb_cPrismPackFormat);
|
243
243
|
}
|
244
244
|
|
245
245
|
void
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
rb_define_singleton_method(
|
246
|
+
Init_prism_pack(void) {
|
247
|
+
rb_cPrism = rb_define_module("Prism");
|
248
|
+
rb_cPrismPack = rb_define_module_under(rb_cPrism, "Pack");
|
249
|
+
rb_cPrismPackDirective = rb_define_class_under(rb_cPrismPack, "Directive", rb_cObject);
|
250
|
+
rb_cPrismPackFormat = rb_define_class_under(rb_cPrismPack, "Format", rb_cObject);
|
251
|
+
rb_define_singleton_method(rb_cPrismPack, "parse", pack_parse, 3);
|
252
252
|
|
253
253
|
v3_2_0_symbol = ID2SYM(rb_intern("v3_2_0"));
|
254
254
|
pack_symbol = ID2SYM(rb_intern("pack"));
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require "rbconfig"
|
4
4
|
|
5
|
-
module
|
5
|
+
module Prism
|
6
6
|
module ExtConf
|
7
7
|
class << self
|
8
8
|
def configure
|
@@ -19,7 +19,7 @@ module Yarp
|
|
19
19
|
configure_c_extension
|
20
20
|
configure_rubyparser
|
21
21
|
|
22
|
-
create_makefile("
|
22
|
+
create_makefile("prism/prism")
|
23
23
|
|
24
24
|
if static_link?
|
25
25
|
File.open('Makefile', 'a') do |mf|
|
@@ -31,7 +31,7 @@ module Yarp
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def configure_c_extension
|
34
|
-
append_cflags("-
|
34
|
+
append_cflags("-DPRISM_DEBUG_MODE_BUILD") if debug_mode_build?
|
35
35
|
append_cflags("-fvisibility=hidden")
|
36
36
|
end
|
37
37
|
|
@@ -47,17 +47,17 @@ module Yarp
|
|
47
47
|
unless File.exist?(shared_library_path)
|
48
48
|
build_shared_rubyparser
|
49
49
|
end
|
50
|
-
unless find_library("rubyparser", "
|
50
|
+
unless find_library("rubyparser", "pm_parser_init", build_dir)
|
51
51
|
raise "could not link against #{File.basename(shared_library_path)}"
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
find_header("
|
55
|
+
find_header("prism.h", include_dir) or raise "prism.h is required"
|
56
56
|
|
57
57
|
# Explicitly look for the extension header in the parent directory
|
58
|
-
# because we want to consistently look for
|
58
|
+
# because we want to consistently look for prism/extension.h in our
|
59
59
|
# source files to line up with our mirroring in CRuby.
|
60
|
-
find_header("
|
60
|
+
find_header("prism/extension.h", File.join(__dir__, "..")) or raise "prism/extension.h is required"
|
61
61
|
end
|
62
62
|
|
63
63
|
def build_shared_rubyparser
|
@@ -70,7 +70,7 @@ module Yarp
|
|
70
70
|
|
71
71
|
def build_target_rubyparser(target)
|
72
72
|
Dir.chdir(root_dir) do
|
73
|
-
if !File.exist?("include/
|
73
|
+
if !File.exist?("include/prism/ast.h") && Dir.exist?(".git")
|
74
74
|
# this block only exists to support building the gem from a "git" source,
|
75
75
|
# normally we package up the configure and other files in the gem itself
|
76
76
|
system("templates/template.rb", exception: true)
|
@@ -104,14 +104,14 @@ module Yarp
|
|
104
104
|
|
105
105
|
--enable-debug-mode-build
|
106
106
|
Enable debug mode build.
|
107
|
-
You may also use set
|
107
|
+
You may also use set PRISM_DEBUG_MODE_BUILD environment variable.
|
108
108
|
|
109
109
|
--help
|
110
110
|
Display this message.
|
111
111
|
|
112
112
|
Environment variables used:
|
113
113
|
|
114
|
-
|
114
|
+
PRISM_DEBUG_MODE_BUILD
|
115
115
|
Equivalent to `--enable-debug-mode-build` when set, even if nil or blank.
|
116
116
|
|
117
117
|
TEXT
|
@@ -122,15 +122,15 @@ module Yarp
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def debug_mode_build?
|
125
|
-
enable_config("debug-mode-build", ENV["
|
125
|
+
enable_config("debug-mode-build", ENV["PRISM_DEBUG_MODE_BUILD"] || false)
|
126
126
|
end
|
127
127
|
end
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
131
|
if ARGV.delete("--help")
|
132
|
-
|
132
|
+
Prism::ExtConf.print_help
|
133
133
|
exit!(0)
|
134
134
|
end
|
135
135
|
|
136
|
-
|
136
|
+
Prism::ExtConf.configure
|