summaryrefslogtreecommitdiff
path: root/parse.y
AgeCommit message (Collapse)Author
2023-08-16Consider the special node when printingNobuyoshi Nakada
Appreciation to the reporter, Huichiao Tsai <hctsai.cs10@nycu.edu.tw>.
2023-08-09Fix memory leak for incomplete lambdasPeter Zhu
[Bug #19836] The parser does not free the chain of `struct vtable`, which causes memory leaks. The following script reproduces this issue: ``` 10.times do 100_000.times do Ripper.parse("-> {") end puts `ps -o rss= -p #{$$}` end ``` Notes: Merged: https://github.com/ruby/ruby/pull/8192
2023-08-09Fix memory leak in parser for incomplete tokensPeter Zhu
[Bug #19835] The parser does not free the `tbl` of the `struct vtable` when there are leftover `lvtbl` in the parser. This causes a memory leak. The following script reproduces this issue: ``` 10.times do 100_000.times do Ripper.parse("class Foo") end puts `ps -o rss= -p #{$$}` end ``` Notes: Merged: https://github.com/ruby/ruby/pull/8192
2023-08-01[Bug #19788] Use the result of `tCOLON2` eventNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8144
2023-08-01remove strange line eventKoichi Sasada
```ruby def helper_cant_rescue begin raise SyntaxError rescue cant_rescue # here end end ``` on this case, a line event is reported on `cant_rescue` line because of node structure. it should not be reported. Notes: Merged: https://github.com/ruby/ruby/pull/8149
2023-07-26Use `lex_eol_p` familyNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8119
2023-07-20Supress warning that variable may be used uninitialized with ripper buildingS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/8081
2023-07-15Use functions defined by parser_st.c to reduce dependency on st.cyui-knk
Notes: Merged: https://github.com/ruby/ruby/pull/8057
2023-07-09Move some macro for universal parserS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/8044
2023-07-08Move ISASCII defination to parse.yS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/8029
2023-07-04Use `uint_least32_t`Nobuyoshi Nakada
The elements of `ruby_global_name_punct_bits` table are 32-bit masks. Notes: Merged: https://github.com/ruby/ruby/pull/8024
2023-07-01Introduce script_lines function for refactor script_lines_defined and ↵S-H-GAMELINKS
script_lines_get functions Notes: Merged: https://github.com/ruby/ruby/pull/7990
2023-06-30Handle unterminated unicode escapes in regexpsJeremy Evans
This fixes an infinite loop possible after ec3542229b29ec93062e9d90e877ea29d3c19472. For \u{} escapes in regexps, skip validation in the parser, and rely on the regexp code to handle validation. This is necessary so that invalid unicode escapes in comments in extended regexps are allowed. Fixes [Bug #19750] Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/8003 Merged-By: jeremyevans <code@jeremyevans.net>
2023-06-30Don't check for null pointer in calls to freePeter Zhu
According to the C99 specification section 7.20.3.2 paragraph 2: > If ptr is a null pointer, no action occurs. So we do not need to check that the pointer is a null pointer. Notes: Merged: https://github.com/ruby/ruby/pull/8004
2023-06-22[Bug #19743] All but EOF can be read again after push-backNobuyoshi Nakada
2023-06-20[Bug #19736] Recover after unterminated interpolationNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7963
2023-06-18Remove coverage_enabled from parser_paramsyui-knk
`yyparse` never changes the value of `coverage_enabled`. `coverage_enabled` depends on only return value of `e_option_supplied`. Therefore `parser_params` doesn't need to have `coverage_enabled. Notes: Merged: https://github.com/ruby/ruby/pull/7951
2023-06-17Specify int bitfield as signed int bitfieldyui-knk
sunc treats int bitfield as unsigned int. This commit will fix build failure on sunc. * http://rubyci.s3.amazonaws.com/solaris10-sunc/ruby-master/log/20230617T100003Z.fail.html.gz * http://rubyci.s3.amazonaws.com/solaris11-sunc/ruby-master/log/20230617T090011Z.fail.html.gz Notes: Merged: https://github.com/ruby/ruby/pull/7952
2023-06-17Replace parser & node compile_option from Hash to bit fieldyui-knk
This commit reduces dependency to CRuby object. Notes: Merged: https://github.com/ruby/ruby/pull/7950
2023-06-12Fix duplicate symbol errors when statically linking ripperNobuyoshi Nakada
2023-06-12[Feature #19719] Universal Parseryui-knk
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. Notes: Merged: https://github.com/ruby/ruby/pull/7927
2023-05-24Rename `rb_node_name` to the original nameyui-knk
98637d421dbe8bcf86cc2effae5e26bb96a6a4da changes the name of the function. However this function is exported as global, then change the name to origin one for keeping compatibility. Notes: Merged: https://github.com/ruby/ruby/pull/7852
2023-05-23Move `ruby_node_name` to node.c and rename prefix of the functionyui-knk
Notes: Merged: https://github.com/ruby/ruby/pull/7844
2023-05-14[Bug #19025] Numbered parameter names are always local variablesNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7810
2023-05-14Add user argument to some macros used by bisonNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7807
2023-05-14Introduce anddot_multiple_assignment_check functionS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/7794
2023-05-02[Bug #19619] Preserve numbered parameters contextNobuyoshi Nakada
Preserve numbered parameters context across method definitions
2023-04-30Handle private AREF call in compile.cNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7775
2023-04-10Get rid of a breakpoint left in parse.yTakashi Kokubun
2023-04-07[Bug #19563] Yield words separators per linesNobuyoshi Nakada
So that newlines across a here-doc terminator will be separated tokens. Cf. https://github.com/ruby/irb/pull/558 Notes: Merged: https://github.com/ruby/ruby/pull/7675 Merged-By: nobu <nobu@ruby-lang.org>
2023-04-01`*` in an array pattern should not be parsed as nil in ripperKazuki Tsujimoto
After 6c0925ba7017efde6091e2ec4f1a6be268166696, it was impossible to distinguish between the presence or absence of `*`. # Before the commit Ripper.sexp('0 in []')[1][0][2][1] #=> [:aryptn, nil, nil, nil, nil] Ripper.sexp('0 in [*]')[1][0][2][1] #=> [:aryptn, nil, nil, [:var_field, nil], nil] # After the commit Ripper.sexp('0 in []')[1][0][2][1] #=> [:aryptn, nil, nil, nil, nil] Ripper.sexp('0 in [*]')[1][0][2][1] #=> [:aryptn, nil, nil, nil, nil] This commit reverts it.
2023-03-31Fix gc_verify_internal_consistency error for pattern_matching in ripperyui-knk
`gc_verify_internal_consistency` reports "found internal inconsistency" for "test_pattern_matching.rb". http://ci.rvm.jp/results/trunk-gc-asserts@ruby-sp2-docker/4501173 Ruby's parser manages objects by two different ways. 1. For parser * markable node holds objects * call `RB_OBJ_WRITTEN` with `p->ast` as parent * `mark_ast_value` marks objects 2. For ripper * unmarkable node, NODE_RIPPER/NODE_CDECL, holds objects * call `rb_ast_add_mark_object`. This function calls `rb_hash_aset` then `RB_OBJ_WRITTEN` is called with `mark_hash` as parent * `mark_hash` marks objects However in current pattern_matching implementation * markable node holds objects * call `rb_ast_add_mark_object` This commit fix it to be #2. This was inconsistency however always `mark_hash` is made young by `rb_ast_add_mark_object` call then objects are not collected. Notes: Merged: https://github.com/ruby/ruby/pull/7627
2023-03-30[Bug #19547] Add token for unescaped backslashNobuyoshi Nakada
This token is exposed only when `RubyVM::AbstractSyntaxTree` with `keep_tokens` option. Notes: Merged: https://github.com/ruby/ruby/pull/7622
2023-03-26[Bug #19175] p_kw without a sub pattern should be `assignable'Kazuki Tsujimoto
2023-03-26[Bug #19175] p_rest should be `assignable'Kazuki Tsujimoto
It should also check for duplicate names.
2023-03-19[Bug #19539] Match heredoc identifier from end of lineNobuyoshi Nakada
Not to ignore leading spaces in indented heredoc identifier. Notes: Merged: https://github.com/ruby/ruby/pull/7566
2023-03-09Expand tabs in parse.yTakashi Kokubun
I used the same script as https://github.com/ruby/ruby/pull/6094 but for a .y file.
2023-02-14Suppress -Wunused-but-set-variable warningNobuyoshi Nakada
2023-02-01Extract body rules from endless method definitionsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7222
2023-01-25Remove not used argument from tokenize_identyui-knk
This has not been used since 5e59be3eddd2ce28610ec8d1b42845cde0080833 Notes: Merged: https://github.com/ruby/ruby/pull/7179
2023-01-07Fix format specifiers for pointer differencesNobuyoshi Nakada
2023-01-06[Bug #19312] Return end-of-input at `__END__`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7077
2023-01-02[Bug #19291] Rewind to the previous lineNobuyoshi Nakada
When rewinding looking ahead after newline token, also reset the last line string, the pointers to it, and the location, not only the line number. Notes: Merged: https://github.com/ruby/ruby/pull/7054
2022-12-26EXPR_DOT is set when next token is tANDDOT ("&.") [ci skip]yui-knk
Notes: Merged: https://github.com/ruby/ruby/pull/7028
2022-12-15Disallow mixed usage of ... and */**Shugo Maeda
[Feature #19134] Notes: Merged: https://github.com/ruby/ruby/pull/6934
2022-12-13[Bug #19195] Allow optional newlines before closing parenthesisNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6916
2022-12-05Use loc to fix a failure of test_ast.rbShugo Maeda
``` 1) Failure: TestAst#test_ranges:test/fiber/scheduler.rb [/home/runner/work/ruby/ruby/src/test/ruby/test_ast.rb:122]: <[]> expected but was <[{:type=>:max_validation_error, :max=> #<RubyVM::AbstractSyntaxTree::Node::CodePosition:0x00007f80d630b598 @column=20, @lineno=203>, :end_pos=> #<RubyVM::AbstractSyntaxTree::Node::CodePosition:0x00007f80d630b778 @column=19, @lineno=203>, :node=> (BLOCK_PASS@203:15-203:19 (ARGSPUSH@203:15-203:20 (SPLAT@203:16-203:19 (LVAR@203:16-203:19 :*)) (HASH@203:16-203:19 (LIST@203:16-203:19 nil (LVAR@203:16-203:19 :**) nil))) (LVAR@203:16-203:19 :&))}]>. ```
2022-12-05Should use argsloc for the last argument for arg_append()Shugo Maeda
2022-12-02Introduce encoding check macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/6700
2022-11-29Remove ruby2_keywords related to args forwardingyui-knk
This was introduced by b609bdeb5307e280137b4b2838af0fe4e4b46f1c to suppress warnings. However these warngins were deleted by beae6cbf0fd8b6619e5212552de98022d4c4d4d4. Therefore these codes are not needed anymore. Notes: Merged: https://github.com/ruby/ruby/pull/6826