On 08/14/2010 05:41 PM, Lukas Renggli wrote:
>
> Just send it to a mailing-list. Most discussion on PetitParser is
> going on in the moose-list, but here is fine too.
Hi again,
so I opted for a ChangeSet (never done that before), I have attached it to the
mail. Do you prefer any other way?
regards
holger
'From Pharo-1.0 of 19 October 2009 [Latest update: #10517] on 14 August 2010 at
6:04:51 pm'!
"Change Set: PetitParser-asSymbol
Date: 14 August 2010
Author: Holger Freyther
use asSymbol instead of asString to increase portability."!
!PPCompositeParser methodsFor: 'initialization' stamp: 'FirstnameLastname
8/14/2010 18:02'!
initializeStartingAt: aSymbol
| allVariableNames ignoredVariableNames productionIndexesAndNames |
self initialize. "find all the productions that need to be
initialized"
allVariableNames := self class allInstVarNames.
ignoredVariableNames := self class ignoredNames.
productionIndexesAndNames := ((1 to: self class instSize)
collect: [ :index | index -> (allVariableNames at: index)
asSymbol ])
reject: [ :assoc | ignoredVariableNames includes: assoc value
asSymbol ]. "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 := self perform: aSymbol. "resolve unresolved parsers
with their actual implementation"
productionIndexesAndNames
do: [ :assoc |
(self respondsTo: assoc value)
ifFalse: [ self error: 'Unable to initialize '
, assoc value printString ]
ifTrue: [ (self instVarAt: assoc key) def:
(self perform: assoc value) ] ]! !
_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk