UNPKG

1.44 kBTypeScriptView Raw
1/*!
2 * Copyright 2016 The ANTLR Project. All rights reserved.
3 * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
4 */
5/**
6 * Wrapper for `Uint8Array` / `Uint16Array` / `Int32Array`.
7 */
8export declare class CodePointBuffer {
9 private readonly buffer;
10 private _position;
11 private _size;
12 constructor(buffer: Uint8Array | Uint16Array | Int32Array, size: number);
13 static withArray(buffer: Uint8Array | Uint16Array | Int32Array): CodePointBuffer;
14 get position(): number;
15 set position(newPosition: number);
16 get remaining(): number;
17 get(offset: number): number;
18 array(): Uint8Array | Uint16Array | Int32Array;
19 static builder(initialBufferSize: number): CodePointBuffer.Builder;
20}
21export declare namespace CodePointBuffer {
22 class Builder {
23 private type;
24 private buffer;
25 private prevHighSurrogate;
26 private position;
27 constructor(initialBufferSize: number);
28 build(): CodePointBuffer;
29 private static roundUpToNextPowerOfTwo;
30 ensureRemaining(remainingNeeded: number): void;
31 append(utf16In: Uint16Array): void;
32 private appendArray;
33 private appendArrayByte;
34 private appendArrayChar;
35 private appendArrayInt;
36 private byteToCharBuffer;
37 private byteToIntBuffer;
38 private charToIntBuffer;
39 }
40}