コード例 #1
0
ファイル: utils_test.py プロジェクト: hsinhuang/yare
 def test_diff(self):
     """test : diff"""
     import string
     cases = [
         (list(string.printable), '()'),
     ]
     for case in cases:
         self.assertEqual(yare.diff(case[0]), case[1])
コード例 #2
0
ファイル: cmm_lex.py プロジェクト: hsinhuang/yaly
    '\'',
    yare.select([
        yare.select(list(__CHARCON__)),
        yare.concat(['\\', yare.select(['n', '\\', '\'', '0'])]),
    ]),
    '\'',
])

def t_COMMENT(t):
    t.lexer.lineno += 1
    t.skip = True
    return t
t_COMMENT.__doc__ = yare.concat([
    '/',
    '/',
    yare.loop(yare.diff(['\n'])),
    '\n',
])

# Operators
t_ASSIGN = yare.escape('=')
t_PLUS = yare.escape('+')
t_MINUS = yare.escape('-')
t_TIMES = yare.escape('*')
t_DIVIDE = yare.escape('/')
t_OR = yare.concat(list('||'))
t_AND = yare.concat(list('&&'))
t_NOT = yare.escape('!')
t_LT = yare.escape('<')
t_GT = yare.escape('>')
t_LE = yare.concat(list('<='))
コード例 #3
0
        yare.concat(['\\', yare.select(['n', '\\', '\'', '0'])]),
    ]),
    '\'',
])


def t_COMMENT(t):
    t.lexer.lineno += 1
    t.skip = True
    return t


t_COMMENT.__doc__ = yare.concat([
    '/',
    '/',
    yare.loop(yare.diff(['\n'])),
    '\n',
])

# Operators
t_ASSIGN = yare.escape('=')
t_PLUS = yare.escape('+')
t_MINUS = yare.escape('-')
t_TIMES = yare.escape('*')
t_DIVIDE = yare.escape('/')
t_OR = yare.concat(list('||'))
t_AND = yare.concat(list('&&'))
t_NOT = yare.escape('!')
t_LT = yare.escape('<')
t_GT = yare.escape('>')
t_LE = yare.concat(list('<='))