Fixes for Smalltalk/X
* Do not use Character class>>#cr /#lf as semantics of this method differ in Smalltalk/X and Squeak.
Use Character class>>#codePoint: instead
* Do not use Squeakism Dictionary >> #keysSortedSafely - there is no need for this as
all keys are strings.
"{ Package: 'stx:goodies/petitparser/parsers/java' }"
"{ NameSpace: Smalltalk }"
PPParser subclass:#PPJavaWhitespaceParser
instanceVariableNames:'separator'
classVariableNames:''
poolDictionaries:''
category:'PetitJava-Core'
!
!PPJavaWhitespaceParser methodsFor:'as yet unclassified'!
acceptsEpsilon
^ true
!
acceptsEpsilonOpenSet: set
^ true
!
firstCharParser
^ PPFailingParser new
!
firstCharSet
^ PPCharSetPredicate on: [:e | false ]
!
isNullable
^ true
!
name
^ 'java_ws'
!
parseOn: context
| start |
[
| peekTwice |
[ context atEnd not and: [ context peek isSeparator ] ]
whileTrue: [ context next ].
peekTwice := context peekTwice.
((peekTwice first = $/) and:
[ (peekTwice second = $*) or: [peekTwice second = $/]])
] whileTrue: [
context next.
start := context position.
(context next = $*)
ifTrue: [ context upToAll: '*/' ]
ifFalse: [
| position |
position := context position.
context upToAnyOf: CharacterSet crlf].
].
! !