symtable — 访问编译器的符号表
symtable
token
源代码: Lib/token.py
This module provides constants which represent the numeric values of leaf nodes of the parse tree (terminal tokens). Refer to the file Grammar/Tokens in the Python distribution for the definitions of the names in the context of the language grammar. The specific numeric values which the names map to may change between Python versions.
Grammar/Tokens
The module also provides a mapping from numeric codes to names and some functions. The functions mirror definitions in the Python C header files.
Dictionary mapping the numeric values of the constants defined in this module back to name strings, allowing more human-readable representation of parse trees to be generated.
返回 True for terminal token values.
True
返回 True for non-terminal token values.
返回 True if x is the marker indicating the end of input.
The token constants are:
Token value for "(" .
"("
Token value for ")" .
")"
Token value for "[" .
"["
Token value for "]" .
"]"
Token value for ":" .
":"
Token value for "," .
","
Token value for ";" .
";"
Token value for "+" .
"+"
Token value for "-" .
"-"
Token value for "*" .
"*"
Token value for "/" .
"/"
Token value for "|" .
"|"
Token value for "&" .
"&"
Token value for "<" .
"<"
Token value for ">" .
">"
Token value for "=" .
"="
Token value for "." .
"."
Token value for "%" .
"%"
Token value for "{" .
"{"
Token value for "}" .
"}"
Token value for "==" .
"=="
Token value for "!=" .
"!="
Token value for "<=" .
"<="
Token value for ">=" .
">="
Token value for "~" .
"~"
Token value for "^" .
"^"
Token value for "<<" .
"<<"
Token value for ">>" .
">>"
Token value for "**" .
"**"
Token value for "+=" .
"+="
Token value for "-=" .
"-="
Token value for "*=" .
"*="
Token value for "/=" .
"/="
Token value for "%=" .
"%="
Token value for "&=" .
"&="
Token value for "|=" .
"|="
Token value for "^=" .
"^="
Token value for "<<=" .
"<<="
Token value for ">>=" .
">>="
Token value for "**=" .
"**="
Token value for "//" .
"//"
Token value for "//=" .
"//="
Token value for "@" .
"@"
Token value for "@=" .
"@="
Token value for "->" .
"->"
Token value for "..." .
"..."
Token value for ":=" .
":="
Token value for "!" .
"!"
The following token type values aren’t used by the C tokenizer but are needed for the tokenize 模块。
tokenize
Token value used to indicate a comment.
Token value used to indicate a non-terminating newline. The NEWLINE token indicates the end of a logical line of Python code; NL tokens are generated when a logical line of code is continued over multiple physical lines.
NEWLINE
NL
Token value that indicates the encoding used to decode the source bytes into text. The first token returned by tokenize.tokenize() will always be an ENCODING token.
tokenize.tokenize()
ENCODING
Token value indicating that a type comment was recognized. Such tokens are only produced when ast.parse() is invoked with type_comments=True .
ast.parse()
type_comments=True
3.5 版改变: 添加 AWAIT and ASYNC tokens.
AWAIT
ASYNC
3.7 版改变: 添加 COMMENT , NL and ENCODING tokens.
COMMENT
3.7 版改变: 移除 AWAIT and ASYNC tokens. “async” and “await” are now tokenized as NAME tokens.
NAME
3.8 版改变: 添加 TYPE_COMMENT , TYPE_IGNORE , COLONEQUAL 。添加 AWAIT and ASYNC tokens back (they’re needed to support parsing older Python versions for ast.parse() with feature_version set to 6 or lower).
TYPE_COMMENT
TYPE_IGNORE
COLONEQUAL
feature_version
keyword — 测试 Python 关键词
keyword
键入搜索术语或模块、类、函数名称。