當前位置: 首頁>>代碼示例>>Python>>正文


Python Name.Function方法代碼示例

本文整理匯總了Python中pygments.token.Name.Function方法的典型用法代碼示例。如果您正苦於以下問題:Python Name.Function方法的具體用法?Python Name.Function怎麽用?Python Name.Function使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pygments.token.Name的用法示例。


在下文中一共展示了Name.Function方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_can_cope_with_backtick_names_in_functions

# 需要導入模塊: from pygments.token import Name [as 別名]
# 或者: from pygments.token.Name import Function [as 別名]
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 
開發者ID:pygments,項目名稱:pygments,代碼行數:11,代碼來源:test_kotlin.py

示例2: test_can_cope_with_commas_and_dashes_in_backtick_Names

# 需要導入模塊: from pygments.token import Name [as 別名]
# 或者: from pygments.token.Name import Function [as 別名]
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 
開發者ID:pygments,項目名稱:pygments,代碼行數:11,代碼來源:test_kotlin.py

示例3: test_can_cope_with_generics

# 需要導入模塊: from pygments.token import Name [as 別名]
# 或者: from pygments.token.Name import Function [as 別名]
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 
開發者ID:pygments,項目名稱:pygments,代碼行數:35,代碼來源:test_kotlin.py

示例4: test_reserved_word

# 需要導入模塊: from pygments.token import Name [as 別名]
# 或者: from pygments.token.Name import Function [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 
開發者ID:pygments,項目名稱:pygments,代碼行數:28,代碼來源:test_idris.py

示例5: test_call

# 需要導入模塊: from pygments.token import Name [as 別名]
# 或者: from pygments.token.Name import Function [as 別名]
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 
開發者ID:pygments,項目名稱:pygments,代碼行數:15,代碼來源:test_r.py


注:本文中的pygments.token.Name.Function方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。