Skip to content

Commit

Permalink
Pass ident_hash_new via config
Browse files Browse the repository at this point in the history
  • Loading branch information
yui-knk committed Apr 13, 2023
1 parent 46bd2b8 commit fb8649c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
2 changes: 2 additions & 0 deletions external/parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ typedef struct rb_parser_config_struct {
VALUE (*hash_new)(void);
VALUE (*hash_aset)(VALUE hash, VALUE key, VALUE val);
VALUE (*hash_lookup)(VALUE hash, VALUE key);
VALUE (*ident_hash_new)(void);


} rb_parser_config_t;

Expand Down
11 changes: 6 additions & 5 deletions parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ struct lex_context;
#include "internal/complex.h"
#include "internal/encoding.h"
#include "internal/error.h"
#include "internal/hash.h"
#include "internal/imemo.h"
#include "internal/io.h"
#include "internal/rational.h"
Expand All @@ -64,6 +63,7 @@ struct lex_context;

#ifdef RIPPER
#include "internal/numeric.h"
#include "internal/hash.h"
#endif

enum shareability {
Expand Down Expand Up @@ -126,10 +126,11 @@ RBIMPL_WARNING_POP()
#undef rb_str_new_cstr
#define rb_str_new_cstr p->config.str_new_cstr

#define rb_hash_clear p->config.hash_clear
#define rb_hash_new p->config.hash_new
#define rb_hash_aset p->config.hash_aset
#define rb_hash_lookup p->config.hash_lookup
#define rb_hash_clear p->config.hash_clear
#define rb_hash_new p->config.hash_new
#define rb_hash_aset p->config.hash_aset
#define rb_hash_lookup p->config.hash_lookup
#define rb_ident_hash_new p->config.ident_hash_new
#endif

#define NO_LEX_CTXT (struct lex_context){0}
Expand Down
10 changes: 6 additions & 4 deletions ruby_parser.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* This is a wrapper for parse.y */

#include "internal/array.h"
#include "internal/hash.h"
#include "internal/parse.h"
#include "internal/ruby_parser.h"

Expand Down Expand Up @@ -77,10 +78,11 @@ rb_parser_config_initialize(rb_parser_config_t *config)
config->str_new = rb_str_new;
config->str_new_cstr = rb_str_new_cstr;

config->hash_clear = rb_hash_clear;
config->hash_new = rb_hash_new;
config->hash_aset = rb_hash_aset;
config->hash_lookup = rb_hash_lookup;
config->hash_clear = rb_hash_clear;
config->hash_new = rb_hash_new;
config->hash_aset = rb_hash_aset;
config->hash_lookup = rb_hash_lookup;
config->ident_hash_new = rb_ident_hash_new;

}

Expand Down

0 comments on commit fb8649c

Please sign in to comment.