-
- if (lex_match_id ("THRU"))
- {
- nor->type = MV_NOR_RANGE;
- if (lex_match_id ("HI") || lex_match_id ("HIGHEST"))
- nor->d[1] = HIGHEST;
- else
- {
- if (!lex_force_num ())
- return 0;
- nor->d[1] = tokval;
- lex_get ();
-
- if (nor->d[0] > nor->d[1])
- {
- msg (SE, _("Range %g THRU %g is not valid because %g is "
- "greater than %g."),
- nor->d[0], nor->d[1], nor->d[0], nor->d[1]);
- return 0;
- }
- }
- }
- else
- nor->type = MV_NOR_NUMBER;
- }
- else
- return -1;
-
- return 1;
-}
-
-/* Parses a set of numeric missing values and stores them into
- `missing[]' and `miss_type' global variables. */
-static int
-parse_numeric (void)
-{
- struct num_or_range set[3];
- int r;
-
- set[1].type = set[2].type = MV_NOR_NOTHING;
-
- /* Get first number or range. */
- r = parse_num_or_range (&set[0]);
- if (r < 1)
- {
- if (r == -1)
- msg (SE, _("Number or range expected."));
- return 0;
- }
-
- /* Get second and third optional number or range. */
- lex_match (',');
- r = parse_num_or_range (&set[1]);
- if (r == 1)
- {
- lex_match (',');
- r = parse_num_or_range (&set[2]);
- }
- if (r == 0)
- return 0;
-
- /* Force range, if present, into set[0]. */
- if (set[1].type == MV_NOR_RANGE)
- {
- struct num_or_range t = set[1];
- set[1] = set[0];
- set[0] = t;
- }
- if (set[2].type == MV_NOR_RANGE)
- {
- struct num_or_range t = set[2];
- set[2] = set[0];
- set[0] = t;
- }
-
- /* Ensure there's not more than one range, or one range
- plus one value. */
- if (set[1].type == MV_NOR_RANGE || set[2].type == MV_NOR_RANGE)
- {
- msg (SE, _("At most one range can exist in the missing values "
- "for any one variable."));
- return 0;
- }
- if (set[0].type == MV_NOR_RANGE && set[2].type != MV_NOR_NOTHING)
- {
- msg (SE, _("At most one individual value can be missing along "
- "with one range."));
- return 0;
- }
-
- /* Set missing[] from set[]. */
- if (set[0].type == MV_NOR_RANGE)
- {
- int x = 0;
-
- if (set[0].d[0] == LOWEST)
- {
- miss_type = MISSING_LOW;
- missing[x++].f = set[0].d[1];
- }
- else if (set[0].d[1] == HIGHEST)
- {
- miss_type = MISSING_HIGH;
- missing[x++].f = set[0].d[0];
- }
- else
- {
- miss_type = MISSING_RANGE;
- missing[x++].f = set[0].d[0];
- missing[x++].f = set[0].d[1];
- }
-
- if (set[1].type == MV_NOR_NUMBER)
- {
- miss_type += 3;
- missing[x].f = set[1].d[0];
- }
- }
- else
- {
- if (set[0].type == MV_NOR_NUMBER)
- {
- miss_type = MISSING_1;
- missing[0].f = set[0].d[0];
- }
- if (set[1].type == MV_NOR_NUMBER)
- {
- miss_type = MISSING_2;
- missing[1].f = set[1].d[0];
- }
- if (set[2].type == MV_NOR_NUMBER)
- {
- miss_type = MISSING_3;
- missing[2].f = set[2].d[0];
- }