当前位置: 首页>>代码示例>>Python>>正文


Python Lexer.input方法代码示例

本文整理汇总了Python中xonsh.lexer.Lexer.input方法的典型用法代码示例。如果您正苦于以下问题:Python Lexer.input方法的具体用法?Python Lexer.input怎么用?Python Lexer.input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xonsh.lexer.Lexer的用法示例。


在下文中一共展示了Lexer.input方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: check_token

# 需要导入模块: from xonsh.lexer import Lexer [as 别名]
# 或者: from xonsh.lexer.Lexer import input [as 别名]
def check_token(inp, exp):
    l = Lexer()
    l.input(inp)
    obs = list(l)
    if len(obs) != 1:
        msg = 'The observed sequence does not have length-1: {0!r} != 1\n'
        msg += '# obs\n{1}'
        raise AssertionError(msg.format(len(obs), pformat(obs)))
    return assert_token_equal(exp, obs[0])
开发者ID:BlaXpirit,项目名称:xonsh,代码行数:11,代码来源:test_lexer.py

示例2: check_token

# 需要导入模块: from xonsh.lexer import Lexer [as 别名]
# 或者: from xonsh.lexer.Lexer import input [as 别名]
def check_token(inp, exp):
    l = Lexer()
    l.input(inp)
    obs = list(l)
    if len(obs) != 1:
        msg = "The observed sequence does not have length-1: {0!r} != 1\n"
        msg += "# obs\n{1}"
        pytest.fail(msg.format(len(obs), pformat(obs)))
    return assert_token_equal(exp, obs[0])
开发者ID:mitnk,项目名称:xonsh,代码行数:11,代码来源:test_lexer.py

示例3: check_tokens_subproc

# 需要导入模块: from xonsh.lexer import Lexer [as 别名]
# 或者: from xonsh.lexer.Lexer import input [as 别名]
def check_tokens_subproc(inp, exp):
    l = Lexer()
    l.input('$[{}]'.format(inp))
    obs = list(l)[1:-1]
    return assert_tokens_equal(exp, obs)
开发者ID:BlaXpirit,项目名称:xonsh,代码行数:7,代码来源:test_lexer.py

示例4: check_tokens

# 需要导入模块: from xonsh.lexer import Lexer [as 别名]
# 或者: from xonsh.lexer.Lexer import input [as 别名]
def check_tokens(inp, exp):
    l = Lexer()
    l.input(inp)
    obs = list(l)
    return assert_tokens_equal(exp, obs)
开发者ID:BlaXpirit,项目名称:xonsh,代码行数:7,代码来源:test_lexer.py

示例5: test_redir_whitespace

# 需要导入模块: from xonsh.lexer import Lexer [as 别名]
# 或者: from xonsh.lexer.Lexer import input [as 别名]
def test_redir_whitespace(case):
    inp = '![{}/path/to/file]'.format(case)
    l = Lexer()
    l.input(inp)
    obs = list(l)
    assert obs[2].type == 'WS'
开发者ID:tinloaf,项目名称:xonsh,代码行数:8,代码来源:test_lexer.py

示例6: check_tokens_subproc

# 需要导入模块: from xonsh.lexer import Lexer [as 别名]
# 或者: from xonsh.lexer.Lexer import input [as 别名]
def check_tokens_subproc(inp, exp, stop=-1):
    l = Lexer()
    l.input("$[{}]".format(inp))
    obs = list(l)[1:stop]
    return assert_tokens_equal(exp, obs)
开发者ID:mitnk,项目名称:xonsh,代码行数:7,代码来源:test_lexer.py


注:本文中的xonsh.lexer.Lexer.input方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。