In IDLE colorizer, replace re with tokenizer
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 77.2k
- Forks
- 35.9k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
The current IDLE colorizer was designed when the python grammar was restricted to a context-free subtype. Parsing with RE's was sufficient or closely so to pick out substrings to be color tagged. The current grammar's sometime context-dependence make this more difficult or even impossible.
A few versions ago, the new C tokenizer used to compile Python code was exposed as a function in the tokenizer module. It replaced a python-coded tokenizer that did not always match the old C tokenizer and that must have been much slower. I assume that is was not seen as suitable for IDLE colorizer. However, the current exposed C tokenizer is being used to power the new PyREPL colorizer. The initial (draft) patch copies portions of that colorizer.
My main concerns are compatibility and speed. Some initial questions:
- The syntax categories in the REPL colorizer are not the same as IDLE's (listed on the Highlights settings page). What are they?
- IDLE colorizes 10000 lines editor contents as well as single interactive lines. Will the PR colorizer do the same, with similar speed?
- Is REPL colorizer stable? Are there open bug reports? (Should be labelled
topic-repl.) The code is private and undocumented, I presume intentionally, and I do not expect that issues only relevant to IDLE would be welcome. - In the IDLE Issues project, colorizer issues are in Highlights section. Does this fix any, or appear to make fixes easier?
Linked PRs
- gh-140337
- gh-152756
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.
Línea de trabajo
Comienza comparando el colorizador actual de IDLE basado en regex con el colorizador de PyREPL respaldado por tokenizer y el módulo tokenizer expuesto. Revisa las PR enlazadas gh-140337 y gh-152756 y evalúa después la compatibilidad de las categorías sintácticas, el rendimiento del editor con 10.000 líneas, la estabilidad del colorizador de REPL y la relevancia para las issues de IDLE Highlights.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- tooling
- Tipo de issue
- Refactorización
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100