--- a/compiler/extensions.st Tue Aug 18 21:47:50 2015 +0100
+++ b/compiler/extensions.st Tue Aug 18 22:16:18 2015 +0100
@@ -761,15 +761,32 @@
!PPSmalltalkWhitespaceParser methodsFor:'*petitcompiler'!
parseOn: aPPContext
- [ [aPPContext atEnd not and: [ aPPContext uncheckedPeek isSeparator ] ]
- whileTrue: [ aPPContext next ].
-
- aPPContext atEnd not and: [ aPPContext uncheckedPeek = $" ] ] whileTrue: [
- aPPContext next.
- "aPPContext upTo: $".
-
- [aPPContext atEnd or: [aPPContext next == $"]] whileFalse
+ [
+ [aPPContext atEnd not and: [ aPPContext uncheckedPeek isSeparator ] ]whileTrue: [
+ aPPContext next
+ ].
+ aPPContext atEnd not and: [ aPPContext uncheckedPeek = $" ]
+ ] whileTrue: [
+ aPPContext next. "Eat opening $"
+
+ "When running on Smalltalk/X, also support end-of-line comments "
+ "Here, test first if the char following the opening quote is slash
+ and only if so test for Smalltalk/X as this test is lot slower
+ then slash test"
+ ((aPPContext atEnd not and:[ aPPContext uncheckedPeek == $/ ])
+ and:[(Smalltalk respondsTo: #isSmalltalkX) and:[Smalltalk isSmalltalkX]]) ifTrue:[
+ "OK, comment start with quote-slash and we're on Smalltalk/X so eat
+ everything till the end of a line"
+ | c |
+
+ [ aPPContext atEnd or:[ c := aPPContext next codePoint. c == 13 or:[c == 10] ] ] whileFalse.
+ ] ifFalse:[
+ "Standard comment so eat till closing quot"
+ [ aPPContext atEnd or: [ aPPContext next == $" ] ] whileFalse
+ ].
].
+
+ "Modified: / 18-08-2015 / 22:13:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!PPStream methodsFor:'*petitcompiler'!