Skip to content

Commit ad7aee3

Browse files
S-H-GAMELINKSyui-knk
authored andcommitted
Remove unneeded rb_parser_config_struct struct properties for Universal Parser
1 parent 7fcc6f0 commit ad7aee3

File tree

4 files changed

+0
-189
lines changed

4 files changed

+0
-189
lines changed

parse.y

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -76,48 +76,6 @@
7676
#include "symbol.h"
7777

7878
#ifndef RIPPER
79-
static void
80-
bignum_negate(VALUE b)
81-
{
82-
BIGNUM_NEGATE(b);
83-
}
84-
85-
static void
86-
rational_set_num(VALUE r, VALUE n)
87-
{
88-
RATIONAL_SET_NUM(r, n);
89-
}
90-
91-
static VALUE
92-
rational_get_num(VALUE obj)
93-
{
94-
return RRATIONAL(obj)->num;
95-
}
96-
97-
static void
98-
rcomplex_set_real(VALUE cmp, VALUE r)
99-
{
100-
RCOMPLEX_SET_REAL(cmp, r);
101-
}
102-
103-
static VALUE
104-
rcomplex_get_real(VALUE obj)
105-
{
106-
return RCOMPLEX(obj)->real;
107-
}
108-
109-
static void
110-
rcomplex_set_imag(VALUE cmp, VALUE i)
111-
{
112-
RCOMPLEX_SET_IMAG(cmp, i);
113-
}
114-
115-
static VALUE
116-
rcomplex_get_imag(VALUE obj)
117-
{
118-
return RCOMPLEX(obj)->imag;
119-
}
120-
12179
static bool
12280
hash_literal_key_p(VALUE k)
12381
{

ruby_parser.c

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -195,54 +195,12 @@ static const rb_data_type_t ruby_parser_data_type = {
195195
0, 0, RUBY_TYPED_FREE_IMMEDIATELY
196196
};
197197

198-
static void
199-
bignum_negate(VALUE b)
200-
{
201-
BIGNUM_NEGATE(b);
202-
}
203-
204198
static int
205199
is_ascii_string2(VALUE str)
206200
{
207201
return is_ascii_string(str);
208202
}
209203

210-
static void
211-
rational_set_num(VALUE r, VALUE n)
212-
{
213-
RATIONAL_SET_NUM(r, n);
214-
}
215-
216-
static VALUE
217-
rational_get_num(VALUE obj)
218-
{
219-
return RRATIONAL(obj)->num;
220-
}
221-
222-
static void
223-
rcomplex_set_real(VALUE cmp, VALUE r)
224-
{
225-
RCOMPLEX_SET_REAL(cmp, r);
226-
}
227-
228-
static void
229-
rcomplex_set_imag(VALUE cmp, VALUE i)
230-
{
231-
RCOMPLEX_SET_IMAG(cmp, i);
232-
}
233-
234-
static VALUE
235-
rcomplex_get_real(VALUE obj)
236-
{
237-
return RCOMPLEX(obj)->real;
238-
}
239-
240-
static VALUE
241-
rcomplex_get_imag(VALUE obj)
242-
{
243-
return RCOMPLEX(obj)->imag;
244-
}
245-
246204
RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 6, 0)
247205
static VALUE
248206
syntax_error_append(VALUE exc, VALUE file, int line, int column,
@@ -517,18 +475,6 @@ nil_p(VALUE obj)
517475
return (int)NIL_P(obj);
518476
}
519477

520-
static int
521-
flonum_p(VALUE obj)
522-
{
523-
return (int)RB_FLONUM_P(obj);
524-
}
525-
526-
static VALUE
527-
int2fix(long i)
528-
{
529-
return INT2FIX(i);
530-
}
531-
532478
static VALUE
533479
syntax_error_new(void)
534480
{
@@ -559,12 +505,6 @@ default_rs(void)
559505
return rb_default_rs;
560506
}
561507

562-
static VALUE
563-
rational_raw1(VALUE x)
564-
{
565-
return rb_rational_raw1(x);
566-
}
567-
568508
static void *
569509
memmove2(void *dest, const void *src, size_t t, size_t n)
570510
{
@@ -762,30 +702,8 @@ rb_parser_config_initialize(rb_parser_config_t *config)
762702
config->hash_delete = rb_hash_delete;
763703
config->ident_hash_new = rb_ident_hash_new;
764704

765-
config->int2fix = int2fix;
766-
767-
config->bignum_negate = bignum_negate;
768-
config->big_norm = rb_big_norm;
769-
config->cstr_to_inum = rb_cstr_to_inum;
770-
771-
config->float_new = rb_float_new;
772-
config->float_value = rb_float_value;
773-
774705
config->num2int = rb_num2int_inline;
775-
config->int_positive_pow = rb_int_positive_pow;
776706
config->int2num = rb_int2num_inline;
777-
config->fix2long = rb_fix2long;
778-
779-
config->rational_new = rb_rational_new;
780-
config->rational_raw1 = rational_raw1;
781-
config->rational_set_num = rational_set_num;
782-
config->rational_get_num = rational_get_num;
783-
784-
config->complex_raw = rb_complex_raw;
785-
config->rcomplex_set_real = rcomplex_set_real;
786-
config->rcomplex_set_imag = rcomplex_set_imag;
787-
config->rcomplex_get_real = rcomplex_get_real;
788-
config->rcomplex_get_imag = rcomplex_get_imag;
789707

790708
config->stderr_tty_p = rb_stderr_tty_p;
791709
config->write_error_str = rb_write_error_str;
@@ -834,7 +752,6 @@ rb_parser_config_initialize(rb_parser_config_t *config)
834752
config->literal_cmp = literal_cmp;
835753
config->literal_hash = literal_hash;
836754

837-
config->builtin_class_name = rb_builtin_class_name;
838755
config->syntax_error_append = syntax_error_append;
839756
config->raise = rb_raise;
840757
config->syntax_error_new = syntax_error_new;
@@ -876,7 +793,6 @@ rb_parser_config_initialize(rb_parser_config_t *config)
876793
config->undef_p = undef_p;
877794
config->rtest = rtest;
878795
config->nil_p = nil_p;
879-
config->flonum_p = flonum_p;
880796
config->qnil = Qnil;
881797
config->qtrue = Qtrue;
882798
config->qfalse = Qfalse;

rubyparser.h

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,36 +1303,9 @@ typedef struct rb_parser_config_struct {
13031303
VALUE (*hash_lookup)(VALUE hash, VALUE key);
13041304
VALUE (*ident_hash_new)(void);
13051305

1306-
/* Fixnum */
1307-
VALUE (*int2fix)(long i);
1308-
1309-
/* Bignum */
1310-
void (*bignum_negate)(VALUE b);
1311-
VALUE (*big_norm)(VALUE x);
1312-
VALUE (*cstr_to_inum)(const char *str, int base, int badcheck);
1313-
1314-
/* Float */
1315-
VALUE (*float_new)(double d);
1316-
double (*float_value)(VALUE v);
1317-
13181306
/* Numeric */
13191307
int (*num2int)(VALUE val);
1320-
VALUE (*int_positive_pow)(long x, unsigned long y);
13211308
VALUE (*int2num)(int v);
1322-
long (*fix2long)(VALUE val);
1323-
1324-
/* Rational */
1325-
VALUE (*rational_new)(VALUE x, VALUE y);
1326-
VALUE (*rational_raw1)(VALUE x);
1327-
void (*rational_set_num)(VALUE r, VALUE n);
1328-
VALUE (*rational_get_num)(VALUE obj);
1329-
1330-
/* Complex */
1331-
VALUE (*complex_raw)(VALUE x, VALUE y);
1332-
void (*rcomplex_set_real)(VALUE cmp, VALUE r);
1333-
void (*rcomplex_set_imag)(VALUE cmp, VALUE i);
1334-
VALUE (*rcomplex_get_real)(VALUE obj);
1335-
VALUE (*rcomplex_get_imag)(VALUE obj);
13361309

13371310
/* IO */
13381311
int (*stderr_tty_p)(void);
@@ -1390,7 +1363,6 @@ typedef struct rb_parser_config_struct {
13901363
parser_st_index_t (*literal_hash)(VALUE a);
13911364

13921365
/* Error (Exception) */
1393-
const char *(*builtin_class_name)(VALUE x);
13941366
RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 6, 0)
13951367
VALUE (*syntax_error_append)(VALUE, VALUE, int, int, rb_encoding*, const char*, va_list);
13961368
RBIMPL_ATTR_FORMAT(RBIMPL_PRINTF_FORMAT, 2, 3)
@@ -1441,7 +1413,6 @@ typedef struct rb_parser_config_struct {
14411413
int (*undef_p)(VALUE);
14421414
int (*rtest)(VALUE obj);
14431415
int (*nil_p)(VALUE obj);
1444-
int (*flonum_p)(VALUE obj);
14451416
VALUE qnil;
14461417
VALUE qtrue;
14471418
VALUE qfalse;

universal_parser.c

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -217,41 +217,10 @@ struct rb_imemo_tmpbuf_struct {
217217
#define rb_hash_lookup p->config->hash_lookup
218218
#define rb_ident_hash_new p->config->ident_hash_new
219219

220-
#undef INT2FIX
221-
#define INT2FIX p->config->int2fix
222-
#undef LONG2FIX
223-
#define LONG2FIX p->config->int2fix
224-
225-
#define bignum_negate p->config->bignum_negate
226-
#define rb_big_norm p->config->big_norm
227-
#define rb_cstr_to_inum p->config->cstr_to_inum
228-
229-
#undef rb_float_new
230-
#define rb_float_new p->config->float_new
231-
#undef RFLOAT_VALUE
232-
#define RFLOAT_VALUE p->config->float_value
233-
#undef DBL2NUM
234-
#define DBL2NUM p->config->float_new
235-
236220
#undef NUM2INT
237221
#define NUM2INT p->config->num2int
238-
#define rb_int_positive_pow p->config->int_positive_pow
239222
#undef INT2NUM
240223
#define INT2NUM p->config->int2num
241-
#undef FIX2LONG
242-
#define FIX2LONG p->config->fix2long
243-
244-
#define rb_rational_new p->config->rational_new
245-
#undef rb_rational_raw1
246-
#define rb_rational_raw1 p->config->rational_raw1
247-
#define rational_set_num p->config->rational_set_num
248-
#define rational_get_num p->config->rational_get_num
249-
250-
#define rb_complex_raw p->config->complex_raw
251-
#define rcomplex_set_real p->config->rcomplex_set_real
252-
#define rcomplex_set_imag p->config->rcomplex_set_imag
253-
#define rcomplex_get_real p->config->rcomplex_get_real
254-
#define rcomplex_get_imag p->config->rcomplex_get_imag
255224

256225
#define rb_stderr_tty_p p->config->stderr_tty_p
257226
#define rb_write_error_str p->config->write_error_str
@@ -301,7 +270,6 @@ struct rb_imemo_tmpbuf_struct {
301270
#define literal_cmp p->config->literal_cmp
302271
#define literal_hash p->config->literal_hash
303272

304-
#define rb_builtin_class_name p->config->builtin_class_name
305273
#define rb_syntax_error_append p->config->syntax_error_append
306274
#define rb_raise p->config->raise
307275
#define syntax_error_new p->config->syntax_error_new
@@ -350,8 +318,6 @@ struct rb_imemo_tmpbuf_struct {
350318
#define RTEST p->config->rtest
351319
#undef NIL_P
352320
#define NIL_P p->config->nil_p
353-
#undef FLONUM_P
354-
#define FLONUM_P p->config->flonum_p
355321
#undef Qnil
356322
#define Qnil p->config->qnil
357323
#undef Qtrue

0 commit comments

Comments
 (0)