Machine not running terminating actions

Matt Mower s... at mattmower.com
Wed Jan 3 01:16:32 UTC 2007


Hi again.

With your help I've been able to iron out many of the wrinkles in my
diff parser and have something approximating a good parse of arbitrary
svn diff output. One thing has me stumped though. The actions for the
last hunk of the last diff are not being fired.

Here is my machine:

### expressions

	lineChar = ( print | space ) - '\n';
	
	nbsp = space - '\n';
	
	line = ( ' ' | '-' | '+' ) @{ fhold; } lineChar* '\n'+ ;
	
	ignore_line = lineChar* '\n';

	ignoreCode = '\\' line;
	separator = '='+ '\n';
	hunkEndChar = print - ( space | '+' | '-' );
	
	oldFile = '---' ignore_line;
	newFile = '+++' ignore_line;
	
	hunkHeader = '@@' print+ '@@' '\n'+;
	
	hunkBody = ( line )+ ( ignoreCode | hunkEndChar @{ fhold; } );
	
	hunk = hunkHeader >enter_hunk hunkBody %exit_hunk;
	
	fileName = ( lineChar+ ) >mark %copy_to_filespec;
	
	fileSpec = "Index:" nbsp+ fileName '\n'+;
	
	diffHeader = ( fileSpec separator oldFile newFile );
	diffBody = hunk* %exit_diff;
	
	diff = diffHeader >enter_diff diffBody;
	
#	main := diff* $!error $~track;
#	main := diff* $!error;
	main := diff*;

It's the result of much tinkering to get the actions to fire in the
right sequence (I have a lot of problems with exit_diff actions firing
before corresponding exit_hunk's and so forth).

It correctly parses into each diff and each hunk within in. Where it
falls down, as I say, is that exit_hunk and exit_diff are not fired
for the last parsed hunk of the last diff.

I've attached a graph showing the diffBody machine as well as the full
.dot and the parser itself.

Any help would be much appreciated.

Thanks,

Matt

-- 
Matt Mower :: http://matt.blogs.it/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: machine_26863.png
Type: image/png
Size: 116343 bytes
Desc: not available
URL: <http://www.colm.net/pipermail/ragel/attachments/20070103/199b98d9/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DiffParser.m.dot
Type: application/octet-stream
Size: 2531 bytes
Desc: not available
URL: <http://www.colm.net/pipermail/ragel/attachments/20070103/199b98d9/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DiffParser.m.rl
Type: application/octet-stream
Size: 2884 bytes
Desc: not available
URL: <http://www.colm.net/pipermail/ragel/attachments/20070103/199b98d9/attachment-0001.obj>


More information about the ragel-users mailing list