summaryrefslogtreecommitdiff
path: root/universal_parser.c
AgeCommit message (Collapse)Author
2025-02-15Remove rb_enc_associate for ParserS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/12715
2025-02-02Remove rb_exc_raise for ParserS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/12688
2025-01-28Remove rb_usascii_encoding for ParserS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/12643
2025-01-20Remove rb_obj_as_string for ParserS-H-GAMELINKS
Ruby Parser not used rb_obj_as_string. And obj_as_string property can be removed from Universal Parser. Notes: Merged: https://github.com/ruby/ruby/pull/12603
2025-01-06Remove SYM2ID for ParserS-H-GAMELINKS
Ruby Parser not used SYM2ID. And sym2id property can be removed from Universal Parser. Notes: Merged: https://github.com/ruby/ruby/pull/12507
2025-01-02Remove rb_ary_push for parserS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/12493
2024-11-10rb_strlen_lit: support wide string literalsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12046
2024-10-25Remove rb_ary_new for parserS-H-GAMELINKS
rb_ary_new function was not used by the parser and could be removed. Notes: Merged: https://github.com/ruby/ruby/pull/11734
2024-09-28Remove on `RSTRING_END` dependency from parserNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/11713
2024-09-27Reduce `is_ascii_string` function dependency for parserS-H-GAMELINKS
Changed to use `rb_parser_is_ascii_string` function instead of `is_ascii_string` function Notes: Merged: https://github.com/ruby/ruby/pull/11698
2024-09-26Remove rb_str_cat for parserS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/11672
2024-09-22Reuse dedent_string function in rb_ruby_ripper_dedent_string functionS-H-GAMELINKS
This change is reduce Ruby C API dependency for Universal Parser. Reuse dedent_string functions in rb_ruby_ripper_dedent_string functions and remove dependencies on rb_str_modify and rb_str_set_len from the parser. Notes: Merged: https://github.com/ruby/ruby/pull/11658
2024-06-02Remove unused functions from struct rb_parser_config_structS-H-GAMELINKS
StringValueCStr has not used in parse.y
2024-05-31Revert 528c4501f46fbe1e06028d673a777ef124d29829Yusuke Endoh
Recently, `TestRubyLiteral#test_float` fails randomly. ``` 1) Error: TestRubyLiteral#test_float: ArgumentError: SyntaxError#path changed: "(eval at /home/chkbuild/chkbuild/tmp/build/20240527T050036Z/ruby/test/ruby/test_literal.rb:642)"->"(eval at /home/chkbuild/chkbuild/tmp/build/20240527T050036Z/ruby/test/ruby/test_literal.rb:642)" ``` https://rubyci.s3.amazonaws.com/s390x/ruby-master/log/20240527T050036Z.fail.html.gz According to Launchable, the first failure was on Apr 30. This is just when 528c4501f46fbe1e06028d673a777ef124d29829 was committed. I don't know if the change is really the cause, but I want to revert it once to see if the random failure disappears.
2024-05-13Constify encoding type in universal parserNobuyoshi Nakada
Fixed warning about discarding modifiers. ``` ../src/ruby_parser.c:677:48: warning: passing 'rb_encoding *' (aka 'const struct OnigEncodingTypeST *') to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] 677 | ast = rb_parser_compile(p, gets, ptr, len, enc, input, line); | ^~~ ../src/internal/parse.h:58:128: note: passing argument to parameter 'fname_enc' here 58 | rb_ast_t *rb_parser_compile(rb_parser_t *p, rb_parser_lex_gets_func *gets, const char *fname_ptr, long fname_len, rb_encoding *fname_enc, rb_parser_input_data input, int line); | ^ ```
2024-04-30Use `rb_parser_string_t *` as `ruby_sourcefile_string`yui-knk
This reduces dependency on VALUE.
2024-04-24Remove unused functions from `struct rb_parser_config_struct`yui-knk
2024-04-23Remove unused functions from `struct rb_parser_config_struct`yui-knk
2024-04-23Remove unused functions from `struct rb_parser_config_struct`yui-knk
2024-04-23Remove unused functions from `struct rb_parser_config_struct`yui-knk
2024-04-21Remove unused functions from struct `rb_parser_config_struct`S-H-GAMELINKS
2024-04-20Remove unused functions from `struct rb_parser_config_struct`yui-knk
2024-04-16Remove unused functions from `struct rb_parser_config_struct`yui-knk
2024-04-14Remove unused functions from `struct rb_parser_config_struct`yui-knk
2024-04-11Remove duplicated `st_init_table_with_size` definitionyui-knk
`st_init_table_with_size` is already defined in universal_parser.c.
2024-04-11Remove unused function from `struct rb_parser_config_struct`yui-knk
2024-04-09Remove unused function from `struct rb_parser_config_struct`yui-knk
2024-04-06Remove unused function from `struct rb_parser_config_struct`yui-knk
2024-04-06Remove unused functions from `struct rb_parser_config_struct`S-H-GAMELINKS
2024-04-05Remove unused functions from `struct rb_parser_config_struct`yui-knk
2024-04-04Remove unused function from `struct rb_parser_config_struct`yui-knk
2024-04-02Remove `rb_imemo_tmpbuf_t` from parseryui-knk
No parser semantic value types are `VALUE` then no need to use imemo for managing semantic value stack anymore.
2024-04-02[Feature #20331] Simplify parser warnings for hash keys duplication and when ↵yui-knk
clause duplication This commit simplifies warnings for hash keys duplication and when clause duplication, based on the discussion of https://bugs.ruby-lang.org/issues/20331. Warnings are reported only when strings are same to ohters.
2024-04-01Remove unnecessary macros and functions for Universal ParserS-H-GAMELINKS
2024-03-12[Universal Parser] Reduce dependence on RArray in parse.yHASUMI Hitoshi
- Introduce `rb_parser_ary_t` structure to partly eliminate RArray from parse.y - In this patch, `parser_params->tokens` and `parser_params->ast->node_buffer->tokens` are now `rb_parser_ary_t *` - Instead, `ast_node_all_tokens()` internally creates a Ruby Array object from the `rb_parser_ary_t` - Also, delete `rb_ast_tokens()` and `rb_ast_set_tokens()` in node.c - Implement `rb_parser_str_escape()` - This is a port of the `rb_str_escape()` function in string.c - `rb_parser_str_escape()` does not depend on `VALUE` (RString) - Instead, it uses `rb_parser_stirng_t *` - This function works when --dump=y option passed - Because WIP of the universal parser, similar functions like `rb_parser_tokens_free()` exist in both node.c and parse.y. Refactoring them may be needed in some way in the future - Although we considered redesigning the structure: `ast->node_buffer->tokens` into `ast->tokens`, we leave it as it is because `rb_ast_t` is an imemo. (We will address it in the future)
2024-02-23Use rb_str_to_interned_str in parse.yPeter Zhu
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-21Remove not used universal parser macros and functionsyui-knk
2024-02-20Remove uneeded Universal Parser propertiesS-H-GAMELINKS
2024-02-19[Bug #20280] Check by `rb_parser_enc_str_coderange`Nobuyoshi Nakada
Co-authored-by: Yuichiro Kaneko <spiketeika@gmail.com>
2024-02-19[Bug #20280] Raise SyntaxError on invalid encoding symbolNobuyoshi Nakada
2024-02-13Fix memory leak when parsing invalid hash symbolPeter Zhu
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-09Remove ruby object from string nodesyui-knk
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-01-31Introduced `rb_node_const_decl_val` functionS.H
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-12Statically allocate parser configyui-knk
2024-01-07Remove unneeded rb_parser_config_struct struct properties for Universal ParserS-H-GAMELINKS
2024-01-07Introduce Numeric Node'sS-H-GAMELINKS
2023-12-28Add errno_ptr property for Universal Parseryui-knk
2023-12-28Add ary_modify property for Universal Parseryui-knk
2023-10-14Manage `rb_strterm_t` without imemoNobuyoshi Nakada
2023-09-22Directly free structure managed by imemo tmpbufyui-knk
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.
close