本文整理汇总了Python中pygments.token.Keyword.Reserved方法的典型用法代码示例。如果您正苦于以下问题:Python Keyword.Reserved方法的具体用法?Python Keyword.Reserved怎么用?Python Keyword.Reserved使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pygments.token.Keyword
的用法示例。
在下文中一共展示了Keyword.Reserved方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_compiler_directive
# 需要导入模块: from pygments.token import Keyword [as 别名]
# 或者: from pygments.token.Keyword import Reserved [as 别名]
def test_compiler_directive(lexer):
fragment = u'%link C "object.o"\n%name Vect xs'
tokens = [
(Keyword.Reserved, u'%link'),
(Text, u' '),
(Keyword.Type, u'C'),
(Text, u' '),
(Literal.String, u'"'),
(Literal.String, u'object.o'),
(Literal.String, u'"'),
(Text, u'\n'),
(Keyword.Reserved, u'%name'),
(Text, u' '),
(Keyword.Type, u'Vect'),
(Text, u' '),
(Text, u'xs'),
(Text, u'\n')
]
assert list(lexer.get_tokens(fragment)) == tokens
示例2: test_reserved_word
# 需要导入模块: from pygments.token import Keyword [as 别名]
# 或者: from pygments.token.Keyword import Reserved [as 别名]
def test_reserved_word(lexer):
fragment = u'namespace Foobar\n links : String\n links = "abc"'
tokens = [
(Keyword.Reserved, u'namespace'),
(Text, u' '),
(Keyword.Type, u'Foobar'),
(Text, u'\n'),
(Text, u' '),
(Name.Function, u'links'),
(Text, u' '),
(Operator.Word, u':'),
(Text, u' '),
(Keyword.Type, u'String'),
(Text, u'\n'),
(Text, u' '),
(Text, u' '),
(Text, u'links'),
(Text, u' '),
(Operator.Word, u'='),
(Text, u' '),
(Literal.String, u'"'),
(Literal.String, u'abc'),
(Literal.String, u'"'),
(Text, u'\n')
]
assert list(lexer.get_tokens(fragment)) == tokens