summaryrefslogtreecommitdiff
path: root/parse.y
AgeCommit message (Collapse)Author
2025-04-15Rename `f_optarg` to `f_opt_arg` for consistency in parser rulesydah
Notes: Merged: https://github.com/ruby/ruby/pull/13114
2025-04-14Use call_op2 instead of call_op and tCOLON2ydah
Notes: Merged: https://github.com/ruby/ruby/pull/13113
2025-04-14Use user defined parameterizing rules `range_expr`ydah
Notes: Merged: https://github.com/ruby/ruby/pull/13111
2025-04-14Add a new non-terminal symbol `ternary` to tidy upydah
Notes: Merged: https://github.com/ruby/ruby/pull/13110
2025-04-14Refactor assignment rules to remove unnecessary lhs parameterydah
Notes: Merged: https://github.com/ruby/ruby/pull/13109
2025-04-13Change the indent after lhs in generation rules from spaces to tabsydah
Change the indent to match the characters used in other generation rules. This makes it easier to find lhs. Notes: Merged: https://github.com/ruby/ruby/pull/13082
2025-03-29[Bug #21202] Fix wrong token concat while tokenizing nested unterminated ↵tomoya ishida
heredoc (#13000) Notes: Merged-By: tompng <tomoyapenguin@gmail.com>
2025-03-29Adjust indentation for user defined parameterized ruleydah
This PR just fixing indentation. Notes: Merged: https://github.com/ruby/ruby/pull/13010
2025-03-20[Bug #21026] no singleton method on pseudo variable literalNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12925
2025-03-17[Bug #21186] multibyte char literal should be a single letter wordNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12946
2025-03-14Organize block_param_def by defining opt_block_param for non-terminal symbolsydah
Notes: Merged: https://github.com/ruby/ruby/pull/12932
2025-03-14Refactor parse.y to replace tIDENTIFIER and tCONSTANT with ident_or_const ↵ydah
inline rules Notes: Merged: https://github.com/ruby/ruby/pull/12929
2025-03-14Use user defined parameterizing rules `args_tail_basic`ydah
Notes: Merged: https://github.com/ruby/ruby/pull/12928
2025-03-09Merge the `new_yield` method into the `rb_node_yield_new` methodydah
Notes: Merged: https://github.com/ruby/ruby/pull/12888
2025-03-09Refactor parser rules to remove inline_operationydah
Notes: Merged: https://github.com/ruby/ruby/pull/12886
2025-03-08Remove redundant semantic action in bvar ruleydah
Notes: Merged: https://github.com/ruby/ruby/pull/12883
2025-03-08Implement CLASS NODE locationsydah
The following Location information has been added This is the information required for parse.y to be a universal parser: ``` ❯ ruby --parser=prism --dump=parsetree -e "class A < B; end" @ ProgramNode (location: (1,0)-(1,16)) +-- locals: [] +-- statements: @ StatementsNode (location: (1,0)-(1,16)) +-- body: (length: 1) +-- @ ClassNode (location: (1,0)-(1,16)) +-- locals: [] +-- class_keyword_loc: (1,0)-(1,5) = "class" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- constant_path: | @ ConstantReadNode (location: (1,6)-(1,7)) | +-- name: :A +-- inheritance_operator_loc: (1,8)-(1,9) = "<" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- superclass: | @ ConstantReadNode (location: (1,10)-(1,11)) | +-- name: :B +-- body: nil +-- end_keyword_loc: (1,13)-(1,16) = "end" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- name: :A ```
2025-03-03Implement POSTEXE NODE locationsydah
The following Location information has been added This is the information required for parse.y to be a universal parser: ``` ❯ ruby --parser=prism --dump=parsetree -e "END { }" @ ProgramNode (location: (1,0)-(1,8)) +-- locals: [] +-- statements: @ StatementsNode (location: (1,0)-(1,8)) +-- body: (length: 1) +-- @ PostExecutionNode (location: (1,0)-(1,8)) +-- statements: nil +-- keyword_loc: (1,0)-(1,3) = "END" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- opening_loc: (1,4)-(1,5) = "{" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- closing_loc: (1,7)-(1,8) = "}" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ```
2025-03-02Use user defined parameterizing rules `mlhs`ydah
Notes: Merged: https://github.com/ruby/ruby/pull/12836
2025-03-02Change superclass rhs to use noneydah
Notes: Merged: https://github.com/ruby/ruby/pull/12835
2025-02-25s/TERMINTOR/TERMINATOR/ydah
Notes: Merged: https://github.com/ruby/ruby/pull/12800
2025-02-24[Bug #21153] Add missing op-assign to top const in `command_asgn`Nobuyoshi Nakada
It was defined in `arg` only; moved that pattern to `op_asgn` rule to share it with `command_asgn`.
2025-02-24Merge NODE_LINE and NODE_ENCODING cases in cond0 functionS-H-GAMELINKS
NODE_LINE and NODE_ENCODING cases are used SWITCH_BY_COND_TYPE macro that is same to NODE_INTEGER and other cases. NODE_LINE and NODE_ENCODING cases can be marge to NODE_INTEGER and other node cases. Notes: Merged: https://github.com/ruby/ruby/pull/12794
2025-01-21Remove unnecessary assignments to local variables in `f_arg_asgn`ydah
Local variables are not reassigned and are not needed. Notes: Merged: https://github.com/ruby/ruby/pull/12054
2025-01-21Remove unnecessary assignments to local variables in `strings`ydah
Local variables are not reassigned and are not needed. Notes: Merged: https://github.com/ruby/ruby/pull/12054
2025-01-09[Feature #6012] Extend `source_location` for end position and columnsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12539
2025-01-09Refactor for loop handling to simplify do keyword location assignmentydah
2025-01-09Use Named Referenceydah
2025-01-09Implement FOR NODE locationsydah
The following Location information has been added This is the information required for parse.y to be a universal parser: ``` ❯ ruby --parser=prism --dump=parsetree -e "for a in b do end" @ ProgramNode (location: (1,0)-(1,17)) +-- locals: [:a] +-- statements: @ StatementsNode (location: (1,0)-(1,17)) +-- body: (length: 1) +-- @ ForNode (location: (1,0)-(1,17)) +-- index: | @ LocalVariableTargetNode (location: (1,4)-(1,5)) | +-- name: :a | +-- depth: 0 +-- collection: | @ CallNode (location: (1,9)-(1,10)) | +-- CallNodeFlags: variable_call, ignore_visibility | +-- receiver: nil | +-- call_operator_loc: nil | +-- name: :b | +-- message_loc: (1,9)-(1,10) = "b" | +-- opening_loc: nil | +-- arguments: nil | +-- closing_loc: nil | +-- block: nil +-- statements: nil +-- for_keyword_loc: (1,0)-(1,3) = "for" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- in_keyword_loc: (1,6)-(1,8) = "in" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- do_keyword_loc: (1,11)-(1,13) = "do" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- end_keyword_loc: (1,14)-(1,17) = "end" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ```
2025-01-09Refactor `parse_isalnum` and `parse_isxdigit` to use macroydah
Notes: Merged: https://github.com/ruby/ruby/pull/11780
2025-01-08Remove unnecessary semantic actionsydah
If you don’t specify an action for a rule, Lrama supplies a default: `$$ = $1`.
2025-01-07Remove unused token definitions for `tRPAREN` in Ripper and parser filesydah
Notes: Merged: https://github.com/ruby/ruby/pull/12488
2025-01-05[Bug #21004] Fix memory leak with "it" in parse.yPeter Zhu
Parsing `-> do it end` in parse.y leaks memory. We can see this in the Valgrind output: 56 bytes in 1 blocks are definitely lost in loss record 1 of 6 at 0x484E0DC: calloc (vg_replace_malloc.c:1675) by 0x188970: calloc1 (default.c:1472) by 0x188970: rb_gc_impl_calloc (default.c:8208) by 0x188970: ruby_xcalloc_body (gc.c:4598) by 0x18B8BC: ruby_xcalloc (gc.c:4592) by 0x21DCCA70: new_locations_lambda_body (ripper.y:12844) by 0x21DCCA70: ripper_yyparse (ripper.y:5194) by 0x21DDA521: rb_ruby_ripper_parse0 (ripper.y:15798) Notes: Merged: https://github.com/ruby/ruby/pull/12508
2025-01-05Remove unused loc in rb_locations_lambda_body_tPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/12508
2025-01-04Implement DOT3 NODE locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11986
2025-01-04Implement DOT2 NODE locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11986
2025-01-04Use user defined parameterizing rules `compstmt(stmts)`ydah
Notes: Merged: https://github.com/ruby/ruby/pull/11652
2025-01-04Use user defined parameterizing rules `op_asgn(rhs)`ydah
Notes: Merged: https://github.com/ruby/ruby/pull/12494
2025-01-04Use user defined parameterizing rules `def_endless_method(bodystmt)`ydah
Notes: Merged: https://github.com/ruby/ruby/pull/12494
2025-01-04Use user defined parameterizing rules `asgn(lhs, rhs)`ydah
Notes: Merged: https://github.com/ruby/ruby/pull/12494
2025-01-04Use `p_primitive_value`ydah
Notes: Merged: https://github.com/ruby/ruby/pull/11889
2025-01-04Use `command_call_value`ydah
Notes: Merged: https://github.com/ruby/ruby/pull/11889
2025-01-04Use user defined parameterizing rules `value_expr`ydah
Notes: Merged: https://github.com/ruby/ruby/pull/11889
2025-01-04Use user defined parameterizing rules `f_kw(value)`ydah
Notes: Merged: https://github.com/ruby/ruby/pull/11674
2025-01-04Implement REGX NODE locationsydah
The following Location information has been added This is the information required for parse.y to be a universal parser: ``` ❯ ruby --parser=prism --dump=parsetree -e '/foo/' @ ProgramNode (location: (1,0)-(1,5)) +-- locals: [] +-- statements: @ StatementsNode (location: (1,0)-(1,5)) +-- body: (length: 1) +-- @ RegularExpressionNode (location: (1,0)-(1,5)) +-- RegularExpressionFlags: forced_us_ascii_encoding +-- opening_loc: (1,0)-(1,1) = "/" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- content_loc: (1,1)-(1,4) = "foo" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- closing_loc: (1,4)-(1,5) = "/" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- unescaped: "foo" ```
2025-01-04Implement LAMBDA NODE locationsydah
The following Location information has been added This is the information required for parse.y to be a universal parser: ``` ❯ ruby --parser=prism --dump=parsetree -e "-> (a, b) do foo end" @ ProgramNode (location: (1,0)-(1,20)) +-- locals: [] +-- statements: @ StatementsNode (location: (1,0)-(1,20)) +-- body: (length: 1) +-- @ LambdaNode (location: (1,0)-(1,20)) +-- locals: [:a, :b] +-- operator_loc: (1,0)-(1,2) = "->" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- opening_loc: (1,10)-(1,12) = "do" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- closing_loc: (1,17)-(1,20) = "end" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ : (snip) ```
2025-01-04Implement YIELD NODE locationsydah
The following Location information has been added This is the information required for parse.y to be a universal parser: ``` ❯ ruby --parser=prism --dump=parsetree -e 'def foo; yield end' @ ProgramNode (location: (1,0)-(1,18)) +-- locals: [] +-- statements: @ StatementsNode (location: (1,0)-(1,18)) +-- body: (length: 1) +-- @ DefNode (location: (1,0)-(1,18)) +-- name: :foo +-- name_loc: (1,4)-(1,7) = "foo" +-- receiver: nil +-- parameters: nil +-- body: | @ StatementsNode (location: (1,9)-(1,14)) | +-- body: (length: 1) | +-- @ YieldNode (location: (1,9)-(1,14)) | +-- keyword_loc: (1,9)-(1,14) = "yield" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | +-- lparen_loc: nil ^^^^^^^^^^^^^^^^^^^ | +-- arguments: nil | +-- rparen_loc: nil ^^^^^^^^^^^^^^^^^^^ +-- locals: [] +-- def_keyword_loc: (1,0)-(1,3) = "def" +-- operator_loc: nil +-- lparen_loc: nil +-- rparen_loc: nil +-- equal_loc: nil +-- end_keyword_loc: (1,15)-(1,18) = "end" ```
2025-01-04Implement EVSTR NODE locationsydah
The following Location information has been added This is the information required for parse.y to be a universal parser: ``` ❯ ruby --parser=prism --dump=parsetree -e '"#{foo}"' @ ProgramNode (location: (1,0)-(1,8)) +-- locals: [] +-- statements: @ StatementsNode (location: (1,0)-(1,8)) +-- body: (length: 1) +-- @ InterpolatedStringNode (location: (1,0)-(1,8)) +-- InterpolatedStringNodeFlags: nil +-- opening_loc: (1,0)-(1,1) = "\"" +-- parts: (length: 1) | +-- @ EmbeddedStatementsNode (location: (1,1)-(1,7)) | +-- opening_loc: (1,1)-(1,3) = "\#{" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | +-- statements: | | @ StatementsNode (location: (1,3)-(1,6)) | | +-- body: (length: 1) | | +-- @ CallNode (location: (1,3)-(1,6)) | | +-- CallNodeFlags: variable_call, ignore_visibility | | +-- receiver: nil | | +-- call_operator_loc: nil | | +-- name: :foo | | +-- message_loc: (1,3)-(1,6) = "foo" | | +-- opening_loc: nil | | +-- arguments: nil | | +-- closing_loc: nil | | +-- block: nil | +-- closing_loc: (1,6)-(1,7) = "}" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- closing_loc: (1,7)-(1,8) = "\"" ```
2025-01-03Implement SUPER NODE locationsydah
Notes: Merged: https://github.com/ruby/ruby/pull/11712
2025-01-03Refactor parse.y to replace `tIDENTIFIER` and `tCONSTANT` with ↵ydah
`ident_or_const` inline rules Notes: Merged: https://github.com/ruby/ruby/pull/11782