本文整理匯總了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