Граф коммитов

22 Коммитов

Автор SHA1 Сообщение Дата
Peter Zhu 01f9b2ae41 Use rb_str_to_interned_str in parse.y
This commit changes rb_fstring to rb_str_to_interned_str in parse.y.
rb_fstring is private so it shouldn't be used by ripper.
2024-02-23 13:33:46 -05:00
yui-knk 91cb303531 Remove not used universal parser macros and functions 2024-02-21 13:36:45 +09:00
S-H-GAMELINKS fba647087b Remove uneeded Universal Parser properties 2024-02-20 19:02:24 +09:00
Nobuyoshi Nakada b1d70e4264
[Bug #20280] Check by `rb_parser_enc_str_coderange`
Co-authored-by: Yuichiro Kaneko <spiketeika@gmail.com>
2024-02-19 16:33:26 +09:00
Nobuyoshi Nakada fcc55dc226
[Bug #20280] Raise SyntaxError on invalid encoding symbol 2024-02-19 16:33:26 +09:00
Peter Zhu a71d1ed838 Fix memory leak when parsing invalid hash symbol
For example:

    10.times do
      100_000.times do
        eval('{"\xC3": 1}')
      rescue EncodingError
      end

      puts `ps -o rss= -p #{$$}`
    end

Before:

    32032
    48464
    66112
    84192
    100592
    117520
    134096
    150656
    167168
    183760

After:

    17120
    17120
    17120
    17120
    18560
    18560
    18560
    18560
    18560
    18560
2024-02-13 11:05:56 -05:00
yui-knk 33c1e082d0 Remove ruby object from string nodes
String nodes holds ruby string object on `VALUE nd_lit`.
This commit changes it to `struct rb_parser_string *string`
to reduce dependency on ruby object.
Sometimes these strings are concatenated with other string
therefore string concatenate functions are needed.
2024-02-09 14:20:17 +09:00
S.H f3df218f48
Introduced `rb_node_const_decl_val` function
Introduce `rb_node_const_decl_val` function to allow `rb_ary_join` and
`rb_ary_reverse` functions to be removed from Universal Parser.
2024-01-31 13:31:38 +09:00
yui-knk 52d9e55903 Statically allocate parser config 2024-01-12 21:17:41 +09:00
S-H-GAMELINKS ad7aee35e4 Remove unneeded rb_parser_config_struct struct properties for Universal Parser 2024-01-07 21:16:31 +09:00
S-H-GAMELINKS 1b8d01136c Introduce Numeric Node's 2024-01-07 09:24:34 +09:00
yui-knk 4374236e95 Add errno_ptr property for Universal Parser 2023-12-28 13:17:36 +09:00
yui-knk 73fa322497 Add ary_modify property for Universal Parser 2023-12-28 09:00:44 +09:00
Nobuyoshi Nakada a075c55d0c Manage `rb_strterm_t` without imemo 2023-10-14 11:08:43 +09:00
yui-knk fb7a2ddb4b Directly free structure managed by imemo tmpbuf
NODE_ARGS, NODE_ARYPTN, NODE_FNDPTN manage memory of their
structure by imemo tmpbuf Object.
However rb_ast_struct has reference to NODE. Then these
memory can be freed directly when rb_ast_struct is freed.

This commit reduces parser's dependency on CRuby functions.
2023-09-22 11:25:53 +09:00
卜部昌平 1614e5ebb2 C structs cannot have two definitions
Not allowed even the definitions are identical.
2023-08-25 17:27:53 +09:00
S-H-GAMELINKS a792890e9b Remove uneeded fix2int and rational_raw property for Universal Parser 2023-08-11 13:50:00 +09:00
S-H-GAMELINKS 4e7e972841 Remove uneeded int2big property for Universal Parser 2023-08-05 11:39:38 +09:00
S-H-GAMELINKS acd9c208d5 Move some macro for universal parser 2023-07-09 15:00:52 +09:00
alitaso345 2903e9456f Remove ISASCII definition
The ISASCII definition was moved to parse.y( https://github.com/ruby/ruby/pull/8029 ), but the old definition wasn't removed.
2023-07-09 08:16:00 +09:00
Nobuyoshi Nakada 3443e43b62 Remove `st_functions_t` 2023-06-24 19:17:37 +09:00
yui-knk b481b673d7 [Feature #19719] Universal Parser
Introduce Universal Parser mode for the parser.
This commit includes these changes:

* Introduce `UNIVERSAL_PARSER` macro. All of CRuby related functions
  are passed via `struct rb_parser_config_struct` when this macro is enabled.
* Add CI task with 'cppflags=-DUNIVERSAL_PARSER' for ubuntu.
2023-06-12 18:23:48 +09:00