PPNotParser.st
changeset 0 739fe9b7253e
child 4 90de244a7fa2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PPNotParser.st	Thu Aug 18 20:56:17 2011 +0200
@@ -0,0 +1,29 @@
+"{ Package: 'squeak:petitparser' }"
+
+PPDelegateParser subclass:#PPNotParser
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitParser-Parsers'
+!
+
+PPNotParser comment:'The not-predicate, a parser that succeeds whenever its delegate does not, but consumes no input [Parr 1994, 1995].'
+!
+
+
+!PPNotParser methodsFor:'parsing'!
+
+parseOn: aStream
+	| element position |
+	position := aStream position.
+	element := parser parseOn: aStream.
+	aStream position: position.
+	^ element isPetitFailure
+		ifFalse: [ PPFailure message: '' at: aStream position ]
+! !
+
+!PPNotParser class methodsFor:'documentation'!
+
+version_SVN
+    ^ '$Id: PPNotParser.st,v 1.1 2011-08-18 18:56:17 cg Exp $'
+! !