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
@@ -1,9 +1,9 @@
1
- #include "yarp/extension.h"
1
+ #include "prism/extension.h"
2
2
 
3
- static VALUE rb_cYARP;
4
- static VALUE rb_cYARPPack;
5
- static VALUE rb_cYARPPackDirective;
6
- static VALUE rb_cYARPPackFormat;
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(yp_pack_type type) {
23
+ pack_type_to_symbol(pm_pack_type type) {
24
24
  switch (type) {
25
- case YP_PACK_SPACE:
25
+ case PM_PACK_SPACE:
26
26
  return ID2SYM(rb_intern("SPACE"));
27
- case YP_PACK_COMMENT:
27
+ case PM_PACK_COMMENT:
28
28
  return ID2SYM(rb_intern("COMMENT"));
29
- case YP_PACK_INTEGER:
29
+ case PM_PACK_INTEGER:
30
30
  return ID2SYM(rb_intern("INTEGER"));
31
- case YP_PACK_UTF8:
31
+ case PM_PACK_UTF8:
32
32
  return ID2SYM(rb_intern("UTF8"));
33
- case YP_PACK_BER:
33
+ case PM_PACK_BER:
34
34
  return ID2SYM(rb_intern("BER"));
35
- case YP_PACK_FLOAT:
35
+ case PM_PACK_FLOAT:
36
36
  return ID2SYM(rb_intern("FLOAT"));
37
- case YP_PACK_STRING_SPACE_PADDED:
37
+ case PM_PACK_STRING_SPACE_PADDED:
38
38
  return ID2SYM(rb_intern("STRING_SPACE_PADDED"));
39
- case YP_PACK_STRING_NULL_PADDED:
39
+ case PM_PACK_STRING_NULL_PADDED:
40
40
  return ID2SYM(rb_intern("STRING_NULL_PADDED"));
41
- case YP_PACK_STRING_NULL_TERMINATED:
41
+ case PM_PACK_STRING_NULL_TERMINATED:
42
42
  return ID2SYM(rb_intern("STRING_NULL_TERMINATED"));
43
- case YP_PACK_STRING_MSB:
43
+ case PM_PACK_STRING_MSB:
44
44
  return ID2SYM(rb_intern("STRING_MSB"));
45
- case YP_PACK_STRING_LSB:
45
+ case PM_PACK_STRING_LSB:
46
46
  return ID2SYM(rb_intern("STRING_LSB"));
47
- case YP_PACK_STRING_HEX_HIGH:
47
+ case PM_PACK_STRING_HEX_HIGH:
48
48
  return ID2SYM(rb_intern("STRING_HEX_HIGH"));
49
- case YP_PACK_STRING_HEX_LOW:
49
+ case PM_PACK_STRING_HEX_LOW:
50
50
  return ID2SYM(rb_intern("STRING_HEX_LOW"));
51
- case YP_PACK_STRING_UU:
51
+ case PM_PACK_STRING_UU:
52
52
  return ID2SYM(rb_intern("STRING_UU"));
53
- case YP_PACK_STRING_MIME:
53
+ case PM_PACK_STRING_MIME:
54
54
  return ID2SYM(rb_intern("STRING_MIME"));
55
- case YP_PACK_STRING_BASE64:
55
+ case PM_PACK_STRING_BASE64:
56
56
  return ID2SYM(rb_intern("STRING_BASE64"));
57
- case YP_PACK_STRING_FIXED:
57
+ case PM_PACK_STRING_FIXED:
58
58
  return ID2SYM(rb_intern("STRING_FIXED"));
59
- case YP_PACK_STRING_POINTER:
59
+ case PM_PACK_STRING_POINTER:
60
60
  return ID2SYM(rb_intern("STRING_POINTER"));
61
- case YP_PACK_MOVE:
61
+ case PM_PACK_MOVE:
62
62
  return ID2SYM(rb_intern("MOVE"));
63
- case YP_PACK_BACK:
63
+ case PM_PACK_BACK:
64
64
  return ID2SYM(rb_intern("BACK"));
65
- case YP_PACK_NULL:
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(yp_pack_signed signed_type) {
73
+ pack_signed_to_symbol(pm_pack_signed signed_type) {
74
74
  switch (signed_type) {
75
- case YP_PACK_UNSIGNED:
75
+ case PM_PACK_UNSIGNED:
76
76
  return ID2SYM(rb_intern("UNSIGNED"));
77
- case YP_PACK_SIGNED:
77
+ case PM_PACK_SIGNED:
78
78
  return ID2SYM(rb_intern("SIGNED"));
79
- case YP_PACK_SIGNED_NA:
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(yp_pack_endian endian) {
87
+ pack_endian_to_symbol(pm_pack_endian endian) {
88
88
  switch (endian) {
89
- case YP_PACK_AGNOSTIC_ENDIAN:
89
+ case PM_PACK_AGNOSTIC_ENDIAN:
90
90
  return ID2SYM(rb_intern("AGNOSTIC_ENDIAN"));
91
- case YP_PACK_LITTLE_ENDIAN:
91
+ case PM_PACK_LITTLE_ENDIAN:
92
92
  return ID2SYM(rb_intern("LITTLE_ENDIAN"));
93
- case YP_PACK_BIG_ENDIAN:
93
+ case PM_PACK_BIG_ENDIAN:
94
94
  return ID2SYM(rb_intern("BIG_ENDIAN"));
95
- case YP_PACK_NATIVE_ENDIAN:
95
+ case PM_PACK_NATIVE_ENDIAN:
96
96
  return ID2SYM(rb_intern("NATIVE_ENDIAN"));
97
- case YP_PACK_ENDIAN_NA:
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(yp_pack_size size) {
105
+ pack_size_to_symbol(pm_pack_size size) {
106
106
  switch (size) {
107
- case YP_PACK_SIZE_SHORT:
107
+ case PM_PACK_SIZE_SHORT:
108
108
  return ID2SYM(rb_intern("SIZE_SHORT"));
109
- case YP_PACK_SIZE_INT:
109
+ case PM_PACK_SIZE_INT:
110
110
  return ID2SYM(rb_intern("SIZE_INT"));
111
- case YP_PACK_SIZE_LONG:
111
+ case PM_PACK_SIZE_LONG:
112
112
  return ID2SYM(rb_intern("SIZE_LONG"));
113
- case YP_PACK_SIZE_LONG_LONG:
113
+ case PM_PACK_SIZE_LONG_LONG:
114
114
  return ID2SYM(rb_intern("SIZE_LONG_LONG"));
115
- case YP_PACK_SIZE_8:
115
+ case PM_PACK_SIZE_8:
116
116
  return ID2SYM(rb_intern("SIZE_8"));
117
- case YP_PACK_SIZE_16:
117
+ case PM_PACK_SIZE_16:
118
118
  return ID2SYM(rb_intern("SIZE_16"));
119
- case YP_PACK_SIZE_32:
119
+ case PM_PACK_SIZE_32:
120
120
  return ID2SYM(rb_intern("SIZE_32"));
121
- case YP_PACK_SIZE_64:
121
+ case PM_PACK_SIZE_64:
122
122
  return ID2SYM(rb_intern("SIZE_64"));
123
- case YP_PACK_SIZE_P:
123
+ case PM_PACK_SIZE_P:
124
124
  return ID2SYM(rb_intern("SIZE_P"));
125
- case YP_PACK_SIZE_NA:
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(yp_pack_length_type length_type) {
133
+ pack_length_type_to_symbol(pm_pack_length_type length_type) {
134
134
  switch (length_type) {
135
- case YP_PACK_LENGTH_FIXED:
135
+ case PM_PACK_LENGTH_FIXED:
136
136
  return ID2SYM(rb_intern("LENGTH_FIXED"));
137
- case YP_PACK_LENGTH_MAX:
137
+ case PM_PACK_LENGTH_MAX:
138
138
  return ID2SYM(rb_intern("LENGTH_MAX"));
139
- case YP_PACK_LENGTH_RELATIVE:
139
+ case PM_PACK_LENGTH_RELATIVE:
140
140
  return ID2SYM(rb_intern("LENGTH_RELATIVE"));
141
- case YP_PACK_LENGTH_NA:
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(yp_pack_encoding encoding) {
149
+ pack_encoding_to_ruby(pm_pack_encoding encoding) {
150
150
  int index;
151
151
  switch (encoding) {
152
- case YP_PACK_ENCODING_ASCII_8BIT:
152
+ case PM_PACK_ENCODING_ASCII_8BIT:
153
153
  index = rb_ascii8bit_encindex();
154
154
  break;
155
- case YP_PACK_ENCODING_US_ASCII:
155
+ case PM_PACK_ENCODING_US_ASCII:
156
156
  index = rb_usascii_encindex();
157
157
  break;
158
- case YP_PACK_ENCODING_UTF_8:
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
- yp_pack_variant variant;
173
+ pm_pack_variant variant;
174
174
  if (variant_symbol == pack_symbol) {
175
- variant = YP_PACK_VARIANT_PACK;
175
+ variant = PM_PACK_VARIANT_PACK;
176
176
  } else if (variant_symbol == unpack_symbol) {
177
- variant = YP_PACK_VARIANT_UNPACK;
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
- yp_pack_encoding encoding = YP_PACK_ENCODING_START;
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
- yp_pack_type type;
192
- yp_pack_signed signed_type;
193
- yp_pack_endian endian;
194
- yp_pack_size size;
195
- yp_pack_length_type length_type;
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
- yp_pack_result parse_result = yp_pack_parse(variant, &format, format_end, &type, &signed_type, &endian,
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 YP_PACK_OK:
206
+ case PM_PACK_OK:
207
207
  break;
208
- case YP_PACK_ERROR_UNSUPPORTED_DIRECTIVE:
208
+ case PM_PACK_ERROR_UNSUPPORTED_DIRECTIVE:
209
209
  rb_raise(rb_eArgError, "unsupported directive");
210
- case YP_PACK_ERROR_UNKNOWN_DIRECTIVE:
210
+ case PM_PACK_ERROR_UNKNOWN_DIRECTIVE:
211
211
  rb_raise(rb_eArgError, "unsupported directive");
212
- case YP_PACK_ERROR_LENGTH_TOO_BIG:
212
+ case PM_PACK_ERROR_LENGTH_TOO_BIG:
213
213
  rb_raise(rb_eRangeError, "pack length too big");
214
- case YP_PACK_ERROR_BANG_NOT_ALLOWED:
214
+ case PM_PACK_ERROR_BANG_NOT_ALLOWED:
215
215
  rb_raise(rb_eRangeError, "bang not allowed");
216
- case YP_PACK_ERROR_DOUBLE_ENDIAN:
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 == YP_PACK_END) {
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, rb_cYARPPackDirective));
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, rb_cYARPPackFormat);
242
+ return rb_class_new_instance(2, format_args, rb_cPrismPackFormat);
243
243
  }
244
244
 
245
245
  void
246
- Init_yarp_pack(void) {
247
- rb_cYARP = rb_define_module("YARP");
248
- rb_cYARPPack = rb_define_module_under(rb_cYARP, "Pack");
249
- rb_cYARPPackDirective = rb_define_class_under(rb_cYARPPack, "Directive", rb_cObject);
250
- rb_cYARPPackFormat = rb_define_class_under(rb_cYARPPack, "Format", rb_cObject);
251
- rb_define_singleton_method(rb_cYARPPack, "parse", pack_parse, 3);
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 Yarp
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("yarp/yarp")
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("-DYARP_DEBUG_MODE_BUILD") if debug_mode_build?
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", "yp_parser_init", build_dir)
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("yarp.h", include_dir) or raise "yarp.h is required"
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 yarp/extension.h in our
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("yarp/extension.h", File.join(__dir__, "..")) or raise "yarp/extension.h is required"
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/yarp/ast.h") && Dir.exist?(".git")
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 YARP_DEBUG_MODE_BUILD environment variable.
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
- YARP_DEBUG_MODE_BUILD
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["YARP_DEBUG_MODE_BUILD"] || false)
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
- Yarp::ExtConf.print_help
132
+ Prism::ExtConf.print_help
133
133
  exit!(0)
134
134
  end
135
135
 
136
- Yarp::ExtConf.configure
136
+ Prism::ExtConf.configure