Formatting question (Parser vs. Compiler)

Roel Wuyts wuyts at iam.unibe.ch
Tue Apr 24 10:37:33 UTC 2001


Hello,
On the class side there are two messages to control the parser and the
compiler used to display/compile methods (compilerclass and parserclass).
While refactoring pretty print code (yes, yes, so you will be able to select
the character you want to appear in assignments etc.), we stumbled upon the
following problem:
#format:in:notifying:decorated: is implemented on Compiler. However, this
method does two things (from the comment):

    "Compile a parse tree from the argument, textOrStream. Answer a string
    containing the original code, formatted nicely. If aBoolean is true,
    then decorate the resulting text with color and hypertext actions"

For me, this definetely sounds like functionality that should be implemented
in the Parser, and not in the compiler. Because of the current
implementation (on Compiler) this means that, in order to change a pretty
printer you have to set compilerClass (so that you can reimplement the
#format:in:notifying:decorated: method with another implementation).

Is this a legacy thing that we can refactor, or am I missing something ?





More information about the Squeak-dev mailing list