def p_character_digit(p):
    """character : K_DIGIT
                 | K_DIGIT K_FROM NUMBER K_TO NUMBER
    """
    p[0] = p[0] or []
    if len(p) == 6:
        num_from = p[3]
        num_to = p[5]
    else:
        num_from = 0
        num_to = 9
    p[0].append(('digit', (num_from, num_to)))
