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( "type", &lisp_type );
|
||||||
|
|
||||||
bind_function( "add", &lisp_add );
|
bind_function( "add", &lisp_add );
|
||||||
|
bind_function( "+", &lisp_add );
|
||||||
bind_function( "multiply", &lisp_multiply );
|
bind_function( "multiply", &lisp_multiply );
|
||||||
|
bind_function( "*", &lisp_multiply );
|
||||||
bind_function( "subtract", &lisp_subtract );
|
bind_function( "subtract", &lisp_subtract );
|
||||||
|
bind_function( "-", &lisp_subtract );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* primitive special forms
|
* primitive special forms
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "consspaceobject.h"
|
#include "consspaceobject.h"
|
||||||
#include "integer.h"
|
#include "integer.h"
|
||||||
#include "intern.h"
|
#include "intern.h"
|
||||||
|
#include "print.h"
|
||||||
#include "read.h"
|
#include "read.h"
|
||||||
#include "real.h"
|
#include "real.h"
|
||||||
|
|
||||||
|
@ -194,7 +195,7 @@ struct cons_pointer read_symbol( FILE * input, wint_t initial ) {
|
||||||
ungetwc( initial, input );
|
ungetwc( initial, input );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if ( iswalnum( initial ) ) {
|
if ( iswprint( initial ) && ! iswblank( initial ) ) {
|
||||||
result =
|
result =
|
||||||
make_symbol( initial, read_symbol( input, fgetwc( input ) ) );
|
make_symbol( initial, read_symbol( input, fgetwc( input ) ) );
|
||||||
} else {
|
} else {
|
||||||
|
@ -207,6 +208,10 @@ struct cons_pointer read_symbol( FILE * input, wint_t initial ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fputws(L"Read symbol '", stderr);
|
||||||
|
print(stderr, result);
|
||||||
|
fputws(L"'\n", stderr);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue