Implement methods to go backwards and look backwards inside Scanner
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 38/100
Línea de trabajo
Comienza en el punto de entrada de Scanner y compara el comportamiento existente de next y find descrito en el issue. Define equivalentes hacia atrás que actualicen la posición del scanner según lo solicitado, incluido el comportamiento de búsqueda acotada, y verifica que el caso de uso de análisis de image-link pueda obtener el rango esperado.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Java
- Estrellas
- 2.7k
- Forks
- 337
- Merge medio
- 15 d 9 h
- PR fusionados (30 d)
- 1
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de commonmark/commonmark-java
-
Unclosed link reference definition title keeps the partial title and the following paragraph's source spans (0.30.0)Posiblemente ocupada @sean0407 la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
commonmark/commonmark-java#460 · 1 comentario ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 74/100
commonmark/commonmark-java#457 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
commonmark/commonmark-java#443 · 4 comentarios ·
-
Option to define custom flanking/canOpen/canClose rules for delimitersQuizá libre de nuevo @abhiramaab la tomó hace 61 días y no hay ningún pull request abierto. Abiertoenhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
commonmark/commonmark-java#428 · 4 comentarios ·
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
commonmark/commonmark-java#414 · 1 comentario · 1 reacción ·
Todos los issues de commonmark/commonmark-java
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
modelcontextprotocol/java-sdk#1174 · 1 reacción ·
Los mantenedores suelen responder en 2 días
-
module: core
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
bigbluebutton/bigbluebutton#26028 ·
Los mantenedores suelen responder en 1 día
-
Fix SNMP4J Agent vulnerabilityAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
MetricsHub/metricshub-community#1390 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
apache/rocketmq-dashboard#6331 ·
Los mantenedores suelen responder en 5 días
-
Upgrade to Commons Codec 1.23.0Abiertostatus: team-only type: dependency-upgrade
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
spring-projects/spring-boot#52143 · 1 comentario ·
Los mantenedores suelen responder en 1 día