mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-03-10 07:00:20 -07:00
reader: simplify and clarify arguments of ecl_read_token
This commit is contained in:
parent
8a13a9e85f
commit
aef1cd8129
3 changed files with 16 additions and 5 deletions
|
|
@ -115,14 +115,15 @@ ecl_dispatch_reader_fun(cl_object in, cl_object dc)
|
|||
}
|
||||
|
||||
cl_object
|
||||
ecl_read_token(cl_object in, int flags, int c, enum ecl_chattrib a)
|
||||
ecl_read_token(cl_object in, int flags, bool escape_first_p)
|
||||
{
|
||||
cl_object x, token;
|
||||
int base;
|
||||
int c, base;
|
||||
cl_object p;
|
||||
cl_index length, i;
|
||||
int colon, intern_flag;
|
||||
bool external_symbol;
|
||||
enum ecl_chattrib a;
|
||||
cl_env_ptr the_env = ecl_process_env();
|
||||
cl_object rtbl = ecl_current_readtable();
|
||||
enum ecl_readtable_case read_case = rtbl->readtable.read_case;
|
||||
|
|
@ -135,6 +136,15 @@ ecl_read_token(cl_object in, int flags, int c, enum ecl_chattrib a)
|
|||
colon = upcase = count = length = 0;
|
||||
external_symbol = 0;
|
||||
token = si_get_buffer_string();
|
||||
|
||||
if (escape_first_p) {
|
||||
c = 0;
|
||||
a = cat_single_escape;
|
||||
} else {
|
||||
c = ecl_read_char_noeof(in);
|
||||
a = ecl_readtable_get(rtbl, c, NULL);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
if (c == ':' && (flags != ECL_READ_ONLY_TOKEN) &&
|
||||
a == cat_constituent) {
|
||||
|
|
@ -363,5 +373,6 @@ ecl_read_object_with_delimiter(cl_object in, int delimiter, int flags)
|
|||
}
|
||||
return o;
|
||||
}
|
||||
return ecl_read_token(in, flags, c, a);
|
||||
ecl_unread_char(c, in);
|
||||
return ecl_read_token(in, flags, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ sharp_backslash_reader(cl_object in, cl_object c, cl_object d)
|
|||
FEreader_error("~S is an illegal CHAR-FONT.", in, 1, d);
|
||||
}
|
||||
}
|
||||
token = ecl_read_token(in, ECL_READ_ONLY_TOKEN, 0, cat_single_escape);
|
||||
token = ecl_read_token(in, ECL_READ_ONLY_TOKEN, 1);
|
||||
if (token == ECL_NIL) {
|
||||
c = ECL_NIL;
|
||||
} else if (TOKEN_STRING_FILLP(token) == 1) {
|
||||
|
|
|
|||
|
|
@ -1578,7 +1578,7 @@ extern ECL_API cl_object ecl_read_eval(cl_object in);
|
|||
extern ECL_API cl_object ecl_read_object_non_recursive(cl_object in);
|
||||
extern ECL_API cl_object ecl_read_object_with_delimiter(cl_object in, int del, int flags);
|
||||
extern ECL_API cl_object ecl_read_object(cl_object in);
|
||||
extern ECL_API cl_object ecl_read_token(cl_object in, int flags, int c, enum ecl_chattrib a);
|
||||
extern ECL_API cl_object ecl_read_token(cl_object in, int flags, bool esc);
|
||||
extern ECL_API cl_object ecl_parse_number(cl_object s, cl_index start, cl_index end, cl_index *ep, unsigned int radix);
|
||||
extern ECL_API cl_object ecl_parse_integer(cl_object s, cl_index start, cl_index end, cl_index *ep, unsigned int radix);
|
||||
extern ECL_API bool ecl_invalid_character_p(int c);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue