python / python/cpython

In IDLE colorizer, replace re with tokenizer

オープン
#140,347 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

topic-IDLE type-feature
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

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:

  1. The syntax categories in the REPL colorizer are not the same as IDLE's (listed on the Highlights settings page). What are they?
  2. IDLE colorizes 10000 lines editor contents as well as single interactive lines. Will the PR colorizer do the same, with similar speed?
  3. 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.
  4. 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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、IDLE の現在の正規表現ベースの colorizer を、tokenizer ベースの PyREPL colorizer および公開されている tokenizer モジュールと比較します。リンクされている PR gh-140337 と gh-152756 を確認し、構文カテゴリの互換性、10,000 行のエディターのパフォーマンス、REPL colorizer の安定性、IDLE Highlights issues との関連性を評価してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
tooling
issue の種類
リファクタリング
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。