1 /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2 * Use of this file is governed by the BSD 3-clause license that
3 * can be found in the LICENSE.txt file in the project root.
9 #include "misc/Interval.h"
13 /// A source of characters for an ANTLR lexer.
14 class ANTLR4CPP_PUBLIC CharStream : public IntStream {
16 virtual ~CharStream();
18 /// This method returns the text for a range of characters within this input
19 /// stream. This method is guaranteed to not throw an exception if the
20 /// specified interval lies entirely within a marked range. For more
21 /// information about marked ranges, see IntStream::mark.
23 /// <param name="interval"> an interval within the stream </param>
24 /// <returns> the text of the specified interval
26 /// <exception cref="NullPointerException"> if {@code interval} is {@code null} </exception>
27 /// <exception cref="IllegalArgumentException"> if {@code interval.a < 0}, or if
28 /// {@code interval.b < interval.a - 1}, or if {@code interval.b} lies at or
29 /// past the end of the stream </exception>
30 /// <exception cref="UnsupportedOperationException"> if the stream does not support
31 /// getting the text of the specified interval </exception>
32 virtual std::string getText(const misc::Interval &interval) = 0;
34 virtual std::string toString() const = 0;