[BUG] Devanagari numerals inside string literals are converted to ASCII

未关闭 适合新手
#23 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
python
领域
compilers

调研方向

从 maithili_dsl/transpiler/transpile.py 第 87 行附近开始,那里 convert_devanagari_numerals() 会在分词之前对整个源代码执行;然后看 transpile_maithili_code() 中处理关键字替换的 is_string 分支。把数字转换移到非字符串分支,然后将 issue 中提到的三个用例添加到 tests/test_transpile.py。完成的标准是:छपाउ("५ टा") 会在字符串内保留天城文数字,同时代码中的数字仍然会被转换。

由索引模型根据 Issue 内容生成。

描述

area:transpiler bug good first issue P2

File: maithili_dsl/transpiler/transpile.py:87

convert_devanagari_numerals() runs on the whole source before the tokenizer separates string literals, so numerals inside strings get rewritten and program output changes:

Input:  छपाउ("५ टा")
Output: print("5 टा")   # prints "5 टा" instead of "५ टा"

(Verified against v0.3.0.)

Fix: move the numeral conversion inside the token loop in transpile_maithili_code() so it only applies to code regions (the is_string == False branch), exactly like keyword replacement already does.

Tests: add cases to tests/test_transpile.py — numeral in a string stays Devanagari, numeral in code still converts, mixed lines work.

Good first issue: the fix is moving one function call and adding ~3 tests. Comment here to claim it.

主要语言
Python
星标
1
派生
4
平均合并
12 天 21 小时
30 天内合并 PR
1

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

alphacrack/python-maithili-dsl 的其他 Issue

查看 alphacrack/python-maithili-dsl 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。