- const char *start = cp;
- char *end = lex_skip_identifier (start);
- const char *substitution = find_substitution (block,
- start, end - start);
- if (substitution != NULL)
- ds_puts (&output, substitution);
- else
- ds_concat (&output, start, end - start);
- cp = end;
+ long int a, b;
+ long int i;
+
+ if (!lex_is_integer (lexer))
+ {
+ msg (SE, _("Ranges may only have integer bounds."));
+ return false;
+ }
+
+ a = lex_integer (lexer);
+ lex_get (lexer);
+ lex_get (lexer);
+
+ if (!lex_force_int (lexer))
+ return false;
+
+ b = lex_integer (lexer);
+ if (b < a)
+ {
+ msg (SE, _("%ld TO %ld is an invalid range."), a, b);
+ return false;
+ }
+ lex_get (lexer);
+
+ for (i = a; i <= b; i++)
+ add_replacement (dv, xasprintf ("%ld", i), &allocated);
+ }
+ else
+ {
+ char s[DBL_BUFSIZE_BOUND];
+
+ dtoastr (s, sizeof s, 0, 0, lex_number (lexer));
+ add_replacement (dv, xstrdup (s), &allocated);
+ lex_get (lexer);