示例#1
0
 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('<='))