Class CodePointCharStream
java.lang.Object
org.graalvm.shadowed.org.antlr.v4.runtime.CodePointCharStream
- All Implemented Interfaces:
CharStream,IntStream
Alternative to
ANTLRInputStream which treats the input
as a series of Unicode code points, instead of a series of UTF-16
code units.
Use this if you need to parse input which potentially contains
Unicode values > U+FFFF.-
Field Summary
FieldsFields inherited from interface org.graalvm.shadowed.org.antlr.v4.runtime.IntStream
EOF, UNKNOWN_SOURCE_NAME -
Method Summary
Modifier and TypeMethodDescriptionfinal voidconsume()Consumes the current symbol in the stream.static CodePointCharStreamfromBuffer(CodePointBuffer codePointBuffer) Constructs aCodePointCharStreamwhich provides access to the Unicode code points stored incodePointBuffer.static CodePointCharStreamfromBuffer(CodePointBuffer codePointBuffer, String name) Constructs a namedCodePointCharStreamwhich provides access to the Unicode code points stored incodePointBuffer.final StringGets the name of the underlying symbol source.final intindex()Return the index into the stream of the input symbol referred to byLA(1).final intmark()mark/release do nothing; we have entire bufferfinal voidrelease(int marker) This method releases a marked range created by a call tomark().final voidseek(int index) Set the input cursor to the position indicated byindex.final intsize()Returns the total number of symbols in the stream, including a single EOF symbol.final StringtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.graalvm.shadowed.org.antlr.v4.runtime.CharStream
getText
-
Field Details
-
size
protected final int size -
name
-
position
protected int position
-
-
Method Details
-
fromBuffer
Constructs aCodePointCharStreamwhich provides access to the Unicode code points stored incodePointBuffer. -
fromBuffer
Constructs a namedCodePointCharStreamwhich provides access to the Unicode code points stored incodePointBuffer. -
consume
public final void consume()Description copied from interface:IntStreamConsumes the current symbol in the stream. This method has the following effects:- Forward movement: The value of
index()before calling this method is less than the value ofindex()after calling this method. - Ordered lookahead: The value of
LA(1)before calling this method becomes the value ofLA(-1)after calling this method.
index()is incremented by exactly 1, as that would preclude the ability to implement filtering streams (e.g.CommonTokenStreamwhich distinguishes between "on-channel" and "off-channel" tokens). - Forward movement: The value of
-
index
public final int index()Description copied from interface:IntStreamReturn the index into the stream of the input symbol referred to byLA(1).The behavior of this method is unspecified if no call to an
initializing methodhas occurred after this stream was constructed. -
size
-
mark
-
release
public final void release(int marker) Description copied from interface:IntStreamThis method releases a marked range created by a call tomark(). Calls torelease()must appear in the reverse order of the corresponding calls tomark(). If a mark is released twice, or if marks are not released in reverse order of the corresponding calls tomark(), the behavior is unspecified.For more information and an example, see
IntStream.mark(). -
seek
public final void seek(int index) Description copied from interface:IntStreamSet the input cursor to the position indicated byindex. If the specified index lies past the end of the stream, the operation behaves as thoughindexwas the index of the EOF symbol. After this method returns without throwing an exception, then at least one of the following will be true.index()will return the index of the first symbol appearing at or after the specifiedindex. Specifically, implementations which filter their sources should automatically adjustindexforward the minimum amount required for the operation to target a non-ignored symbol.LA(1)returnsIntStream.EOF
indexlies within a marked region. For more information on marked regions, seeIntStream.mark(). The behavior of this method is unspecified if no call to aninitializing methodhas occurred after this stream was constructed. -
getSourceName
Description copied from interface:IntStreamGets the name of the underlying symbol source. This method returns a non-null, non-empty string. If such a name is not known, this method returnsIntStream.UNKNOWN_SOURCE_NAME.- Specified by:
getSourceNamein interfaceIntStream
-
toString
-