summaryrefslogtreecommitdiff
path: root/rubyparser.h
AgeCommit message (Collapse)Author
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-21Introduce NODE_REGX to manage regexp literalyui-knk
2024-02-20Use rb_gc_mark_and_move for imemoPeter Zhu
2024-02-20Remove uneeded Universal Parser propertiesS-H-GAMELINKS
2024-02-20[Feature #20257] Rearchitect Ripperyui-knk
Introduce another semantic value stack for Ripper so that Ripper can manage both Node and Ruby Object separately. This rearchitectutre of Ripper solves these issues. Therefore adding test cases for them. * [Bug 10436] https://bugs.ruby-lang.org/issues/10436 * [Bug 18988] https://bugs.ruby-lang.org/issues/18988 * [Bug 20055] https://bugs.ruby-lang.org/issues/20055 Checked the differences of `Ripper.sexp` for files under `/test/ruby` are only on test_pattern_matching.rb. The differences comes from the differences between `new_hash_pattern_tail` functions between parser and Ripper. Ripper `new_hash_pattern_tail` didn’t call `assignable` then `kw_rest_arg` wasn’t marked as local variable. This is also fixed by this commit. ``` --- a/./tmp/before/test_pattern_matching.rb +++ b/./tmp/after/test_pattern_matching.rb @@ -3607,7 +3607,7 @@ [:in, [:hshptn, nil, [], [:var_field, [:@ident, “a”, [984, 13]]]], [[:binary, - [:vcall, [:@ident, “a”, [985, 10]]], + [:var_ref, [:@ident, “a”, [985, 10]]], :==, [:hash, nil]]], nil]]], @@ -3662,7 +3662,7 @@ [:in, [:hshptn, nil, [], [:var_field, [:@ident, “a”, [993, 13]]]], [[:binary, - [:vcall, [:@ident, “a”, [994, 10]]], + [:var_ref, [:@ident, “a”, [994, 10]]], :==, [:hash, [:assoclist_from_args, @@ -3813,7 +3813,7 @@ [:command, [:@ident, “raise”, [1022, 10]], [:args_add_block, - [[:vcall, [:@ident, “b”, [1022, 16]]]], + [[:var_ref, [:@ident, “b”, [1022, 16]]]], false]]], [:else, [[:var_ref, [:@kw, “true”, [1024, 10]]]]]]]], nil, @@ -3876,7 +3876,7 @@ [:@int, “0”, [1033, 15]]], :“&&“, [:binary, - [:vcall, [:@ident, “b”, [1033, 20]]], + [:var_ref, [:@ident, “b”, [1033, 20]]], :==, [:hash, nil]]]], nil]]], @@ -3946,7 +3946,7 @@ [:@int, “0”, [1042, 15]]], :“&&“, [:binary, - [:vcall, [:@ident, “b”, [1042, 20]]], + [:var_ref, [:@ident, “b”, [1042, 20]]], :==, [:hash, [:assoclist_from_args, @@ -5206,7 +5206,7 @@ [[:assoc_new, [:@label, “c:“, [1352, 22]], [:@int, “0”, [1352, 25]]]]]], - [:vcall, [:@ident, “r”, [1352, 29]]]], + [:var_ref, [:@ident, “r”, [1352, 29]]]], false]]], [:binary, [:call, @@ -5299,7 +5299,7 @@ [:assoc_new, [:@label, “c:“, [1367, 34]], [:@int, “0”, [1367, 37]]]]]], - [:vcall, [:@ident, “r”, [1367, 41]]]], + [:var_ref, [:@ident, “r”, [1367, 41]]]], false]]], [:binary, [:call, @@ -5931,7 +5931,7 @@ [:in, [:hshptn, nil, [], [:var_field, [:@ident, “r”, [1533, 11]]]], [[:binary, - [:vcall, [:@ident, “r”, [1534, 8]]], + [:var_ref, [:@ident, “r”, [1534, 8]]], :==, [:hash, [:assoclist_from_args, ```
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-02-03Use bool to check ascii only in parse_identyui-knk
No need to use ENC_CODERANGE to record ascii only or not.
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-28Rename `nd_head` in `RNode_RESBODY` as `nd_next`Nobuyoshi Nakada
2024-01-28Remove unused `nd_resq` from `RNode_ENSURE`Nobuyoshi Nakada
2024-01-27Introduce `NODE_ENCODING`S.H
`__ENCODING__ `was managed by `NODE_LIT` with Encoding object. Introduce `NODE_ENCODING` for 1. `__ENCODING__` is detectable from AST Node. 2. Reduce dependency Ruby object for parse.y
2024-01-14Constify `rb_global_parser_config`Nobuyoshi Nakada
2024-01-12Remove reference counter from rb_parser_configyui-knk
It's allocated outside of parser then no need to track reference count in rb_parser_config.
2024-01-12Statically allocate parser configyui-knk
2024-01-09Introduce NODE_SYM to manage symbol literalyui-knk
`:sym` was managed by `NODE_LIT` with `Symbol` object. This commit introduces `NODE_SYM` so that 1. Symbol literal is detectable from AST Node 2. Reduce dependency on ruby object
2024-01-07Remove unneeded rb_parser_config_struct struct properties for Universal ParserS-H-GAMELINKS
2024-01-07Introduce Numeric Node'sS-H-GAMELINKS
2024-01-02Introduce NODE_FILEyui-knk
`__FILE__` was managed by `NODE_STR` with `String` object. This commit introduces `NODE_FILE` and `struct rb_parser_string` so that 1. `__FILE__` is detectable from AST Node 2. Reduce dependency ruby object
2023-12-29Introduce NODE_LINEyui-knk
`__LINE__` was managed by `NODE_LIT` with `Integer` object. This commit introduces `NODE_LINE` so that 1. `__LINE__` is detectable from AST Node 2. Reduce dependency ruby object
2023-12-28Add errno_ptr property for Universal Parseryui-knk
2023-12-28Add ary_modify property for Universal Parseryui-knk
2023-12-08Fix typo in a comment [ci skip]Nobuyoshi Nakada
2023-10-30Embed `rb_args_info` in `rb_node_args_t`Nobuyoshi Nakada
2023-10-25Remove unused macroyui-knk
`struct RNode_OP_ASGN22` was removed by 37a783a.
2023-10-20Expand OP_ASGN1 nd_args to nd_index and nd_rvalueyui-knk
ARGSCAT has been used for nd_args to hold index and rvalue, because there was limitation on the number of members for Node. We can easily change structure of node now, let's expand it.
2023-10-20Add printf format attributes to `rb_parser_config_t`Nobuyoshi Nakada
2023-10-15Remove not used fields from STRyui-knk
2023-10-15Remove not used fields from XSTRyui-knk
2023-10-15Remove not used fields from LITyui-knk
2023-10-15Remove not used fields from MATCHyui-knk
2023-10-14Delete heredoc line mark referencesNobuyoshi Nakada
2023-10-14Manage `rb_strterm_t` without imemoNobuyoshi Nakada
2023-10-11Extract NODE_FL_NEWLINE access to macroyui-knk
2023-10-10Remove not used fields from DEFNyui-knk
2023-10-08Remove not used fields from EVSTRyui-knk
2023-10-07Remove not used fields from asgn nodesyui-knk
2023-10-06Remove not used fields from MATCH3yui-knk
2023-10-06Remove not used fields from YIELDyui-knk
2023-10-06Remove not used fields from ZLISTyui-knk
2023-10-06Remove `NODE_VALUES`Nobuyoshi Nakada
This node type was added for the multi-value experiment back in 2004. The feature itself was removed after a few years, but this is its remnant.
2023-10-05Chain nodes to exit onlyNobuyoshi Nakada
2023-10-05Differentiate `NODE_BREAK`/`NODE_NEXT`/`NODE_RETURN`Nobuyoshi Nakada
2023-10-05Remove unused nodes in NODE_RETURN and NODE_REDONobuyoshi Nakada
2023-10-05Move internal NODE_DEF_TEMP to parse.yNobuyoshi Nakada
2023-10-05Remove not used fields from colon nodesyui-knk
2023-10-04Remove not used fields from variable nodesyui-knk