analyzer/PPRule.st
changeset 203 0f76cf0f33fb
child 292 294bc6d90b37
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/analyzer/PPRule.st	Tue Mar 04 16:42:06 2014 +0100
@@ -0,0 +1,61 @@
+"{ Package: 'stx:goodies/petitparser/analyzer' }"
+
+Object subclass:#PPRule
+	instanceVariableNames:'owner search'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitAnalyzer-Core'
+!
+
+
+!PPRule class methodsFor:'instance creation'!
+
+new
+	^ self basicNew initialize
+!
+
+searchFor: aParser
+	^ self new setSearch: aParser
+! !
+
+!PPRule methodsFor:'initialization'!
+
+initialize
+!
+
+setOwner: aGrammarSearcher
+	owner := aGrammarSearcher
+!
+
+setSearch: aParser
+	search := aParser
+! !
+
+!PPRule methodsFor:'matching'!
+
+canMatch: aParser 
+	^ true
+!
+
+foundMatchFor: aParser 
+	self subclassResponsibility
+!
+
+performOn: aParser
+	(search match: aParser inContext: owner context)
+		ifFalse: [ ^ nil ].
+	(self canMatch: aParser)
+		ifFalse: [ ^ nil ].
+	^ self foundMatchFor: aParser
+! !
+
+!PPRule class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/goodies/petitparser/analyzer/PPRule.st,v 1.1 2014-03-04 15:42:06 cg Exp $'
+!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/goodies/petitparser/analyzer/PPRule.st,v 1.1 2014-03-04 15:42:06 cg Exp $'
+! !
+