--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/islands/PPNonEmptyParser.st Wed Oct 08 00:33:44 2014 +0100
@@ -0,0 +1,26 @@
+"{ Package: 'stx:goodies/petitparser/islands' }"
+
+PPDelegateParser subclass:#PPNonEmptyParser
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'PetitIslands-Parsers'
+!
+
+PPNonEmptyParser comment:'I return failure, if the delegate parser did not consumed any input.'
+!
+
+!PPNonEmptyParser methodsFor:'parsing'!
+
+parseOn: aPPContext
+ | position result |
+ position := aPPContext position.
+ result := parser parseOn: aPPContext.
+
+
+ (((position == aPPContext position) and: [ aPPContext atEnd not ]) and: [ result isPetitFailure not ]) ifTrue: [
+ ^ PPFailure message: 'Epsilon parse not allowed' context: aPPContext at: position
+ ].
+ ^ result
+! !
+