DTStack / DTStack/dt-python-parser

How to parse/tokenize only INDENT and DEDENT tokens?

未關閉
#2 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
JavaScript
星號
25
分支
7
PR 合併指標
30 天內沒有已合併 PR

描述

Hello, I'm working on my VS Code extension, blockman, it renders blocks based on nested code blocks to make it easier to visually perceive the code.

video:
https://youtu.be/2Ajh8WQJvHs

The "dt-python-parser" package works really well, I use "**getAllTokens**" function to get all the tokens from python text file and then filter only type 93 (INDENT) and type 94 (DEDENT).

I need only INDENT and DEDENT locations, nothing more, but the "getAllTokens" function tokenizes everything and therefore losing much time, so if the file has more than 1000 lines, like 5000 lines or so, getAllTokens function takes many seconds to return the value, so rendering blocks take more time and waiting is not very comfortable for a user.

So, for the optimization, can I use the parser/tokenizer in such way that it would parse only INDENT/DEDENT locations and nothing more?

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。