def test_loop_(self): """test : loop_""" cases = [ ('abcde', '((abcde)((abcde)*))'), ] for case in cases: self.assertEqual(yare.loop_(case[0]), case[1])
t_INT = yare.concat(list('int')) t_VOID = yare.concat(list('void')) # Keywords t_ELSE = yare.concat(list('else')) t_EXTERN = yare.concat(list('extern')) t_IF = yare.concat(list('if')) t_RETURN = yare.concat(list('return')) t_WHILE = yare.concat(list('while')) # Literals def t_INTCON(t): t.value = int(t.value) return t t_INTCON.__doc__ = yare.concat([ yare.loop_(yare.DIGIT), ]) __STRINGCON__ = ' !#$%&\'()*+,-./0123456789:;<=>?@' + \ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~' t_STRINGCON = yare.concat([ '"', yare.loop( yare.select([ yare.select(list(__STRINGCON__)), yare.concat(['\\', yare.select(['n', '\\', '"'])]), ]) ), '"', ])
# Keywords t_ELSE = yare.concat(list('else')) t_EXTERN = yare.concat(list('extern')) t_IF = yare.concat(list('if')) t_RETURN = yare.concat(list('return')) t_WHILE = yare.concat(list('while')) # Literals def t_INTCON(t): t.value = int(t.value) return t t_INTCON.__doc__ = yare.concat([ yare.loop_(yare.DIGIT), ]) __STRINGCON__ = ' !#$%&\'()*+,-./0123456789:;<=>?@' + \ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~' t_STRINGCON = yare.concat([ '"', yare.loop( yare.select([ yare.select(list(__STRINGCON__)), yare.concat(['\\', yare.select(['n', '\\', '"'])]), ])), '"', ]) __CHARCON__ = ' !#$%&()*+,-./0123456789:;<=>?@' + \