本文整理汇总了Python中pgen2.token.NAME属性的典型用法代码示例。如果您正苦于以下问题:Python token.NAME属性的具体用法?Python token.NAME怎么用?Python token.NAME使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类pgen2.token
的用法示例。
在下文中一共展示了token.NAME属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: finish_off
# 需要导入模块: from pgen2 import token [as 别名]
# 或者: from pgen2.token import NAME [as 别名]
def finish_off(self):
"""Create additional useful structures. (Internal)."""
self.keywords = {} # map from keyword strings to arc labels
self.tokens = {} # map from numeric token values to arc labels
for ilabel, (type, value) in enumerate(self.labels):
if type == token.NAME and value is not None:
self.keywords[value] = ilabel
elif value is None:
self.tokens[type] = ilabel
示例2: finish_off
# 需要导入模块: from pgen2 import token [as 别名]
# 或者: from pgen2.token import NAME [as 别名]
def finish_off(self):
"""Create additional useful structures. (Internal)."""
self.keywords = {} # map from keyword strings to arc labels
self.tokens = {} # map from numeric token values to arc labels
for ilabel, (type, value) in enumerate(self.labels):
if type == token.NAME and value is not None:
self.keywords[value] = ilabel
elif value is None:
self.tokens[type] = ilabel