[BUG] Tokenizer mishandles triple-quoted strings — keywords replaced inside them
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 55/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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 कार्य.
- Lingua principale
- Python
- Stelle
- 1
- Fork
- 4
- Merge medio
- 12g 21h
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di alphacrack/python-maithili-dsl
-
help wanted infra P2 testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
-
documentation enhancement good first issue help wanted P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
documentation good first issue P3
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
-
area:linter enhancement good first issue P3 translation
Difficoltà 2/5 Mezza giornata Idoneità per principianti 66/100
-
area:cli enhancement good first issue P3
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Tutte le issue di alphacrack/python-maithili-dsl
Issue simili
-
documentation good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
JheysonJhordyHuarauyaRiquelme/sprocguard#18 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
dlq/synthpopcan#59 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
mdn/translated-content#40220 ·
I maintainer di solito rispondono entro 4 giorni
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
ETSInitiative/PETSIRD#243 ·
I maintainer di solito rispondono entro 1 giorno
-
deferred p2
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
cuadrao-ai/argus#2160 ·
I maintainer di solito rispondono entro 1 giorno