当前位置: 首页>>代码示例>>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;未经允许,请勿转载。