summaryrefslogtreecommitdiff
path: root/parse.y
AgeCommit message (Collapse)Author
2024-06-08ripper: Unify formal argument error handlingNobuyoshi Nakada
2024-06-08ripper: Unify backref error handlingNobuyoshi Nakada
2024-06-08ripper: Introduce `RIPPER_ID` macro instead of `ripper_id_` macrosNobuyoshi Nakada
2024-06-07ripper: Fix excess `compile_error` at simple backref op_asgnNobuyoshi Nakada
Fix up 89cfc1520717257073012ec07105c551e4b8af7c.
2024-06-06Remove circular parameter syntax errorKevin Newton
https://bugs.ruby-lang.org/issues/20478
2024-06-06[Bug #20521] ripper: Clean up strtermNobuyoshi Nakada
2024-06-02Ditto for NODE_DOT2 and NODE_DOT3Nobuyoshi Nakada
2024-06-02Use `RNode_DREGX` variable for debuggersNobuyoshi Nakada
At least LLDB needs an actual variable not only casts to access the type in debugger sessions.
2024-06-02Make interchangeable NODE types aliasesNobuyoshi Nakada
2024-06-01Get rid of type-punning pointer castsNobuyoshi Nakada
2024-06-01[Bug #20517] Make a multibyte character one token at meta escapeNobuyoshi Nakada
2024-05-31Make error messages clear blocks/keywords are disallowed in index assignmentJeremy Evans
Blocks and keywords are allowed in regular index. Also update NEWS to make this more clear. Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
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-24Update duplicated when clause warning messageKevin Newton
2024-05-23Remove dead codeNobuyoshi Nakada
Since 140512d2225e6fd046ba1bdbcd1a27450f55c233, `else` without `rescue` has been a syntax error.
2024-05-23Add RB_GC_GUARD for rb_str_to_parser_stringYusuke Endoh
I think this fixes the following random test failure that could not be fixed for a long time: ``` 1) Failure: TestSymbol#test_inspect_under_gc_compact_stress [/home/chkbuild/chkbuild/tmp/build/20240522T003003Z/ruby/test/ruby/test_symbol.rb:126]: <":testing"> expected but was <":\"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"">. ``` The value passed to this function is the return value of `rb_id2str`, so it is never collected. However, if auto_compact is enabled, the string may move and `RSTRING_PTR(str)` became invalid. This change prevents the string from being moved by RB_GC_GUARD.
2024-05-21ripper: Splat find patternsNobuyoshi Nakada
2024-05-21ripper: Splat hash patternsNobuyoshi Nakada
2024-05-21ripper: Splat array patterns with `pre_arg`Nobuyoshi Nakada
2024-05-21ripper: Splat `$:opt_args_tail` for `params!`Nobuyoshi Nakada
2024-05-21ripper: Splat `$:head` for `defs!`Nobuyoshi Nakada
2024-05-21ripper: Describe `var_ref` for `user_variable` in ripper DSLNobuyoshi Nakada
2024-05-21ripper: Move `assign_error` call to `assignable`Nobuyoshi Nakada
Prepare `lhs` as `$:$` before `assignable` and update it there. Remove `ripper_assignable` which is no longer used.
2024-05-21ripper: Move `assign_error` call to `const_decl`Nobuyoshi Nakada
Prepare `path` as `$:$` before `const_decl` and update it there. Remove `ripper_const_decl` which is no longer used.
2024-05-21ripper: Remove rb_ripper_noneNobuyoshi Nakada
Now it is used only for wheter `opt_paren_args` is `none`. Introduce a new special node to distinguish an empty parentheses from it .
2024-05-21ripper: Show popped TOS in debug modeNobuyoshi Nakada
2024-05-21ripper: Short hand for `rb_ary_new_from_args`Nobuyoshi Nakada
2024-05-21ripper: Make `$:n` to refer each grammar valuesNobuyoshi Nakada
Ripper DSL uses these values for callbacks, but does not need indexes.
2024-05-21ripper: Use ripper DSL in simple dispatch chain casesNobuyoshi Nakada
2024-05-19[DOC] Fix `$<` commentNobuyoshi Nakada
2024-05-19Replace cast tags for `tSTRING_DVAR` with typed midrule actionsNobuyoshi Nakada
2024-05-18Replace cast tags with typed midrule actionsNobuyoshi Nakada
* Add types to `tLAMBDA` and `tSTRING_DBEG` to store corresponding information when returning these tokens. * Add `enum lex_state_e state` to `%union` for `tSTRING_DBEG`.
2024-05-18No need to specify tags anymoreyui-knk
In the past, these codes were used by both parser and ripper. On ripper, the type of LHS is `<val>` then type cast was needed. However currently these are only used by parser then no need to cast.
2024-05-12ripper: Fix opassign when assignment to backref variablesNobuyoshi Nakada
2024-05-11Fix SEGV when ripper hits `backref_error` on `command_asgn` or `arg`yui-knk
2024-05-08[Bug #20474] Keep spaces in leading blank lineNobuyoshi Nakada
2024-05-04Change return value of `gets` function to be `rb_parser_string_t *` instead ↵yui-knk
of `VALUE` This change reduces parser's dependency on ruby object.
2024-05-03Use user defined parameterizing rules `f_optarg(value)`ydah
2024-05-02Use callee side tag specification of parameterizing rulesydah
2024-05-01Fix memory leak in Ripper.sexpPeter Zhu
rb_ast_dispose does not free the rb_ast_t causing it to be leaked. This commit changes it to use rb_ast_free instead. For example: require "ripper" 10.times do 100_000.times do Ripper.sexp("") end puts `ps -o rss= -p #{$$}` end Before: 27648 32512 37376 42240 47232 52224 57344 62208 67072 71936 After: 22784 22784 22784 22784 22912 22912 22912 22912 22912 22912
2024-05-01Use user defined parameterizing rules `f_opt(value)`ydah
2024-05-01Use user defined parameterizing rules `f_kwarg(kw)`ydah
2024-05-01Use user defined parameterizing rules `opt_args_tail(tail)`ydah
2024-04-30Use `rb_parser_string_t *` as `ruby_sourcefile_string`yui-knk
This reduces dependency on VALUE.
2024-04-29Use user defined parameterizing rulesydah
2024-04-28Use `' '+` instead of words_sepydah
2024-04-27Add line_count field to rb_ast_body_tHASUMI Hitoshi
This patch adds `int line_count` field to `rb_ast_body_t` structure. Instead, we no longer cast `script_lines` to Fixnum. ## Background Ref https://github.com/ruby/ruby/pull/10618 In the PR above, we have decoupled IMEMO from `rb_ast_t`. This means we could lift the five-words-restriction of the structure that forced us to unionize `rb_ast_t *` and `FIXNUM` in one field. ## Relating refactor - Remove the second parameter of `rb_ruby_ast_new()` function ## Attention I will remove a code that assigns -1 to line_count, in `rb_binding_add_dynavars()` of vm.c, because I don't think it is necessary. But I will make another PR for this so that we can atomically revert in case I was wrong (See the comment on the code)
2024-04-26Set `SCRIPT_LINES__` outside of parseryui-knk
Parser should not depend on functions defiend on "ruby_parser.c".
2024-04-26[Universal parser] Decouple IMEMO from rb_ast_tHASUMI Hitoshi
This patch removes the `VALUE flags` member from the `rb_ast_t` structure making `rb_ast_t` no longer an IMEMO object. ## Background We are trying to make the Ruby parser generated from parse.y a universal parser that can be used by other implementations such as mruby. To achieve this, it is necessary to exclude VALUE and IMEMO from parse.y, AST, and NODE. ## Summary (file by file) - `rubyparser.h` - Remove the `VALUE flags` member from `rb_ast_t` - `ruby_parser.c` and `internal/ruby_parser.h` - Use TypedData_Make_Struct VALUE which wraps `rb_ast_t` `in ast_alloc()` so that GC can manage it - You can retrieve `rb_ast_t` from the VALUE by `rb_ruby_ast_data_get()` - Change the return type of `rb_parser_compile_XXXX()` functions from `rb_ast_t *` to `VALUE` - rb_ruby_ast_new() which internally `calls ast_alloc()` is to create VALUE vast outside ruby_parser.c - `iseq.c` and `vm_core.h` - Amend the first parameter of `rb_iseq_new_XXXX()` functions from `rb_ast_body_t *` to `VALUE` - This keeps the VALUE of AST on the machine stack to prevent being removed by GC - `ast.c` - Almost all change is replacement `rb_ast_t *ast` with `VALUE vast` (sorry for the big diff) - Fix `node_memsize()` - Now it includes `rb_ast_local_table_link`, `tokens` and script_lines - `compile.c`, `load.c`, `node.c`, `parse.y`, `proc.c`, `ruby.c`, `template/prelude.c.tmpl`, `vm.c` and `vm_eval.c` - Follow-up due to the above changes - `imemo.{c|h}` - If an object with `imemo_ast` appears, considers it a bug Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2024-04-25false is not a pointer卜部昌平
This function returned VALUE before. False made sense back then. Now that it returns a pointer. NULL should be used instead.