3

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?

Uko
  • 13,134
  • 6
  • 58
  • 106

1 Answers1

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