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


Python token.string_to_tokentype方法代碼示例

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


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

示例1: parse_pygments_style

# 需要導入模塊: from pygments import token [as 別名]
# 或者: from pygments.token import string_to_tokentype [as 別名]
def parse_pygments_style(token_name, style_object, style_dict):
    """Parse token type and style string.

    :param token_name: str name of Pygments token. Example: "Token.String"
    :param style_object: pygments.style.Style instance to use as base
    :param style_dict: dict of token names and their styles, customized to this cli

    """
    token_type = string_to_tokentype(token_name)
    try:
        other_token_type = string_to_tokentype(style_dict[token_name])
        return token_type, style_object.styles[other_token_type]
    except AttributeError:
        return token_type, style_dict[token_name] 
開發者ID:dbcli,項目名稱:pgcli,代碼行數:16,代碼來源:pgstyle.py

示例2: parse_pygments_style

# 需要導入模塊: from pygments import token [as 別名]
# 或者: from pygments.token import string_to_tokentype [as 別名]
def parse_pygments_style(token_name, style_object, style_dict):
    """Parse token type and style string.

    :param token_name: str name of Pygments token. Example: "Token.String"
    :param style_object: pygments.style.Style instance to use as base
    :param style_dict: dict of token names and their styles, customized to this cli

    """
    token_type = string_to_tokentype(token_name)
    try:
        other_token_type = string_to_tokentype(style_dict[token_name])
        return token_type, style_object.styles[other_token_type]
    except AttributeError as err:
        return token_type, style_dict[token_name] 
開發者ID:dbcli,項目名稱:litecli,代碼行數:16,代碼來源:clistyle.py

示例3: parse_pygments_style

# 需要導入模塊: from pygments import token [as 別名]
# 或者: from pygments.token import string_to_tokentype [as 別名]
def parse_pygments_style(token_name, style_object, style_dict):
    """Parse token type and style string.
    :param token_name: str name of Pygments token. Example: "Token.String"
    :param style_object: pygments.style.Style instance to use as base
    :param style_dict: dict of token names and their styles, customized to this cli
    """
    token_type = string_to_tokentype(token_name)
    try:
        other_token_type = string_to_tokentype(style_dict[token_name])
        return token_type, style_object.styles[other_token_type]
    except AttributeError as err:
        return token_type, style_dict[token_name] 
開發者ID:dbcli,項目名稱:athenacli,代碼行數:14,代碼來源:clistyle.py

示例4: test_functions

# 需要導入模塊: from pygments import token [as 別名]
# 或者: from pygments.token import string_to_tokentype [as 別名]
def test_functions():
    assert token.is_token_subtype(token.String, token.String)
    assert token.is_token_subtype(token.String, token.Literal)
    assert not token.is_token_subtype(token.Literal, token.String)

    assert token.string_to_tokentype(token.String) is token.String
    assert token.string_to_tokentype('') is token.Token
    assert token.string_to_tokentype('String') is token.String 
開發者ID:pygments,項目名稱:pygments,代碼行數:10,代碼來源:test_token.py

示例5: parse_pygments_style

# 需要導入模塊: from pygments import token [as 別名]
# 或者: from pygments.token import string_to_tokentype [as 別名]
def parse_pygments_style(token_name, style_object, style_dict):
    """Parse token type and style string.
    :param token_name: str name of Pygments token. Example: "Token.String"
    :param style_object: pygments.style.Style instance to use as base
    :param style_dict: dict of token names and their styles, customized to this cli
    """
    token_type = string_to_tokentype(token_name)
    try:
        other_token_type = string_to_tokentype(style_dict[token_name])
        return token_type, style_object.styles[other_token_type]
    except AttributeError:
        return token_type, style_dict[token_name] 
開發者ID:dbcli,項目名稱:mssql-cli,代碼行數:14,代碼來源:mssqlstyle.py


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