Python pygments.token.Name.Function() Examples

The following are 5 code examples of pygments.token.Name.Function(). 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.Name , or try the search function .
Example #1
Source File: test_kotlin.py    From pygments with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def test_can_cope_with_backtick_names_in_functions(lexer):
    fragment = u'fun `wo bble`'
    tokens = [
        (Keyword, u'fun'),
        (Text, u' '),
        (Name.Function, u'`wo bble`'),
        (Text, u'\n')
    ]
    assert list(lexer.get_tokens(fragment)) == tokens 
Example #2
Source File: test_kotlin.py    From pygments with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def test_can_cope_with_commas_and_dashes_in_backtick_Names(lexer):
    fragment = u'fun `wo,-bble`'
    tokens = [
        (Keyword, u'fun'),
        (Text, u' '),
        (Name.Function, u'`wo,-bble`'),
        (Text, u'\n')
    ]
    assert list(lexer.get_tokens(fragment)) == tokens 
Example #3
Source File: test_kotlin.py    From pygments with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def test_can_cope_with_generics(lexer):
    fragment = u'inline fun <reified T : ContractState> VaultService.queryBy(): Vault.Page<T> {'
    tokens = [
        (Keyword, u'inline fun'),
        (Text, u' '),
        (Punctuation, u'<'),
        (Keyword, u'reified'),
        (Text, u' '),
        (Name, u'T'),
        (Text, u' '),
        (Punctuation, u':'),
        (Text, u' '),
        (Name, u'ContractState'),
        (Punctuation, u'>'),
        (Text, u' '),
        (Name.Class, u'VaultService'),
        (Punctuation, u'.'),
        (Name.Function, u'queryBy'),
        (Punctuation, u'('),
        (Punctuation, u')'),
        (Punctuation, u':'),
        (Text, u' '),
        (Name, u'Vault'),
        (Punctuation, u'.'),
        (Name, u'Page'),
        (Punctuation, u'<'),
        (Name, u'T'),
        (Punctuation, u'>'),
        (Text, u' '),
        (Punctuation, u'{'),
        (Text, u'\n')
    ]
    assert list(lexer.get_tokens(fragment)) == tokens 
Example #4
Source File: test_idris.py    From pygments with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 
Example #5
Source File: test_r.py    From pygments with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def test_call(lexer):
    fragment = u'f(1, a)\n'
    tokens = [
        (Name.Function, u'f'),
        (Punctuation, u'('),
        (Token.Literal.Number, u'1'),
        (Punctuation, u','),
        (Token.Text, u' '),
        (Token.Name, u'a'),
        (Punctuation, u')'),
        (Token.Text, u'\n'),
    ]
    assert list(lexer.get_tokens(fragment)) == tokens