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


Python Lexer.input方法代码示例

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


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

示例1: testScanBooleanTrue

# 需要导入模块: from Lexer import Lexer [as 别名]
# 或者: from Lexer.Lexer import input [as 别名]
    def testScanBooleanTrue(self):
        lexer = Lexer()
        lexer.input("def boolean = true")
        (tokens, errors) = lexer.allTokens()

        # assert that no error occured
        self.assertEqual(errors, [])

        # assert correct token scanning
        self.assertEqual(types(tokens), 'DEF ID = BOOL')
开发者ID:z-lang,项目名称:z-lang,代码行数:12,代码来源:LexerTest.py

示例2: testScanNegativeInteger

# 需要导入模块: from Lexer import Lexer [as 别名]
# 或者: from Lexer.Lexer import input [as 别名]
    def testScanNegativeInteger(self):
        lexer = Lexer()
        lexer.input("def number = -102")
        (tokens, errors) = lexer.allTokens()

        # assert that no error occured
        self.assertEqual(errors, [])

        # assert correct token scanning
        self.assertEqual(types(tokens), 'DEF ID = INT')
开发者ID:z-lang,项目名称:z-lang,代码行数:12,代码来源:LexerTest.py

示例3: testScanVariable

# 需要导入模块: from Lexer import Lexer [as 别名]
# 或者: from Lexer.Lexer import input [as 别名]
    def testScanVariable(self):
        lexer = Lexer()
        lexer.input("def x = y")
        (tokens, errors) = lexer.allTokens()

        # assert that no error occured
        self.assertEqual(errors, [])

        # assert correct token scanning
        self.assertEqual(types(tokens), 'DEF ID = ID')
开发者ID:z-lang,项目名称:z-lang,代码行数:12,代码来源:LexerTest.py

示例4: testScanLambda

# 需要导入模块: from Lexer import Lexer [as 别名]
# 或者: from Lexer.Lexer import input [as 别名]
    def testScanLambda(self):
        lexer = Lexer()
        lexer.input("def f(x) = lambda(y) x")
        (tokens, errors) = lexer.allTokens()

        # assert that no error occured
        self.assertEqual(errors, [])

        # assert correct token scanning
        self.assertEqual(types(tokens), 'DEF ID ( ID ) = LAMBDA ( ID ) ID')
开发者ID:z-lang,项目名称:z-lang,代码行数:12,代码来源:LexerTest.py

示例5: testScanList

# 需要导入模块: from Lexer import Lexer [as 别名]
# 或者: from Lexer.Lexer import input [as 别名]
    def testScanList(self):
        lexer = Lexer()
        lexer.input("def t = [a, b]")
        (tokens, errors) = lexer.allTokens()

        # assert that no error occured
        self.assertEqual(errors, [])

        # assert correct token scanning
        self.assertEqual(types(tokens), 'DEF ID = [ ID , ID ]')
开发者ID:z-lang,项目名称:z-lang,代码行数:12,代码来源:LexerTest.py

示例6: testScanTuple

# 需要导入模块: from Lexer import Lexer [as 别名]
# 或者: from Lexer.Lexer import input [as 别名]
    def testScanTuple(self):
        lexer = Lexer()
        lexer.input("def t = (a, b)")
        (tokens, errors) = lexer.allTokens()

        # assert that no error occured
        self.assertEqual(errors, [])

        # assert correct token scanning
        self.assertEqual(types(tokens), 'DEF ID = ( ID , ID )')
开发者ID:z-lang,项目名称:z-lang,代码行数:12,代码来源:LexerTest.py

示例7: testScanFunction

# 需要导入模块: from Lexer import Lexer [as 别名]
# 或者: from Lexer.Lexer import input [as 别名]
    def testScanFunction(self):
        lexer = Lexer()
        lexer.input("def f(x) = x")
        (tokens, errors) = lexer.allTokens()

        # assert that no error occured
        self.assertEqual(errors, [])

        # assert correct token scanning
        self.assertEqual(types(tokens), 'DEF ID ( ID ) = ID')
开发者ID:z-lang,项目名称:z-lang,代码行数:12,代码来源:LexerTest.py

示例8: testScanString

# 需要导入模块: from Lexer import Lexer [as 别名]
# 或者: from Lexer.Lexer import input [as 别名]
    def testScanString(self):
        lexer = Lexer()
        lexer.input("def string = \"hello, world!\"")
        (tokens, errors) = lexer.allTokens()

        # assert that no error occured
        self.assertEqual(errors, [])

        # assert correct token scanning
        self.assertEqual(types(tokens), 'DEF ID = STRING')
开发者ID:z-lang,项目名称:z-lang,代码行数:12,代码来源:LexerTest.py


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