本文整理汇总了Python中pygments.lexers.PythonLexer.get_tokens_unprocessed方法的典型用法代码示例。如果您正苦于以下问题:Python PythonLexer.get_tokens_unprocessed方法的具体用法?Python PythonLexer.get_tokens_unprocessed怎么用?Python PythonLexer.get_tokens_unprocessed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pygments.lexers.PythonLexer
的用法示例。
在下文中一共展示了PythonLexer.get_tokens_unprocessed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_tokens_unprocessed
# 需要导入模块: from pygments.lexers import PythonLexer [as 别名]
# 或者: from pygments.lexers.PythonLexer import get_tokens_unprocessed [as 别名]
def get_tokens_unprocessed(self, text):
for index, token, value in \
PythonLexer.get_tokens_unprocessed(self, text):
if token is Name and value in self.EXTRA_KEYWORDS:
yield index, Keyword.Pseudo, value
else:
yield index, token, value
示例2: get_tokens_unprocessed
# 需要导入模块: from pygments.lexers import PythonLexer [as 别名]
# 或者: from pygments.lexers.PythonLexer import get_tokens_unprocessed [as 别名]
def get_tokens_unprocessed(self, text):
for index, token, value in PythonLexer.get_tokens_unprocessed(self, text):
if token is Name and value in self.EXTRA_KEYWORDS:
yield index, Keyword, value
elif token is Name and value in self.EXTRA_FUNC:
yield index, Name.Function, value
else:
yield index, token, value
示例3: get_tokens_unprocessed
# 需要导入模块: from pygments.lexers import PythonLexer [as 别名]
# 或者: from pygments.lexers.PythonLexer import get_tokens_unprocessed [as 别名]
def get_tokens_unprocessed(self, text):
for index, token, value in PythonLexer.get_tokens_unprocessed(self, text):
if token is Name and value in self.EXTRA_CLASSES:
yield index, Name.Class, value
elif token is Name and value in self.EXTRA_BUILTINS:
yield index, Name.Function, value
elif token is Name and value in self.EXTRA_CONSTS:
yield index, Keyword.Constant, value
elif token in (Name, Punctuation):
yield index, Text, value
else:
yield index, token, value
示例4: get_tokens_unprocessed
# 需要导入模块: from pygments.lexers import PythonLexer [as 别名]
# 或者: from pygments.lexers.PythonLexer import get_tokens_unprocessed [as 别名]
def get_tokens_unprocessed(self, text):
for index, token, value in PythonLexer.get_tokens_unprocessed(self, text):
if index==self.offset-1: # need to shift by 1
yield index, Error, value
else:
yield index, token, value