UNPKG

1.23 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 { Interval } from "./misc/Interval";
6import { IntStream } from "./IntStream";
7/** A source of characters for an ANTLR lexer. */
8export interface CharStream extends IntStream {
9 /**
10 * This method returns the text for a range of characters within this input
11 * stream. This method is guaranteed to not throw an exception if the
12 * specified `interval` lies entirely within a marked range. For more
13 * information about marked ranges, see {@link IntStream#mark}.
14 *
15 * @param interval an interval within the stream
16 * @returns the text of the specified interval
17 *
18 * @throws NullPointerException if `interval` is `undefined`
19 * @throws IllegalArgumentException if `interval.a < 0`, or if
20 * `interval.b < interval.a - 1`, or if `interval.b` lies at or
21 * past the end of the stream
22 * @throws UnsupportedOperationException if the stream does not support
23 * getting the text of the specified interval
24 */
25 getText(/*@NotNull*/ interval: Interval): string;
26}