Gedcom::Grammar(3) a module to manipulate Gedcom grammars

SYNOPSIS


use Gedcom::Grammar;
my $st = $grammar->structure("GEDCOM");
my @sgr = $grammar->item("DATE");
my @items = $grammar->valid_items;
my $min = $grammar->min;
my $max = $grammar->max;
my @items = $grammar->items;

DESCRIPTION

A selection of subroutines to handle the grammar of a gedcom file.

Derived from Gedcom::Item.

HASH MEMBERS

Some of the more important hash members are:

$grammar->{top}

The top of the grammar tree.

$grammar->{top}{structures}

A reference to a hash mapping the names of all structures to the grammar objects.

METHODS

structures

  my $st = $grammar->structure("GEDCOM");

Return the grammar item of the specified structure, if it exists, or undef.

item

  my @sgr = $grammar->item("DATE");

Return a list of the possible grammar items of the specified sub-item, if it exists.

min

  my $min = $grammar->min;

Return the minimum permissible number of $grammar items

max

  my $max = $grammar->max;

Return the maximum permissible number of $grammar items

items

  my @items = $grammar->items;

Return a list of tags of the grammar's sub-items

valid_items

  my @items = $grammar->valid_items;

Return a hash detailing all the valid sub-items of the grammar item. The key is the tag of the sub-item and the value is an array of hashes with three members:

  grammar => the sub-item grammar
  min     => the minimum permissible number of these sub-items
  max     => the maximum permissible number of these sub-items