Changeset 12646
- Timestamp:
- 05/01/10 21:43:28 (14 years ago)
- Location:
- trunk/abcl/src/org/armedbear/lisp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/LispReader.java
r12604 r12646 47 47 48 48 { 49 try 49 try 50 50 { 51 51 while (true) { 52 52 int n = stream._readChar(); 53 53 if (n < 0) 54 return null;54 return LispThread.currentThread().setValues(); 55 55 if (n == '\n') 56 return null;56 return LispThread.currentThread().setValues(); 57 57 } 58 58 } 59 59 catch (java.io.IOException e) 60 60 { 61 return null;61 return LispThread.currentThread().setValues(); 62 62 } 63 63 } … … 329 329 { 330 330 stream.skipBalancedComment(); 331 return null;331 return LispThread.currentThread().setValues(); 332 332 } 333 333 }; -
trunk/abcl/src/org/armedbear/lisp/Stream.java
r12645 r12646 482 482 if (rt.isWhitespace(c)) 483 483 continue; 484 LispObject result = processChar( c, rt);484 LispObject result = processChar(thread, c, rt); 485 485 if (result != null) 486 486 return result; … … 498 498 } 499 499 500 private final LispObject processChar(char c, Readtable rt) 501 500 /** Dispatch macro function if 'c' has one associated, 501 * read a token otherwise. 502 * 503 * When the macro function returns zero values, this function 504 * returns null or the token or returned value otherwise. 505 */ 506 private final LispObject processChar(LispThread thread, 507 char c, Readtable rt) 502 508 { 503 509 final LispObject handler = rt.getReaderMacroFunction(c); 504 if (handler instanceof ReaderMacroFunction) 505 return ((ReaderMacroFunction)handler).execute(this, c); 506 if (handler != null && handler != NIL) 507 return handler.execute(this, LispCharacter.getInstance(c)); 508 return readToken(c, rt); 510 LispObject value; 511 512 if (handler instanceof ReaderMacroFunction) { 513 thread._values = null; 514 value = ((ReaderMacroFunction)handler).execute(this, c); 515 } 516 else if (handler != null && handler != NIL) { 517 thread._values = null; 518 value = handler.execute(this, LispCharacter.getInstance(c)); 519 } 520 else 521 return readToken(c, rt); 522 523 // If we're looking at zero return values, set 'value' to null 524 if (value == NIL) { 525 LispObject[] values = thread._values; 526 if (values != null && values.length == 0) 527 value = null; 528 } 529 return value; 509 530 } 510 531 … … 659 680 } 660 681 661 thread._values = null; 662 LispObject obj = processChar(c, rt); 663 if (obj == null) { 664 // A comment. 682 LispObject obj = processChar(thread, c, rt); 683 if (obj == null) 665 684 continue; 666 } 667 668 if (! (obj == NIL && thread._values != null 669 && thread._values.length == 0)) { 670 // Don't add the return value NIL to the list 671 // if the _values array indicates no values have been returned 672 if (first == null) { 673 first = new Cons(obj); 674 last = first; 675 } else { 676 Cons newCons = new Cons(obj); 677 last.cdr = newCons; 678 last = newCons; 679 } 685 686 687 if (first == null) { 688 first = new Cons(obj); 689 last = first; 690 } else { 691 Cons newCons = new Cons(obj); 692 last.cdr = newCons; 693 last = newCons; 680 694 } 681 695 } … … 1449 1463 break; 1450 1464 1451 thread._values = null; 1452 LispObject obj = processChar(c, rt); 1453 if (obj != null && 1454 ! (obj == NIL && thread._values != null 1455 && thread._values.length == 0)) 1456 // Don't add 'obj' to the list, if _values indicates 1457 // no values have been returned 1465 LispObject obj = processChar(thread, c, rt); 1466 if (obj != null) 1458 1467 result = new Cons(obj, result); 1459 1468 }
Note: See TracChangeset
for help on using the changeset viewer.