Extensions
in package
implements
NodeRule
An extension named after a structure of the target version, where the target has that structure and the source could not write it so, is that structure: it is how the conversion the other way writes it (7.0 → 5.5.1: _NO, _SDATE, _CREA, _CROP, _SCHMA under HEAD, _PHRASE under DATE, _FAMC @VOID@; 5.5.1 → 7.0 → 5.5.1: _NOTE and _SOUR under TRAN; 5.5.1 → 5.5: _EMAIL, _FONE, a second REPO of a source as _REPO, SEX U as _SEX U), and it gets its tag back. Its substructures are already in the target's form, unless a step before of the chain made it (Context::restored()). The source could not write it so when it has no such structure there, the value does not fit the source's (an enumeration value it does not list) but fits the target's, the source allows no more of them there, it is empty (5.5.5 and 7.0 have no empty structure), or (to 7.0) it points to @VOID@ or names its family so (_SLGC with FAMC @VOID@); and its value fits the target's (a 5.5 _SOUR with a text under NOTE stays: 7.0 NOTE.SOUR is a pointer). Any other extension (_DATE under BIRT) stays: a program wrote it so on purpose. The last rule of the walk but Structures: it sees the tags the other rules wrote.
Table of Contents
Interfaces
- NodeRule
- A rule for one structure at a time. Rules that look at every line of a record are grouped in {@see Rule\Nodes}, which walks each record once for all of them.
Methods
- __construct() : mixed
- needsPrepass() : bool
- Whether the rule needs Context::prepass(): facts about the whole input before the first record.
- node() : bool
- Converts one structure (a record or a substructure; never a CONC/CONT line) with one of the rule's tags, as the structure is tagged when the walk reaches it, in place. Its substructures are visited after it, as they are when this returns.
- tags() : array<int, string>|null
- "_" and the tag of each structure of the target: the walk gives no other structure to this rule.
Methods
__construct()
public
__construct(Version $from, Version $to[, bool $grammars = false ]) : mixed
Parameters
needsPrepass()
Whether the rule needs Context::prepass(): facts about the whole input before the first record.
public
needsPrepass() : bool
Return values
boolnode()
Converts one structure (a record or a substructure; never a CONC/CONT line) with one of the rule's tags, as the structure is tagged when the walk reaches it, in place. Its substructures are visited after it, as they are when this returns.
public
node(Document $document, int $id, Context $context) : bool
Parameters
Return values
bool —false when the rule removed the structure: the rules after it and its substructures are skipped
tags()
"_" and the tag of each structure of the target: the walk gives no other structure to this rule.
public
tags() : array<int, string>|null
Return values
array<int, string>|null —the tags of the structures the rule converts; null for every structure