mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 14:21:10 +02:00
(scm_lreadr): Call scm_i_read_array for all characters followinf '#'
that can start an array. Explicitely disambiguate 'i' and 'e' between introducing numbers and uniform vectors. Do not call scm_i_read_homogenous_vector, since that is also handled by scm_i_read_array now.
This commit is contained in:
parent
bfad4005d2
commit
eb42ff2564
1 changed files with 33 additions and 18 deletions
|
@ -421,21 +421,48 @@ scm_lreadr (SCM *tok_buf, SCM port, SCM *copy)
|
||||||
handle_sharp:
|
handle_sharp:
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
|
/* Vector, arrays, both uniform and not are handled by this
|
||||||
|
one function. It also disambiguates between '#f' and
|
||||||
|
'#f32' and '#f64'.
|
||||||
|
*/
|
||||||
|
case '0': case '1': case '2': case '3': case '4':
|
||||||
|
case '5': case '6': case '7': case '8': case '9':
|
||||||
|
case 'u': case 's': case 'f':
|
||||||
|
case '@':
|
||||||
case '(':
|
case '(':
|
||||||
p = scm_i_lreadparen (tok_buf, port, s_vector, copy, ')');
|
#if SCM_ENABLE_DEPRECATED
|
||||||
return scm_is_null (p) ? scm_nullvect : scm_vector (p);
|
/* See below for 'i' and 'e'. */
|
||||||
|
case 'a':
|
||||||
|
case 'c':
|
||||||
|
case 'y':
|
||||||
|
case 'h':
|
||||||
|
case 'l':
|
||||||
|
#endif
|
||||||
|
return scm_i_read_array (port, c);
|
||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
case 'T':
|
case 'T':
|
||||||
return SCM_BOOL_T;
|
return SCM_BOOL_T;
|
||||||
|
|
||||||
case 'f':
|
|
||||||
/* #f32(...), #f64(...), or just #f.
|
|
||||||
*/
|
|
||||||
return scm_i_read_homogenous_vector (port, 'f');
|
|
||||||
case 'F':
|
case 'F':
|
||||||
|
/* See above for lower case 'f'. */
|
||||||
return SCM_BOOL_F;
|
return SCM_BOOL_F;
|
||||||
|
|
||||||
|
|
||||||
|
case 'i':
|
||||||
|
case 'e':
|
||||||
|
#if SCM_ENABLE_DEPRECATED
|
||||||
|
{
|
||||||
|
/* When next char is '(', it really is an old-style
|
||||||
|
uniform array. */
|
||||||
|
int next_c = scm_getc (port);
|
||||||
|
if (next_c != EOF)
|
||||||
|
scm_ungetc (next_c, port);
|
||||||
|
if (next_c == '(')
|
||||||
|
return scm_i_read_array (port, c);
|
||||||
|
/* Fall through. */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
case 'b':
|
case 'b':
|
||||||
case 'B':
|
case 'B':
|
||||||
case 'o':
|
case 'o':
|
||||||
|
@ -444,24 +471,12 @@ scm_lreadr (SCM *tok_buf, SCM port, SCM *copy)
|
||||||
case 'D':
|
case 'D':
|
||||||
case 'x':
|
case 'x':
|
||||||
case 'X':
|
case 'X':
|
||||||
case 'i':
|
|
||||||
case 'I':
|
case 'I':
|
||||||
case 'e':
|
|
||||||
case 'E':
|
case 'E':
|
||||||
scm_ungetc (c, port);
|
scm_ungetc (c, port);
|
||||||
c = '#';
|
c = '#';
|
||||||
goto num;
|
goto num;
|
||||||
|
|
||||||
case 's':
|
|
||||||
/* #s8(...), #s16(...), #s32(...) or #s64(...)
|
|
||||||
*/
|
|
||||||
return scm_i_read_homogenous_vector (port, 's');
|
|
||||||
|
|
||||||
case 'u':
|
|
||||||
/* #u8(...), #u16(...), #u32(...) or #u64(...)
|
|
||||||
*/
|
|
||||||
return scm_i_read_homogenous_vector (port, 'u');
|
|
||||||
|
|
||||||
case '!':
|
case '!':
|
||||||
/* should never happen, #!...!# block comments are skipped
|
/* should never happen, #!...!# block comments are skipped
|
||||||
over in scm_flush_ws. */
|
over in scm_flush_ws. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue