equal
deleted
inserted
replaced
1 "{ Encoding: utf8 }" |
|
2 |
|
3 " |
1 " |
4 COPYRIGHT (c) 1994 by Claus Gittinger |
2 COPYRIGHT (c) 1994 by Claus Gittinger |
5 All Rights Reserved |
3 All Rights Reserved |
6 |
4 |
7 This software is furnished under a license and may be used |
5 This software is furnished under a license and may be used |
414 a ClassCategoryReader which reads and compiles chunks for its class. |
412 a ClassCategoryReader which reads and compiles chunks for its class. |
415 However, other than methodsFor expressions are possible - you can |
413 However, other than methodsFor expressions are possible - you can |
416 (in theory) create readers for any syntax. |
414 (in theory) create readers for any syntax. |
417 " |
415 " |
418 |
416 |
419 |aString sawExcla rslt done compiler| |
417 |aString sawExcla rslt done compiler lastClass| |
420 |
418 |
421 self skipSeparators. |
419 self skipSeparators. |
422 self atEnd ifFalse:[ |
420 self atEnd ifFalse:[ |
423 sawExcla := self peekFor:(self class chunkSeparator). |
421 sawExcla := self peekFor:(self class chunkSeparator). |
424 aString := self nextChunk. |
422 aString := self nextChunk. |
425 "/ |
423 "/ |
426 "/ handle empty chunks; |
424 "/ handle empty chunks; |
427 "/ this allows for Squeak code to be filedIn |
425 "/ this allows for Squeak code to be filedIn |
428 "/ |
426 "/ |
429 [aString size == 0 |
427 [aString size == 0 and:[self atEnd not]] whileTrue:[ |
430 and:[self atEnd not]] whileTrue:[ |
|
431 aString := self nextChunk. |
428 aString := self nextChunk. |
432 ]. |
429 ]. |
433 aString size ~~ 0 ifTrue:[ |
430 aString size ~~ 0 ifTrue:[ |
434 passChunk ifTrue:[ |
431 passChunk ifTrue:[ |
435 someone notNil ifTrue:[someone source:aString] |
432 someone notNil ifTrue:[someone source:aString] |
439 compiler allowUndeclaredVariables:false. |
436 compiler allowUndeclaredVariables:false. |
440 |
437 |
441 sawExcla ifFalse:[ |
438 sawExcla ifFalse:[ |
442 "/ class definition chunks, etc., which are simply evaluated |
439 "/ class definition chunks, etc., which are simply evaluated |
443 rslt := compiler evaluate:aString receiver:someone notifying:someone compile:false. |
440 rslt := compiler evaluate:aString receiver:someone notifying:someone compile:false. |
|
441 rslt isBehavior ifTrue:[ |
|
442 lastClass := rslt |
|
443 ] ifFalse:[ |
|
444 lastClass := nil |
|
445 ]. |
444 ] ifTrue:[ |
446 ] ifTrue:[ |
445 "/ methodsFor chunks, etc., which generate a reader |
447 "/ methodsFor chunks, etc., which generate a reader |
446 (Smalltalk at:#Compiler) emptySourceNotificationSignal handle:[:ex | |
448 (Smalltalk at:#Compiler) emptySourceNotificationSignal handle:[:ex | |
447 ^ nil |
449 ^ nil |
448 ] do:[ |
450 ] do:[ |
467 [done] whileFalse:[ |
469 [done] whileFalse:[ |
468 aString := self nextChunk. |
470 aString := self nextChunk. |
469 done := (aString size == 0). |
471 done := (aString size == 0). |
470 ] |
472 ] |
471 ] ifFalse:[ |
473 ] ifFalse:[ |
472 rslt := rslt |
474 Class packageQuerySignal handle:[:ex | |
|
475 lastClass notNil ifTrue:[ |
|
476 ex proceedWith:lastClass package |
|
477 ] ifFalse:[ |
|
478 ex reject |
|
479 ]. |
|
480 ] do:[ |
|
481 rslt := rslt |
473 fileInFrom:self |
482 fileInFrom:self |
474 notifying:someone |
483 notifying:someone |
475 passChunk:passChunk |
484 passChunk:passChunk |
476 single:false |
485 single:false |
477 silent:beSilent |
486 silent:beSilent |
|
487 ]. |
478 ] |
488 ] |
479 ] |
489 ] |
480 ] |
490 ] |
481 ]. |
491 ]. |
482 ^ rslt |
492 ^ rslt |