+static bool
+parse_one_recoding (struct lexer *lexer, struct dataset *ds,
+ struct recode_trns *trns)
+{
+ struct dictionary *dict = dataset_dict (ds);
+
+ /* Parse source variable names,
+ then input to output mappings,
+ then destination variable names. */
+ int src_start = lex_ofs (lexer);
+ if (!parse_src_vars (lexer, trns, dict))
+ return false;
+ int src_end = lex_ofs (lexer) - 1;
+
+ int mappings_start = lex_ofs (lexer);
+ if (!parse_mappings (lexer, trns, dict_get_encoding (dict)))
+ return false;
+ int mappings_end = lex_ofs (lexer) - 1;
+
+ int dst_start = lex_ofs (lexer);
+ if (!parse_dst_vars (lexer, trns, dict,
+ src_start, src_end, mappings_start, mappings_end))
+ return false;
+ int dst_end = lex_ofs (lexer) - 1;
+ if (dst_end < dst_start)
+ {
+ /* There was no target variable syntax, so the target variables are the
+ same as the source variables. */
+ dst_start = src_start;
+ dst_end = src_end;
+ }
+
+ /* Ensure that all the output strings are at least as wide
+ as the widest destination variable. */
+ if (trns->dst_type == VAL_STRING
+ && !enlarge_dst_widths (lexer, trns, dst_start, dst_end))
+ return false;
+
+ /* Create destination variables, if needed.
+ This must be the final step; otherwise we'd have to
+ delete destination variables on failure. */
+ trns->dst_dict = dict;
+ if (trns->src_vars != trns->dst_vars)
+ create_dst_vars (trns, dict);
+
+ /* Done. */
+ add_transformation (ds, &recode_trns_class, trns);
+ return true;
+}
+