/** * @author Roman Vottner * @copyright 2020 Roman Vottner * @license Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ export type MessageType = { content: string | MessageType[]; mandatory: boolean; repetition: number; data?: string[]; name?: string; section?: string; }; /** * A utility class representing the current position in a segment group. */ export declare class Pointer { array: MessageType[]; position: number; count: number; constructor(array: MessageType[], position?: number); content(): string | MessageType[]; mandatory(): boolean; repetition(): number; name(): string | undefined; section(): string | undefined; } export declare class Tracker { stack: Pointer[]; /** * Construct a new tracker pointing to the first segment in the table. * * @constructs Tracker * @param table The segment table to track against. */ constructor(table: MessageType[]); /** * Reset the tracker to the initial position of the current segment table. */ reset(): void; /** * Match a segment to the message structure and update the current * position of the tracker. * * @param segment The segment name. * @throws {Error} Throws if a mandatory segment was omitted. * @throws {Error} Throws if unidentified segments are encountered. * @throws {Error} Throws if a segment is repeated too much. */ accept(segment: string | MessageType): void; } //# sourceMappingURL=tracker.d.ts.map