Class TDigraphsList

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TDigraphsList = class(TObject)

Description

List of digraphs.

Note that you have to delete digraphs before their meaning changes (e.g. before Symbol's Next property changes, or before you free symbol etc.).

Note that it's allowed to have more than one digraph with the same value, i.e. where terminal's values or non-terminal's productions are equal. That's needed to handle triples, e.g. "aaa" — in such case you can think that you have two "aa" digraphs inside this list. IndexOfDigraph is smart and will actually not indicate equality between two "aa" digraphs that are linked like this.

Hierarchy

Overview

Methods

Public constructor Create;
Public destructor Destroy; override;
Public function IndexOfDigraph(const S1, S2: TSymbol): TSymbol;
Public procedure DeleteDigraph(S1: TSymbol);
Public procedure AddDigraph(S: TSymbol);

Description

Methods

Public constructor Create;
 
Public destructor Destroy; override;
 
Public function IndexOfDigraph(const S1, S2: TSymbol): TSymbol;

Searches for digraph S1, S2 by comparing Values of terminals and Productions of non-terminals (so it doesn't exactly compare S1 and S2 references).

Returns nil if not found, or TSymbol reference if found (to the first item of digraph — 2nd item is the Next one).

Note that this omits finding triples, by comparing TSymbol references: it never returns symbol that is = S2, or symbol that has Next equal to S1.

Public procedure DeleteDigraph(S1: TSymbol);

Find digraph starting with S1 (exactly S1, it compares references) and delete it.

If digraph doesn't exist, this is ignored (no error is raised etc.) This behavior is actually used by Substitute implementation of Sequitur, where border digraphs need not exist — see comments at the end of Substitute implementation, where we call CorrectDigraph).

Public procedure AddDigraph(S: TSymbol);
 

Generated by PasDoc 0.10.0 on 2006-07-12 06:44:38