csv_to_grammar: add more flexibility