On Tue, Jul 12, 2011 at 8:51 AM, Lukas Renggli <renggli(a)gmail.com> wrote:
I guess you are referring to the extension methods in
the package
'PetitAnalyzer'? The methods #matches:, #matchesIn:.
#matchingRangesIn:, ... are part of the core package 'PetitParser' and
are well commented (I think).
The methods in the package 'PetitAnalyzer' are called match*, because
this is not an equality operation. They do not only support the
comparison of two parsers, but can also compare patterns with parser
instances (essentially this is a little Prolog engine, very similar to
the refactoring engine). The matching and rewriting of parsers is
explained in my PhD (
http://scg.unibe.ch/archive/phd/renggli-phd.pdf)
in Section "6.2.5 Declarative Grammar Rewriting".
I will have a look, thank you
-
PPParser>>matchList* do never refer to self (but to call themselves
recursively).
This looks correct to me. This is to recurse into the graph of parsers.
Because these methods do not refer to self, they could be implemented
in a different class to avoid cluttering the already large PPParser. I
think Kent Beck is talking about that in the Best Practice Patterns
:-)
- Why is #def:
not defined in PPUnresolvedParser? You implemented it
in PPParser. It might be useful for other parsers, but do you have an
example?
PPParser is a superclass of PPUnresolvedParser, therefore you can send
#def: to any instance of PPUnresolvedParser.
Sure. But why did you put #def: in PPParser and not directly in
PPUnresolvedParser? For example, what is the meaning of
#digit asParser star def: #letter asParser
?
--
Damien Cassou
http://damiencassou.seasidehosting.st
"Lambdas are relegated to relative obscurity until Java makes them
popular by not having them." James Iry