initial checkin
authorClaus Gittinger <cg@exept.de>
Tue, 04 Mar 2014 16:41:40 +0100
changeset 200 4c2367c19e67
parent 199 7ee9dd62dcb2
child 201 29f7cfdac492
initial checkin
analyzer/PPProcessor.st
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/analyzer/PPProcessor.st	Tue Mar 04 16:41:40 2014 +0100
@@ -0,0 +1,59 @@
+"{ Package: 'stx:goodies/petitparser/analyzer' }"
+
+Object subclass:#PPProcessor
+	instanceVariableNames:'searches context'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'PetitAnalyzer-Core'
+!
+
+
+!PPProcessor class methodsFor:'instance creation'!
+
+new
+	^ self basicNew initialize
+! !
+
+!PPProcessor methodsFor:'initialization'!
+
+initialize
+	super initialize.
+	searches := OrderedCollection new.
+	context := Dictionary new
+! !
+
+!PPProcessor methodsFor:'private'!
+
+context
+	^ context
+!
+
+performRule: aRule on: aParser
+	context := Dictionary new.
+	^ aRule performOn: aParser
+!
+
+performRulesOn: aParser
+	| result |
+	searches do: [ :rule |
+		result := self performRule: rule on: aParser.
+		result notNil ifTrue: [ ^ result ] ].
+	^ nil
+! !
+
+!PPProcessor methodsFor:'rules'!
+
+addRule: aGrammarRule
+	searches add: (aGrammarRule setOwner: self)
+! !
+
+!PPProcessor class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/goodies/petitparser/analyzer/PPProcessor.st,v 1.1 2014-03-04 15:41:40 cg Exp $'
+!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/goodies/petitparser/analyzer/PPProcessor.st,v 1.1 2014-03-04 15:41:40 cg Exp $'
+! !
+