Python 語言服務¶
Python provides a number of modules to assist in working with the Python language. These modules support tokenizing, parsing, syntax analysis, bytecode disassembly, and various other facilities.
這些模組包括:
ast
--- 抽象語法樹 (Abstract Syntax Trees)- 抽象文法 (Abstract Grammar)
- 節點 (Node) 類別
AST
- 根節點
- 文本 (Literals)
- 變數
- 運算式
- 陳述式
- 流程控制
- 模式匹配 (pattern matching)
- 型別參數 (type parameters)
- 函式和類別定義
- async 和 await
ast
輔助程式- 編譯器旗標
- 命令列用法
symtable
--- 存取編譯器的符號表token
--- 與 Python 剖析樹一起使用的常數tok_name
ISTERMINAL()
ISNONTERMINAL()
ISEOF()
ENDMARKER
NAME
NUMBER
STRING
NEWLINE
INDENT
DEDENT
LPAR
RPAR
LSQB
RSQB
COLON
COMMA
SEMI
PLUS
MINUS
STAR
SLASH
VBAR
AMPER
LESS
GREATER
EQUAL
DOT
PERCENT
LBRACE
RBRACE
EQEQUAL
NOTEQUAL
LESSEQUAL
GREATEREQUAL
TILDE
CIRCUMFLEX
LEFTSHIFT
RIGHTSHIFT
DOUBLESTAR
PLUSEQUAL
MINEQUAL
STAREQUAL
SLASHEQUAL
PERCENTEQUAL
AMPEREQUAL
VBAREQUAL
CIRCUMFLEXEQUAL
LEFTSHIFTEQUAL
RIGHTSHIFTEQUAL
DOUBLESTAREQUAL
DOUBLESLASH
DOUBLESLASHEQUAL
AT
ATEQUAL
RARROW
ELLIPSIS
COLONEQUAL
EXCLAMATION
OP
AWAIT
ASYNC
TYPE_IGNORE
TYPE_COMMENT
SOFT_KEYWORD
FSTRING_START
FSTRING_MIDDLE
FSTRING_END
COMMENT
NL
ERRORTOKEN
N_TOKENS
NT_OFFSET
ENCODING
keyword
--- 檢驗 Python 關鍵字tokenize
--- Tokenizer for Python sourcetabnanny
--- 偵測不良縮排pyclbr
--- Python 模組瀏覽器支援py_compile
— 編譯 Python 來源檔案compileall
--- 位元組編譯 Python 函式庫dis
--- Python bytecode 的反組譯器pickletools
--- pickle 開發者的工具