reserve square brackets

This commit is contained in:
Yuichi Nishiwaki 2015-01-26 12:29:29 +09:00
parent 684cbc54d4
commit f96579805c
1 changed files with 3 additions and 5 deletions

View File

@ -534,8 +534,7 @@ read_blob(pic_state *pic, struct pic_port *port, int c)
static pic_value static pic_value
read_pair(pic_state *pic, struct pic_port *port, int c) read_pair(pic_state *pic, struct pic_port *port, int c)
{ {
const int tOPEN = c; static const int tCLOSE = ')';
const int tCLOSE = (c == '(') ? ')' : ']';
pic_value car, cdr; pic_value car, cdr;
retry: retry:
@ -564,7 +563,7 @@ read_pair(pic_state *pic, struct pic_port *port, int c)
goto retry; goto retry;
} }
cdr = read_pair(pic, port, tOPEN); cdr = read_pair(pic, port, '(');
return pic_cons(pic, car, cdr); return pic_cons(pic, car, cdr);
} }
} }
@ -586,7 +585,7 @@ read_label_set(pic_state *pic, struct pic_port *port, int i)
int c; int c;
switch ((c = skip(port, ' '))) { switch ((c = skip(port, ' '))) {
case '(': case '[': case '(':
{ {
pic_value tmp; pic_value tmp;
@ -749,7 +748,6 @@ reader_table_init(struct pic_reader *reader)
reader->table['+'] = read_plus; reader->table['+'] = read_plus;
reader->table['-'] = read_minus; reader->table['-'] = read_minus;
reader->table['('] = read_pair; reader->table['('] = read_pair;
reader->table['['] = read_pair;
reader->table['#'] = read_dispatch; reader->table['#'] = read_dispatch;
/* read number */ /* read number */