--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/parsers/java/PPJavaWhitespaceParser.st Tue Apr 21 14:57:16 2015 +0100
@@ -0,0 +1,63 @@
+"{ Package: 'stx:goodies/petitparser/parsers/java' }"
+
+"{ NameSpace: Smalltalk }"
+
+PPParser subclass:#PPJavaWhitespaceParser
+ instanceVariableNames:'separator'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'PetitJava-Core'
+!
+
+PPJavaWhitespaceParser comment:''
+!
+
+!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].
+ ].
+! !
+