typesxml
Version:
Open source XML library written in TypeScript
56 lines (55 loc) • 1.33 kB
TypeScript
/*******************************************************************************
* Copyright (c) 2023-2026 Maxprograms.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse License 1.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/org/documents/epl-v10.html
*
* Contributors:
* Maxprograms - initial API and implementation
*******************************************************************************/
export type JsonToken = {
type: 'braceOpen';
} | {
type: 'braceClose';
} | {
type: 'bracketOpen';
} | {
type: 'bracketClose';
} | {
type: 'colon';
} | {
type: 'comma';
} | {
type: 'string';
value: string;
} | {
type: 'number';
value: number;
} | {
type: 'boolean';
value: boolean;
} | {
type: 'null';
} | {
type: 'eof';
};
export declare class JsonTokenizer {
private buffer;
private offset;
private finished;
private lookahead;
enqueue(chunk: string): void;
markFinished(): void;
nextToken(): JsonToken;
peekToken(): JsonToken;
private readToken;
private makeStringToken;
private readUnicodeEscape;
private readNumber;
private readLiteral;
private skipWhitespace;
private isDigit;
private compactBuffer;
}