I am working on a genealogy project and I am trying to read the GEDCOM (*.ged) file format.
Instead of using columns, they choose to use lines and on each line has a root node and following sub node with its affiliated values, and their associated (child) nodes. Very simple numbering system 0 (root) node and 1,2,3... another root node and so on.
The problem that I'm having is that I have placed variables as (check points) indicating what part/section the program would be in, head / submission / individual, in order to minimize just what part of the program it is in, at what point. But one of the child nodes (particularly DATE) is inside the indi-birt-date as well as indi-chan-date, and there for passes / fails to differentiate and parse the correct date in intended check point.
Unlike head and submission, there are multiple (indi)viduals. And there for its difficult to create the right code to match the scenario.
preg_match('/^\d.(DATE)\s(.*)/i', '2 DATE Jan 01 2022', $matches);
is the same condition for both instances. And therefor my birthdate is overridden with the final update (chan-date)
What I would like to know is how do I create a depth scenario, as a variable, and decide just what level I am in the program, and there for limit just what matches and executing code limits to the depth the program is at.
Update: I moved a couple of checkpoints inside so they could only be opened once per individual, and closed when they are not needed.