Implement methods to go backwards and look backwards inside Scanner
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 38/100
Hướng nghiên cứu
Bắt đầu từ điểm vào của Scanner và so sánh hành vi hiện có của next và find được mô tả trong issue. Xác định các tương đương theo hướng ngược lại để cập nhật vị trí của scanner như được yêu cầu, bao gồm hành vi tìm kiếm có giới hạn, và xác minh rằng trường hợp sử dụng phân tích image-link có thể lấy được phạm vi mong đợi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Is your feature request related to a problem? Please describe.
I'm trying to implement an InlineContentParser for images from a custom markdown spec from a certain website. Given I already parsed the opener, the spec requires me to look for the first whitespace character or end of text, then going backwards from there, look for the first ). Everything between the opener and ) is considered the image link.
This is a bit annoying to implement with the current limited set of methods Scanner has, and I also imagine the performance would be worse when instead of going backwards from the closer, you go forward from the opener via scanner.find(')') and perform an additional find to see if you just found the last ).
Describe the solution you'd like
I would like for there to be similar methods to next and find that would instead look back from the current Scanner position, i.e prev, and findPrev. Then I could just do the following (sorry that the code is in Kotlin as I don't regularly write Java, I hope the intent is clear):
val start = scanner.position() // position after the opener has been parsed
scanner.find { char -> char.isWhitespace() } // scanner gets moved to first whitespace or very end if there is none
scanner.findPrev(')') // scanner gets moved backwards until the position is at ')'. Ideally there would also be an overload that takes a position until which it should move, so i could pass the `start` to it and it would early exit if it doesn't find one by then
val end = scanner.position()
val imageLink = scanner.getSource(start, end).getContent()
Describe alternatives you've considered
As stated above I have considered iterating forward from the current position to find the next ) and check if there's another one to see if I'd found the last one.
- Ngôn ngữ chính
- Java
- Star
- 2.7k
- Fork
- 336
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của commonmark/commonmark-java
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
commonmark/commonmark-java#460 ·
-
Second code span not recognised after an unclosed backtick string and another code spanCó thể đã có người làm @TanbirRamim đã nhận 13 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
commonmark/commonmark-java#458 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 74/100
commonmark/commonmark-java#457 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
commonmark/commonmark-java#443 · 4 bình luận ·
-
Option to define custom flanking/canOpen/canClose rules for delimitersCó thể làm lại được @abhiramaab đã nhận 57 ngày trước và không có pull request nào đang mở. Đang mởenhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
commonmark/commonmark-java#428 · 4 bình luận ·
Tất cả issue của commonmark/commonmark-java
Issue tương tự
-
waiting-for-triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
spring-cloud/spring-cloud-openfeign#1443 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 84/100
ADORSYS-GIS/keycloak-oid4vp-plugin#221 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Upgrade to Spring Pulsar 2.0.8Đang mởstatus: team-only type: dependency-upgrade
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
spring-projects/spring-boot#52099 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
tchiotludo/akhq#3307 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
objectionary/jeo-maven-plugin#1885 ·
Maintainer thường phản hồi trong vòng 4 ngày