Skip to content

Commit

Permalink
Remove dependency for symbol related functions
Browse files Browse the repository at this point in the history
  • Loading branch information
yui-knk committed Apr 16, 2023
1 parent c9d91f1 commit a5a7e02
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions external/parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,17 @@ typedef struct rb_parser_config_struct {
int (*is_attrset_id)(ID);
int (*is_global_name_punct)(const int c);
int (*id_type)(ID id);
ID (*intern)(const char *name);
ID (*intern2)(const char *name, long len);
ID (*intern3)(const char *name, long len, rb_encoding *enc);
ID (*intern_str)(VALUE str);
int (*is_notop_id)(ID);
int (*enc_symname_type)(const char *name, long len, rb_encoding *enc, unsigned int allowed_attrset);
VALUE (*str_intern)(VALUE str);
const char *(*id2name)(ID id);
VALUE (*id2str)(ID id);
VALUE (*id2sym)(ID x);
ID (*sym2id)(VALUE sym);

/* String */
VALUE (*str_catf)(VALUE str, const char *format, ...);
Expand Down
8 changes: 8 additions & 0 deletions parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,18 @@ RBIMPL_WARNING_POP()
#define is_attrset_id p->config.is_attrset_id
#define is_global_name_punct p->config.is_global_name_punct
#define id_type p->config.id_type
#undef rb_intern
#define rb_intern p->config.intern
#define rb_intern2 p->config.intern2
#define rb_intern3 p->config.intern3
#define rb_intern_str p->config.intern_str
#define is_notop_id p->config.is_notop_id
#define rb_enc_symname_type p->config.enc_symname_type
#define rb_str_intern p->config.str_intern
#define rb_id2name p->config.id2name
#define rb_id2str p->config.id2str
#define rb_id2sym p->config.id2sym
#define rb_sym2id p->config.sym2id

#define rb_str_catf p->config.str_catf
#undef rb_str_cat_cstr
Expand Down
7 changes: 7 additions & 0 deletions ruby_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,17 @@ rb_parser_config_initialize(rb_parser_config_t *config)
config->is_attrset_id = is_attrset_id2;
config->is_global_name_punct = is_global_name_punct;
config->id_type = id_type;
config->intern = rb_intern;
config->intern2 = rb_intern2;
config->intern3 = intern3;
config->intern_str = rb_intern_str;
config->is_notop_id = is_notop_id2;
config->enc_symname_type = enc_symname_type;
config->str_intern = rb_str_intern;
config->id2name = rb_id2name;
config->id2str = rb_id2str;
config->id2sym = rb_id2sym;
config->sym2id = rb_sym2id;

config->str_catf = rb_str_catf;
config->str_cat_cstr = rb_str_cat_cstr;
Expand Down

0 comments on commit a5a7e02

Please sign in to comment.