Revision history for Gnaw 0.01 17 Oct 2008/11:15 pm First version, released on an unsuspecting world. Basic grammars can be created and executed. The "commit" function is busted, though, and large chunks of the module may need to be rewritten to fix it. All the other functions seem to be doing their job. Well, except for set_n, which is also broken, but fixing it probably won't require a massive module-wide rewrite. 0.02 17 Oct 2008 added a package declaration. 0.03 18 Oct 2008 Mainly fixed a lot of problems with POD. Documentation should be readable now using perldoc. Also, hacked a fix for set_n. It was hitting end of string, and end of string returns null string, so I added null string to the class of disallowed characters. Lastly, wrapped up the "current" and "restore" pointers into subroutine calls. I think the fix for "commit" problems is to keep track of everyone who points to the linked list of text or the call tree, and any time we delete text or call tree branches, we have to update anyone who is pointing to those locations. 0.04 18 Oct 2008 changed how grammar commands access the linked list of text. created a concept called a "marker" so that as we delete text in linked list we can update any commands that pointed to old text that is to be deleted. This should help the "commit" function, but the commit tests are still failing. 0.05 19 Oct 2008 Changed the code for handling get/restore of position within the call tree. Quantifiers were a serious jumble with this. added some debugging routines, cause this gets pretty nasty even with a simple grammar. See the GNAWMONITOR subroutine, now called amply throughout the module. last but not least, I added a new quantifier test (command_quantifier_multi). This test creates a grammar of series(greedy(lit('x'),'s'), greedy(lit('x'),'s')). The parser should be able to handle it, but doesn't. test fails. Probably another problem with the fricken markers. Actually, probably an issue with getting the call to greedy to remember the last number of times it tried, and try one less the second time around. need to debug the quantifier "try" and "success" numbers through the flow. Argh. oh, and put hardreturns into the readme. 0.07 22 Oct 2008 Oh my head. Massive rewrite. The calltree was conceptually totally wrong. Changed call tree from a tree to a stack. No longer keep different branches around. Multiple quantifiers now work together. The following grammar now works: $grammar = match( series( capture(greedy(lit('x'),'s'),$first_callback), capture(greedy(lit('x'),'s'),$second_callback) ) ); $grammar->('xxxxx') The first greedy will swallow the entire string, then release one character. This will allow second greedy to match on the last x, and the entire grammar passes. first capture eq 'xxxx'. second capture eq 'x' 0.09 23 Oct 2008 Got rid of the "commit" function. Replacing it with a function called "consumable". The "consumable" function is still in progress. Added a "thing" function which maps to a regular expression "dot" function, as in / blah . blah / Added some quantifier shortcuts for "some" and "any". These map to '+' and '*'. Added shortcuts for "something" and "anything". These map to '.+' and '.*' 0.10 23 October 2008 Added consumable function and got first draft of it to work with grammars not involving quantifiers. Grammars with quantifiers and consumables end up crashing. consumable will call any callbacks, delete the appropriate section of the call tree, and delete the consumable text. Added a subroutine that dumps what's left of the string. 0.11 24 October 2008 The "consumable" function had a bug. It was deleting entire call stack. That appears to be fixed now. 0.12 24 October 2008 Added some example tests to test (t/) directory. Currently some multi-level alternations and series. All pass. =====================================================================