diff --git a/src/c/reader.d b/src/c/reader.d index 5f467f664..0efffe077 100644 --- a/src/c/reader.d +++ b/src/c/reader.d @@ -204,6 +204,32 @@ ecl_put_reader_token(cl_object token) the_env->token_pool = CONS(token, pool); } +static ecl_character +_ecl_string_push_extend(cl_object s, ecl_character c) +{ + cl_index dim, fillp; + switch(ecl_t_of(s)) { +#ifdef ECL_UNICODE + case t_string: + fillp = s->string.fillp; + dim = s->string.dim; + if (fillp >= dim) { + ecl_internal_error("token is too long!"); + } + return s->string.self[fillp++] = c; +#endif + case t_base_string: + fillp = s->base_string.fillp; + dim = s->base_string.dim; + if (fillp >= dim) { + ecl_internal_error("token is too long!)"); + } + return s->base_string.self[fillp++] = c; + default: + ecl_internal_error("can't do"); + } +} + /* * This routine inverts the case of the characters in the buffer which were not * escaped. @@ -255,7 +281,7 @@ ecl_read_token(cl_object rtbl, cl_object in, int flags) if (a == cat_single_escape) { c = ecl_read_char_noeof(in); a = cat_constituent; - ecl_string_push_extend(string, c); + _ecl_string_push_extend(string, c); length++; ecl_stack_push(escape, ecl_make_fixnum(length-1)); ecl_stack_push(escape, ecl_make_fixnum(length)); @@ -271,7 +297,7 @@ ecl_read_token(cl_object rtbl, cl_object in, int flags) a = cat_constituent; } else if (a == cat_multiple_escape) break; - ecl_string_push_extend(string, c); + _ecl_string_push_extend(string, c); length++; } ecl_stack_push(escape, ecl_make_fixnum(begin)); @@ -298,7 +324,7 @@ ecl_read_token(cl_object rtbl, cl_object in, int flags) c = ecl_char_upcase(c); } } - ecl_string_push_extend(string, c); + _ecl_string_push_extend(string, c); length++; NEXT: c = ecl_read_char(in);