Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
yui-knk committed May 30, 2023
1 parent 604ca9a commit fe87de7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
9 changes: 3 additions & 6 deletions internal/ruby_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
#include "internal.h"
#include "vm.h"

typedef struct rb_parser_config_struct rb_parser_config_t;

RUBY_SYMBOL_EXPORT_BEGIN
#ifdef UNIVERSAL_PARSER
void rb_parser_config_initialize(rb_parser_config_t *config);
#endif
VALUE rb_parser_set_context(VALUE, const struct rb_iseq_struct *, int);
RUBY_SYMBOL_EXPORT_END

VALUE rb_parser_new(void);
Expand All @@ -21,10 +22,6 @@ void rb_parser_keep_script_lines(VALUE vparser);
void rb_parser_error_tolerant(VALUE vparser);
void rb_parser_keep_tokens(VALUE vparser);

RUBY_SYMBOL_EXPORT_BEGIN
VALUE rb_parser_set_context(VALUE, const struct rb_iseq_struct *, int);
RUBY_SYMBOL_EXPORT_END

rb_ast_t *rb_parser_compile_string(VALUE, const char*, VALUE, int);
rb_ast_t *rb_parser_compile_string_path(VALUE vparser, VALUE fname, VALUE src, int line);
rb_ast_t *rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE input, int line);
Expand Down
2 changes: 2 additions & 0 deletions parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -13828,6 +13828,7 @@ rb_ruby_parser_memsize(const void *ptr)
return size;
}

#ifdef UNIVERSAL_PARSER
rb_parser_config_t *
rb_ruby_parser_config_new(void *(*malloc)(size_t size))
{
Expand All @@ -13839,6 +13840,7 @@ rb_ruby_parser_config_free(rb_parser_config_t *config)
{
config->free(config);
}
#endif

#ifndef UNIVERSAL_PARSER
static const rb_data_type_t parser_data_type = {
Expand Down
10 changes: 7 additions & 3 deletions rubyparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ typedef struct rb_ast_struct {
typedef struct parser_params rb_parser_t;
typedef struct rb_imemo_tmpbuf_struct rb_imemo_tmpbuf_t;

#ifdef UNIVERSAL_PARSER
typedef struct rb_parser_config_struct {
/*
* Reference counter.
Expand Down Expand Up @@ -617,14 +618,17 @@ typedef struct rb_parser_config_struct {
VALUE (*node_case_when_optimizable_literal)(const NODE *const node);

} rb_parser_config_t;
#endif /* UNIVERSAL_PARSER */

RUBY_SYMBOL_EXPORT_BEGIN
rb_parser_config_t *rb_ruby_parser_config_new(void *(*malloc)(size_t size));
void rb_ruby_parser_free(void *ptr);
void rb_ruby_parser_config_free(rb_parser_config_t *config);
rb_ast_t* rb_ruby_parser_compile_string(rb_parser_t *p, const char *f, VALUE s, int line);

#ifdef UNIVERSAL_PARSER
rb_parser_config_t *rb_ruby_parser_config_new(void *(*malloc)(size_t size));
void rb_ruby_parser_config_free(rb_parser_config_t *config);
rb_parser_t *rb_ruby_parser_new(rb_parser_config_t *config);
rb_ast_t* rb_ruby_parser_compile_string(rb_parser_t *p, const char *f, VALUE s, int line);
#endif
RUBY_SYMBOL_EXPORT_END

#endif /* RUBY_RUBYPARSER_H */

0 comments on commit fe87de7

Please sign in to comment.