Skip to content

Commit

Permalink
Implement rb_parser_str_escape()
Browse files Browse the repository at this point in the history
- This function does not depend on VALUE
- Instead, it uses rb_parser_stirng_t*
- This function works when --dump=y option passed
- This implementation is a port of the rb_str_escape() function in string.c
  • Loading branch information
hasumikin committed Feb 22, 2024
1 parent 5c1b674 commit 15e42bc
Show file tree
Hide file tree
Showing 5 changed files with 276 additions and 166 deletions.
2 changes: 1 addition & 1 deletion ast.c
Expand Up @@ -792,7 +792,7 @@ ast_node_all_tokens(rb_execution_context_t *ec, VALUE self)
INT2FIX(parser_token->loc.end_pos.lineno),
INT2FIX(parser_token->loc.end_pos.column)
);
token = rb_ary_new_from_args(4, INT2FIX(parser_token->id), ID2SYM(parser_token->type_id), str, loc);
token = rb_ary_new_from_args(4, INT2FIX(parser_token->id), ID2SYM(rb_intern(parser_token->type->ptr)), str, loc);
rb_ary_push(all_tokens, token);
}
rb_obj_freeze(all_tokens);
Expand Down

0 comments on commit 15e42bc

Please sign in to comment.