+/* Parses a BASE-based column using LEXER. Returns true and
+ stores a 1-based column number into *COLUMN if successful,
+ otherwise emits an error message and returns false. */
+static bool
+parse_column (struct lexer *lexer, int base, int *column)
+{
+ assert (base == 0 || base == 1);
+ if (!lex_force_int (lexer))
+ return false;
+ *column = lex_integer (lexer) - base + 1;
+ if (*column < 1)
+ {
+ if (base == 1)
+ msg (SE, _("Column positions for fields must be positive."));
+ else
+ msg (SE, _("Column positions for fields must not be negative."));
+ return false;
+ }
+ lex_get (lexer);
+ return true;
+}
+