UNPKG

1.87 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 */
5import { CharStream } from "./CharStream";
6import { CodePointBuffer } from "./CodePointBuffer";
7import { Interval } from "./misc/Interval";
8/**
9 * Alternative to {@link ANTLRInputStream} which treats the input
10 * as a series of Unicode code points, instead of a series of UTF-16
11 * code units.
12 *
13 * Use this if you need to parse input which potentially contains
14 * Unicode values > U+FFFF.
15 */
16export declare class CodePointCharStream implements CharStream {
17 private readonly _array;
18 private readonly _size;
19 private readonly _name;
20 private _position;
21 protected constructor(array: Uint8Array | Uint16Array | Int32Array, position: number, remaining: number, name: string);
22 get internalStorage(): Uint8Array | Uint16Array | Int32Array;
23 /**
24 * Constructs a {@link CodePointCharStream} which provides access
25 * to the Unicode code points stored in {@code codePointBuffer}.
26 */
27 static fromBuffer(codePointBuffer: CodePointBuffer): CodePointCharStream;
28 /**
29 * Constructs a named {@link CodePointCharStream} which provides access
30 * to the Unicode code points stored in {@code codePointBuffer}.
31 */
32 static fromBuffer(codePointBuffer: CodePointBuffer, name: string): CodePointCharStream;
33 consume(): void;
34 get index(): number;
35 get size(): number;
36 /** mark/release do nothing; we have entire buffer */
37 mark(): number;
38 release(marker: number): void;
39 seek(index: number): void;
40 get sourceName(): string;
41 toString(): string;
42 LA(i: number): number;
43 /** Return the UTF-16 encoded string for the given interval */
44 getText(interval: Interval): string;
45}