As far as I know PetitParser initializes each instance variable with a production method of the same name. What should one do, to add a custom instance variable and initialize it in the initialize
method for example?
Asked
Active
Viewed 95 times
3

Uko
- 13,134
- 6
- 58
- 106
-
that's only true for subclasses of PPCompositeParser – Damien Cassou Mar 22 '13 at 17:21
1 Answers
3
You can override the class-side method #ignoredNames
in subclasses to add your own instance-variables that PetitParser does not touch:
PPCompositeParser class>>#ignoredNames
"Answer a collection of instance-variables that should
not be automatically initialized with productions, but
that are used internal to the composite parser."
^ PPCompositeParser allInstVarNames

Lukas Renggli
- 8,754
- 23
- 46