A note re Set::FA::Element

Hi Folks

Mark Rogaski, the author of Set::FA has kindly given me co-maint, so I can make some changes.

This post really concerns Set::FA::Element, which is what I'm using for the unreleased Graph::Easy::Marpa::Lexer module. The latter module is working (at home) on simple graphs.

Firstly, I'd like to add a method to return what's captured. This simplest patch is to change line 102 from:

my $regex = qr{$rule}; # precompile regex

to:

my $regex = qr{($rule)}; # precompile regex

I.e. To add capturing parentheses, and a method called match() to return the value. Since match($string) sets what matched, you can even fool the DFA via this method...

Because there is not currently any such capability, I'd like to think this doesn't affect too many users, if anyone. But if this does concern you, please comment this post.

Also, I'd like to change the logging so a log option will report nothing but the state transitions. This will affect all logging, so if that worries you, please comment. I don't know if I'll keep Log::Agent.

I have also (in my copy) changed a few log msgs, to be clearer. For instance, state names are now single quoted for clarity. Also, the transition msg states explicitly what state is being left.

These changes are minor, and would be made consistently throughout the code before release.

Of course my intention is to preserve precisely the behaviour of the code (potentially apart from logging). Nevetheless, comment if appropriate.

Leave a comment

About Ron Savage

user-pic I try to write all code in Perl, but find I end up writing in bash, CSS, HTML, JS, and SQL, and doing database design, just to get anything done...