def year(columns, name=None):
    """
    Creates the grammar for a field containing a year.

    :param columns: the number of columns for the year
    :param name: the name of the field
    :return:
    """

    if columns < 0:
        # Can't have negative size
        raise BaseException()

    field = numeric(columns, name)

    # Parse action
    field.addParseAction(_to_year)

    return field
Creates the grammar for a field containing a year.

    :param columns: the number of columns for the year
    :param name: the name of the field
    :return: