lexer freezes on this Python code
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript, python
- 領域
- compilers
調査の方向性
まず lexer("print('\'m')") でフリーズを再現し、lexer関数を調べます。特に、issueに示されているmatchQuotationループを確認します。エスケープされた引用符がどのようにトークン化されるかを追跡し、この入力が入力の末尾を越えて進むことなく終了することを確認します。lexerがハングしなくなったことを検証します。
索引モデルが issue の本文から書いたものです。
説明
Steps to reproduce:
- Try to run
lexer("print('\'m')") - Notice that it freezes.
I traced the freeze to an infinite do-while loop in the lexer.
In the following code, input is set to the code "print('\'m')" but current variable reaches into the billions,
currentChar === undefined, and
validator.test(currentChar) is returning false when currentChar is undefined.
/**
* 过滤(提取) 引号中的内容
*/
// eslint-disable-next-line
const matchQuotation = (currentChar, validator, TokenType) => {
do {
if (currentChar === '\n') {
line++;
}
currentChar = input[++current];
} while (!validator.test(currentChar));
++current;
};
I wonder if this has anything to do with the backslashed quotation mark. Maybe the grammar doesn't define STRING properly for escaped quotes.
I edited this issue because I first thought the bug was reproducible by parsing but it actually requires running the lexer function on the code.
- 主要言語
- JavaScript
- スター
- 25
- フォーク
- 7
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DTStack/dt-python-parser のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
DTStack/dt-python-parser#28 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
DTStack/dt-python-parser#27 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
DTStack/dt-python-parser#26 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
DTStack/dt-python-parser#15 · コメント 3 件 ·
-
支持最新版Python3语法 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
DTStack/dt-python-parser#11 ·
DTStack/dt-python-parser の issue をすべて見る
似ている issue
-
bug customer-eng Durable Agents Inngest status: needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
optimization optimization:agents-md-curator
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
githubnext/gh-aw-cao#13475 ·
-
[BUG]: "Clear All" in Settings doesn't clear the saved analysis, old data comes back after reload オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
AOSSIE-Org/OrgExplorer#253 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
oxc-project/oxc#26944 ·
-
ai-observability bug team/ai-observability
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100