Python pygments.token.Keyword.Reserved() Examples
The following are 2
code examples of pygments.token.Keyword.Reserved().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pygments.token.Keyword
, or try the search function
.
Example #1
Source File: test_idris.py From pygments with BSD 2-Clause "Simplified" License | 6 votes |
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
Example #2
Source File: test_idris.py From pygments with BSD 2-Clause "Simplified" License | 5 votes |
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