Fixed bug which caused reader to infinite loop if symbol contained non-alnum.
This commit is contained in:
parent
0685442e1a
commit
89b4f093f9
|
@ -89,8 +89,11 @@ int main( int argc, char *argv[] ) {
|
|||
bind_function( "type", &lisp_type );
|
||||
|
||||
bind_function( "add", &lisp_add );
|
||||
bind_function( "+", &lisp_add );
|
||||
bind_function( "multiply", &lisp_multiply );
|
||||
bind_function( "*", &lisp_multiply );
|
||||
bind_function( "subtract", &lisp_subtract );
|
||||
bind_function( "-", &lisp_subtract );
|
||||
|
||||
/*
|
||||
* primitive special forms
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "consspaceobject.h"
|
||||
#include "integer.h"
|
||||
#include "intern.h"
|
||||
#include "print.h"
|
||||
#include "read.h"
|
||||
#include "real.h"
|
||||
|
||||
|
@ -194,7 +195,7 @@ struct cons_pointer read_symbol( FILE * input, wint_t initial ) {
|
|||
ungetwc( initial, input );
|
||||
break;
|
||||
default:
|
||||
if ( iswalnum( initial ) ) {
|
||||
if ( iswprint( initial ) && ! iswblank( initial ) ) {
|
||||
result =
|
||||
make_symbol( initial, read_symbol( input, fgetwc( input ) ) );
|
||||
} else {
|
||||
|
@ -206,6 +207,10 @@ struct cons_pointer read_symbol( FILE * input, wint_t initial ) {
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
fputws(L"Read symbol '", stderr);
|
||||
print(stderr, result);
|
||||
fputws(L"'\n", stderr);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue