PPCompositeParser.st
changeset 28 1194e560eda4
parent 4 90de244a7fa2
child 182 dad0accb9b2c
--- a/PPCompositeParser.st	Sat May 05 00:02:32 2012 +0200
+++ b/PPCompositeParser.st	Sat May 05 00:02:49 2012 +0200
@@ -7,11 +7,6 @@
 	category:'PetitParser-Tools'
 !
 
-PPCompositeParser comment:'A PPCompositeParser is composed parser built from various primitive parsers.
-Every production in the receiver is specified as a method that returns its parser. Note that every production requires an instance variable of the same name, otherwise the production is not cached and cannot be used in recursive grammars. Productions should refer to each other by reading the respective inst-var. Note: these inst-vars are typically not written, as the assignment happens in the initialize method using reflection.
-The start production is defined in the method start. It is aliased to the inst-var parser defined in the superclass of PPCompositeParser.'
-!
-
 
 !PPCompositeParser class methodsFor:'instance creation'!
 
@@ -63,7 +58,7 @@
 
 start
 	"Answer the production to start this parser with."
-
+	
 	self subclassResponsibility
 ! !
 
@@ -71,7 +66,7 @@
 
 initializeStartingAt: aSymbol
 	| allVariableNames ignoredVariableNames productionIndexesAndNames |
-	self initialize.
+	self initialize.	
 
 	"find all the productions that need to be initialized"
 	allVariableNames := self class allInstVarNames
@@ -81,13 +76,13 @@
 	productionIndexesAndNames := ((1 to: self class instSize)
 		collect: [ :index | index -> (allVariableNames at: index) ])
 		reject: [ :assoc | ignoredVariableNames includes: assoc value ].
-
+	
 	"initialize productions with an undefined parser to be replaced later"
 	parser := PPUnresolvedParser named: aSymbol.
 	productionIndexesAndNames do: [ :assoc |
 		self instVarAt: assoc key put: (PPUnresolvedParser named: assoc value) ].
 	parser def: (self perform: aSymbol).
-
+	
 	"resolve unresolved parsers with their actual implementation"
 	productionIndexesAndNames do: [ :assoc |
 		(self respondsTo: assoc value)
@@ -99,13 +94,13 @@
 
 productionAt: aSymbol
 	"Answer the production named aSymbol."
-
+	
 	^ self productionAt: aSymbol ifAbsent: [ nil ]
 !
 
 productionAt: aSymbol ifAbsent: aBlock
 	"Answer the production named aSymbol, if there is no such production answer the result of evaluating aBlock."
-
+	
 	(self class ignoredNames includes: aSymbol asString)
 		ifTrue: [ ^ aBlock value ].
 	(self class startSymbol = aSymbol)
@@ -117,6 +112,14 @@
 
 !PPCompositeParser class methodsFor:'documentation'!
 
+version
+    ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPCompositeParser.st,v 1.3 2012-05-04 22:02:49 vrany Exp $'
+!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/goodies/petitparser/PPCompositeParser.st,v 1.3 2012-05-04 22:02:49 vrany Exp $'
+!
+
 version_SVN
-    ^ '$Id: PPCompositeParser.st,v 1.2 2012-01-13 11:22:50 cg Exp $'
+    ^ '§Id: PPCompositeParser.st 2 2010-12-17 18:44:23Z vranyj1 §'
 ! !