[BUG] Tokenizer mishandles triple-quoted strings — keywords replaced inside them
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 55/100
Línea de trabajo
The bug lives in _tokenize_preserving_strings in maithili_dsl/transpiler/transpile.py, which only matches single-line quoted strings and # comments. Reproduce by transpiling x = """क " में " ख""" and confirm में is replaced inside the literal. Extend the tokenizer regex to match triple-quoted strings ("""...""" and '''...''', spanning newlines) before the single-quote alternatives, then add tests for keywords inside triple quotes, inner quotes, and a multi-line docstring. Done when those cases pass unchanged and existing transpiler tests still pass.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
File: maithili_dsl/transpiler/transpile.py (_tokenize_preserving_strings)
The tokenizer only knows single-line "..." / '...' strings and # comments. Triple-quoted strings are parsed as pairs of empty strings, so when the content itself contains a quote, part of the string body is treated as code and keywords inside it get replaced:
Input: x = """क " में " ख"""
Output: x = """क " in " ख""" # में replaced inside a string literal
(Verified against v0.3.0. Simple triple-quoted strings without inner quotes survive only by accident.)
Fix: extend the tokenizer regex to match """...""" and '''...''' (with re.DOTALL-style content) before the single-quote alternatives. Consider f-string prefixes (f"...") while in there.
Tests: triple-quoted string with keywords, with inner quotes, multi-line docstring on a कार्य.
- Lenguaje dominante
- Python
- Estrellas
- 1
- Forks
- 4
- Merge medio
- 12 d 21 h
- PR fusionados (30 d)
- 1
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una 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 alphacrack/python-maithili-dsl
-
help wanted infra P2 testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
-
documentation enhancement good first issue help wanted P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
documentation good first issue P3
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
-
area:linter enhancement good first issue P3 translation
Dificultad 2/5 Medio día Aptitud para principiantes 66/100
-
area:cli enhancement good first issue P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Todos los issues de alphacrack/python-maithili-dsl
Issues similares
-
documentation good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
JheysonJhordyHuarauyaRiquelme/sprocguard#18 ·
Los mantenedores suelen responder en 1 día
-
enhancement good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
dlq/synthpopcan#59 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
mdn/translated-content#40220 ·
Los mantenedores suelen responder en 4 días
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
ETSInitiative/PETSIRD#243 ·
Los mantenedores suelen responder en 1 día
-
deferred p2
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
cuadrao-ai/argus#2160 ·
Los mantenedores suelen responder en 1 día