# HG changeset patch # User Jan Vrany # Date 1439932578 -3600 # Node ID 837963c607a640d270487913b604317faae03831 # Parent c1a810e250dc26feae6b80524c84fe82b4d62fb0 Fixed support for Smalltalk/X end-of-line comments in PPSmalltalkGrammar. diff -r c1a810e250dc -r 837963c607a6 compiler/extensions.st --- 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 " ! ! !PPStream methodsFor:'*petitcompiler'!