Monday, June 05, 2006

June 5th, 2006 -- Named Captures

Someone in another open source project I joined made some mistake and since the system is online, it corrupted many users config files which took me a lot of time help fixing it. (The error report is still growing..)

I added a rule to Pugs::Grammar::Rule so that it accepts more named capture syntax. It accepted only $<var> := (pattern). The parentheses was necessary. Now more general $<var> := [pattern] and $<var> := <subrule> are also valid.
Since when dealing with Perl 5 ratchet emitter, I've hacked the named capture emitting routine and made sure that it still work with the extended syntax. What made me surprised is, even the non-ratchet emitter works fine with the newly acceptable syntax. However, I'm still suspecting that the positional capture is not correctly generated. When $<var> := (pattern) is used, the (pattern) should NOT be listed in the positional captures.

Any way, the tests in ratchet shows that Pugs::Emitter::Rule::Perl5::Ratchet works correctly. And I'll add tests for the non-ratchet one if possible.

On the other hand, the Pugs::Emitter::Rule::Parsec plan has been in my brain for a while and there IS a Perl module for it now -- in my working copy and has a lot of functions with empty body. As soon as it has some basic construction, I will check it in and begin our Parser/*.hs replacement.

0 Comments:

Post a Comment

<< Home