github / github/codeql

Ruby: &[SPACE][identifier] syntax breaks Ruby parsing

Đang mở
#21,801 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
question
Ngôn ngữ chính
CodeQL
Star
10.1k
Fork
2.1k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
141

Mô tả

CodeQL's Ruby breaks parsing breaks for the following code:

```ruby
sorted_array = array.sort(& custom_sorts[params[:sortby]])
```

I understand that the following *should* be how this is written, but sometimes people put weird syntax in and it shouldn't break a whole file being parsed:

```ruby
sorted_array = array.sort(&custom_sorts[params[:sortby]])
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start by reproducing the Ruby parser failure with the two sort examples in the issue, focusing on the space between `&` and the identifier. Trace the parser entry point that handles this syntax and verify that both forms are accepted without preventing the rest of the file from being parsed.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
ruby
Lĩnh vực
compilers
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.