make read-cdot group datums from left-to-right
so that X.Y.Z is read as (#%dot (#%dot X Y) Z)
This commit is contained in:
parent
5708526055
commit
d648c8cc42
|
@ -2035,6 +2035,10 @@ read_inner_inner(Scheme_Object *port, Scheme_Object *stxsrc, Scheme_Hash_Table *
|
||||||
|
|
||||||
if (!read_cdot) { return ret; }
|
if (!read_cdot) { return ret; }
|
||||||
|
|
||||||
|
// read in zero or more . sequences in a left-associative way
|
||||||
|
// X.Y should be read as (#%dot X Y)
|
||||||
|
// X.Y.Z should be read as (#%dot (#%dot X Y) Z)
|
||||||
|
while ( 1 ) {
|
||||||
found_dot = 0;
|
found_dot = 0;
|
||||||
while ( 1 ) {
|
while ( 1 ) {
|
||||||
next = scheme_peekc_special_ok(port);
|
next = scheme_peekc_special_ok(port);
|
||||||
|
@ -2048,14 +2052,17 @@ read_inner_inner(Scheme_Object *port, Scheme_Object *stxsrc, Scheme_Hash_Table *
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( found_dot ) {
|
if ( !found_dot ) {
|
||||||
|
return ret;
|
||||||
|
} else {
|
||||||
Scheme_Object *dot, *next;
|
Scheme_Object *dot, *next;
|
||||||
|
|
||||||
scheme_tell_all(port, &dline, &dcol, &dpos);
|
scheme_tell_all(port, &dline, &dcol, &dpos);
|
||||||
dot = dot_symbol;
|
dot = dot_symbol;
|
||||||
if (stxsrc) {
|
if (stxsrc) {
|
||||||
dot = scheme_make_stx_w_offset(dot, dline, dcol, dpos, SPAN(port,dpos), stxsrc, STX_SRCTAG);
|
dot = scheme_make_stx_w_offset(dot, dline, dcol, dpos, SPAN(port,dpos), stxsrc, STX_SRCTAG);
|
||||||
}
|
}
|
||||||
next = read_inner_inner(port, stxsrc, ht, indentation, params, comment_mode, pre_char, table, get_info);
|
next = read_inner_inner_inner(port, stxsrc, ht, indentation, params, comment_mode, pre_char, table, get_info);
|
||||||
if (SCHEME_EOFP(next)) {
|
if (SCHEME_EOFP(next)) {
|
||||||
scheme_read_err(port, stxsrc, dline, dcol, dpos, 1, EOF, indentation,
|
scheme_read_err(port, stxsrc, dline, dcol, dpos, 1, EOF, indentation,
|
||||||
"read: expected a datum after cdot, found end-of-file");
|
"read: expected a datum after cdot, found end-of-file");
|
||||||
|
@ -2068,7 +2075,9 @@ read_inner_inner(Scheme_Object *port, Scheme_Object *stxsrc, Scheme_Hash_Table *
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
// look for more dots after this
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Scheme_Object *
|
static Scheme_Object *
|
||||||
|
|
Loading…
Reference in New Issue
Block a user