def test_loop(self): """test : loop""" cases = [ ('abcde', '((abcde)*)'), ('(abcde)', '(((abcde))*)'), ] for case in cases: self.assertEqual(yare.loop(case[0]), case[1])
# 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:;<=>?@' + \ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~' t_CHARCON = yare.concat([ '\'', yare.select([ yare.select(list(__CHARCON__)), yare.concat(['\\', yare.select(['n', '\\', '\'', '0'])]), ]), '\'', ])
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:;<=>?@' + \ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~' t_CHARCON = yare.concat([ '\'', yare.select([ yare.select(list(__CHARCON__)), yare.concat(['\\', yare.select(['n', '\\', '\'', '0'])]), ]), '\'', ])