Hi all
I'm working on a ParseKit parser for GEDCOM, but I'm having a weird issue.
My very simple preliminary grammar looks like this (similar to Backus-Naur):
@start = record+;
record = level ( tag value | xref tag ) crlf;
level = /^\d/;
tag = /[A-Z]{3,4}/;
value = Empty | /[^\r\n]*$/;
xref = /@[A-Z]\d+@/;
crlf = /[\r\n]+/;
My assembler class has the callbacks implemented for all productions,
right now they are just as follows:
- (void)didMatchRecord:(PKAssembly *)a //also didMatchLevel,
didMatchTag, didMatchValue, didMatchXref, didMatchCrlf
{
PKToken *tok = [a pop];
NSLog(@"didMatchRecord: %@", tok);
}
I'm testing it against this file:
0 HEAD
1 SOUR GEDitCOM
2 NAME GEDitCOM
2 VERS 3.71
1 GEDC
2 VERS 5.5
2 FORM LINEAGE_LINKED
1 LANG English
...etc
But for some reason, it seems to match the level of line 2 as the
value of line 1, even though it already matched the (null) as it
should?
2009-12-03 07:59:09.726 GCParseKitTest[13735:10b] didMatchLevel: 0
2009-12-03 07:59:09.756 GCParseKitTest[13735:10b] didMatchTag: HEAD
2009-12-03 07:59:09.785 GCParseKitTest[13735:10b] didMatchValue: (null)
2009-12-03 07:59:09.809 GCParseKitTest[13735:10b] didMatchValue: 1
It then never gets further, I assume because (level tag value value)
is not a valid record. Any insights?
Regards,
Mikkel
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]