+2002-12-28 Neil Jerram <neil@ossau.uklinux.net>
+
+ * read.h (scm_lreadparen), read.c (scm_lreadr, scm_read_token,
+ scm_lreadparen): Support reading vectors with Elisp syntax if
+ SCM_ELISP_READ_EXTENSIONS is defined. (SCM_ELISP_READ_EXTENSIONS
+ is not currently defined, and there isn't even a configure switch
+ to enable it yet.)
+
2002-12-26 Marius Vollmer <mvo@zagadka.ping.de>
* Makefile.am (c-tokenize.o): Refer to source via $< so that vpath
case '(':
return SCM_RECORD_POSITIONS_P
? scm_lreadrecparen (tok_buf, port, s_list, copy)
- : scm_lreadparen (tok_buf, port, s_list, copy);
+ : scm_lreadparen (tok_buf, port, s_list, copy SCM_ELISP_CLOSE);
case ')':
scm_input_error (FUNC_NAME, port,"unexpected \")\"", SCM_EOL);
goto tryagain;
+#ifdef SCM_ELISP_READ_EXTENSIONS
+ case '[':
+ p = scm_lreadparen (tok_buf, port, "vector", copy, ']');
+ return SCM_NULLP (p) ? scm_nullvect : scm_vector (p);
+#endif
case '\'':
p = scm_sym_quote;
goto recquote;
switch (c)
{
case '(':
- p = scm_lreadparen (tok_buf, port, "vector", copy);
+ p = scm_lreadparen (tok_buf, port, "vector", copy SCM_ELISP_CLOSE);
return SCM_NULLP (p) ? scm_nullvect : scm_vector (p);
case 't':
{
case '(':
case ')':
+#ifdef SCM_ELISP_READ_EXTENSIONS
+ case '[':
+ case ']':
+#endif
case '"':
case ';':
case SCM_WHITE_SPACES:
#endif
SCM
-scm_lreadparen (SCM *tok_buf, SCM port, char *name, SCM *copy)
+scm_lreadparen (SCM *tok_buf, SCM port, char *name, SCM *copy
+#ifdef SCM_ELISP_READ_EXTENSIONS
+ , char term_char
+#else
+#define term_char ')'
+#endif
+ )
#define FUNC_NAME "scm_lreadparen"
{
SCM tmp;
int c;
c = scm_flush_ws (port, name);
- if (')' == c)
+ if (term_char == c)
return SCM_EOL;
scm_ungetc (c, port);
if (SCM_EQ_P (scm_sym_dot, (tmp = scm_lreadr (tok_buf, port, copy))))
{
ans = scm_lreadr (tok_buf, port, copy);
closeit:
- if (')' != (c = scm_flush_ws (port, name)))
+ if (term_char != (c = scm_flush_ws (port, name)))
scm_input_error (FUNC_NAME, port, "missing close paren", SCM_EOL);
return ans;
}
ans = tl = scm_cons (tmp, SCM_EOL);
- while (')' != (c = scm_flush_ws (port, name)))
+ while (term_char != (c = scm_flush_ws (port, name)))
{
scm_ungetc (c, port);
if (SCM_EQ_P (scm_sym_dot, (tmp = scm_lreadr (tok_buf, port, copy))))
return ans;
}
#undef FUNC_NAME
+#ifndef SCM_ELISP_READ_EXTENSIONS
+#undef term_char
+#endif
SCM
SCM_API int scm_casei_streq (char * s1, char * s2);
SCM_API SCM scm_lreadr (SCM * tok_buf, SCM port, SCM *copy);
SCM_API size_t scm_read_token (int ic, SCM * tok_buf, SCM port, int weird);
-SCM_API SCM scm_lreadparen (SCM * tok_buf, SCM port, char *name, SCM *copy);
+SCM_API SCM scm_lreadparen (SCM * tok_buf, SCM port, char *name, SCM *copy
+#ifdef SCM_ELISP_READ_EXTENSIONS
+ , char term_char
+#define SCM_ELISP_CLOSE , ')'
+#else
+#define SCM_ELISP_CLOSE
+#endif
+ );
SCM_API SCM scm_lreadrecparen (SCM * tok_buf, SCM port, char *name, SCM *copy);
SCM_API SCM scm_read_hash_extend (SCM chr, SCM proc);
SCM_API void scm_init_read (void);