summaryrefslogtreecommitdiff
path: root/parse.y
AgeCommit message (Collapse)Author
2023-09-12Restore `in_defined` flag at nested `defined?`Nobuyoshi Nakada
2023-09-12Rename `NODE_NEW_TEMPORAL` as `NODE_NEW_INTERNAL`Nobuyoshi Nakada
2023-09-10Declare `k_class` and `k_module` as `ctxt`Nobuyoshi Nakada
So that it is not ncessary to specify the type each time. Notes: Merged: https://github.com/ruby/ruby/pull/8410
2023-09-10Add a new line between function definitions [ci skip]Yuichiro Kaneko
Notes: Merged: https://github.com/ruby/ruby/pull/8408 Merged-By: nobu <nobu@ruby-lang.org>
2023-09-07[Bug #19549] Check for variables to be interpolatedNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7615
2023-09-01[Bug #19281] Allow semicolon in parenthesis at the first argument of command ↵yui-knk
call Allow compstmt in the first argument of command call wrapped with parenthesis like following arguments with parenthesis. Notes: Merged: https://github.com/ruby/ruby/pull/8347
2023-09-01[Bug-18878] Parse qualified const with brace block as method callNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8343
2023-08-30[DOC] Detailed explanation when one line pattern matching is a void value ↵yui-knk
expression Notes: Merged: https://github.com/ruby/ruby/pull/8320
2023-08-26kw_rest_arg nd_cflag has not been used since 9720136yui-knk
Notes: Merged: https://github.com/ruby/ruby/pull/8291
2023-08-26[Bug #19851] Ripper: Hide internal block argument IDNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8293
2023-08-25Replace only use of `snprintf` in parserNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8292
2023-08-25[Bug #19848] Flush BOMNobuyoshi Nakada
The token just after BOM needs to position at column 0, so that the indentation matches closing line. Notes: Merged: https://github.com/ruby/ruby/pull/8281
2023-08-25Move SCRIPT_LINES__ away from parse.yNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8289
2023-08-25config.h has to be the very beginning卜部昌平
This header defines several essential macros. Notes: Merged: https://github.com/ruby/ruby/pull/8274
2023-08-24The first arg of NEW_KW_ARG macro is always 0yui-knk
Notes: Merged: https://github.com/ruby/ruby/pull/8267
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.