ParseNode question

Les Tyrrell tyrrell at canis.uiuc.edu
Thu Feb 4 16:44:06 UTC 1999


> 
> Apropos Encoder:  how about notifying the Encoder with source ranges
> for every node? Currently it's only done for method nodes (for debugger
> highlighting). This would simplify source code coloring without pretty
> printing.
> 
> Bert
> 

I'll shoot from the hip on this one also- it appears that in the debugger,
the methods are parsed to obtain the parse tree prior to showing the method.
In fact, this is how it is able to show the highlights, because it then
has the parse tree available.

( So, for instance, putting halts in the parser code at various points can
become a bit of a problem... which is how I noticed this. )

So, if showing the method involved automatic use of a formatter then it would be
trivial to highlight without worrying about source ranges at all.

The source ranges appear to be an optimization to avoid duplicating the method's
text all over the parse tree.  However, I would not reccomend dropping the source ranges.
On a per-method basis, copying the source text throughout the tree is not bad.
But on a grander scale, where for instance one might use the parse trees to analyze
an entire image ( or several ) then it gets expensive.  For instance, building and
keeping the parse trees for every method in Squeak would appear to cost about 40 Megabytes.

les





More information about the Squeak-dev mailing list