Skip to content

Conversation

@Earlopain
Copy link
Collaborator

Before:

  0...3: tIDENTIFIER     => "foo"
  4...5: tLPAREN_ARG     => "("
  5...6: tLPAREN2        => "("
  6...7: tINTEGER        => 1
  7...9: tDOT2           => ".."
 9...10: tINTEGER        => 1
10...11: tRPAREN         => ")"
11...12: tRPAREN         => ")"
12...13: tNL             => nil

After:

  0...3: tIDENTIFIER     => "foo"
  4...5: tLPAREN_ARG     => "("
  5...6: tLPAREN         => "("
  6...7: tINTEGER        => 1
  7...9: tDOT2           => ".."
 9...10: tINTEGER        => 1
10...11: tRPAREN         => ")"
11...12: tRPAREN         => ")"
12...13: tNL             => nil

Before:
```
  0...3: tIDENTIFIER     => "foo"
  4...5: tLPAREN_ARG     => "("
  5...6: tLPAREN2        => "("
  6...7: tINTEGER        => 1
  7...9: tDOT2           => ".."
 9...10: tINTEGER        => 1
10...11: tRPAREN         => ")"
11...12: tRPAREN         => ")"
12...13: tNL             => nil
```

After:
```
  0...3: tIDENTIFIER     => "foo"
  4...5: tLPAREN_ARG     => "("
  5...6: tLPAREN         => "("
  6...7: tINTEGER        => 1
  7...9: tDOT2           => ".."
 9...10: tINTEGER        => 1
10...11: tRPAREN         => ")"
11...12: tRPAREN         => ")"
12...13: tNL             => nil
```
@kddnewton kddnewton merged commit 19cb622 into ruby:main Jan 10, 2025
57 of 58 checks passed
@kddnewton
Copy link
Collaborator

You are doing amazing work here, btw. Thank you so much for digging into this, it has been on my list for so long and now it's actually getting really close!

@Earlopain
Copy link
Collaborator Author

Thanks! I hope to have the translator be the only parser for RuboCop on new Ruby versions starting with 3.5 (rubocop/rubocop#13617) since it will be pretty hard to keep up otherwise with the parser deprecation and all that.

I think it's doing a damn well job already, so kudos to you for starting it, especially the ast is in a very good state. Just a handful of discrepancies I notice, in addition to the tests available here.

It'll be an interesting question on how to handle it and other new node types when parser doesn't support that itself. Maybe the simplest thing would be to just inline the builder since it's doubtful that it'll get any changes anymore, but I'll leave that as a thing for the not-so-distant future for now.

@Earlopain Earlopain deleted the parser-translator-lparen-conversion branch January 16, 2025 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants