compiler/extensions.st
changeset 522 837963c607a6
parent 519 1563dce3c5b4
child 525 751532c8f3db
equal deleted inserted replaced
521:c1a810e250dc 522:837963c607a6
   759 ! !
   759 ! !
   760 
   760 
   761 !PPSmalltalkWhitespaceParser methodsFor:'*petitcompiler'!
   761 !PPSmalltalkWhitespaceParser methodsFor:'*petitcompiler'!
   762 
   762 
   763 parseOn: aPPContext
   763 parseOn: aPPContext
   764     [ [aPPContext atEnd not and: [ aPPContext uncheckedPeek isSeparator ] ]
   764     [ 
   765         whileTrue: [ aPPContext next ].
   765         [aPPContext atEnd not and: [ aPPContext uncheckedPeek isSeparator ] ]whileTrue: [ 
   766         
   766             aPPContext next 
   767      aPPContext atEnd not and: [ aPPContext uncheckedPeek = $" ] ] whileTrue: [
   767         ].
   768         aPPContext next.
   768         aPPContext atEnd not and: [ aPPContext uncheckedPeek = $" ] 
   769         "aPPContext upTo: $".
   769     ] whileTrue: [
   770         
   770         aPPContext next. "Eat opening $"
   771         [aPPContext atEnd or: [aPPContext next == $"]] whileFalse
   771 
   772     ].
   772         "When running on Smalltalk/X, also support end-of-line comments "
       
   773         "Here, test first if the char following the opening quote is slash
       
   774          and only if so test for Smalltalk/X as this test is lot slower
       
   775          then slash test"
       
   776         ((aPPContext atEnd not and:[ aPPContext uncheckedPeek == $/ ])
       
   777             and:[(Smalltalk respondsTo: #isSmalltalkX) and:[Smalltalk isSmalltalkX]]) ifTrue:[ 
       
   778                 "OK, comment start with quote-slash and we're on Smalltalk/X so eat
       
   779                  everything till the end of a line"
       
   780                 | c |
       
   781 
       
   782                 [ aPPContext atEnd or:[ c := aPPContext next codePoint. c == 13 or:[c == 10] ] ] whileFalse.
       
   783             ] ifFalse:[ 
       
   784                 "Standard comment so eat till closing quot"
       
   785                 [ aPPContext atEnd or: [ aPPContext next == $" ] ] whileFalse
       
   786             ].
       
   787     ].
       
   788 
       
   789     "Modified: / 18-08-2015 / 22:13:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   773 ! !
   790 ! !
   774 
   791 
   775 !PPStream methodsFor:'*petitcompiler'!
   792 !PPStream methodsFor:'*petitcompiler'!
   776 
   793 
   777 peek: anInteger
   794 peek: anInteger