Package com.oracle.truffle.api.strings
Class TruffleString.CodePointAtIndexNode
java.lang.Object
com.oracle.truffle.api.nodes.Node
com.oracle.truffle.api.strings.TruffleString.CodePointAtIndexNode
- All Implemented Interfaces:
NodeInterface
,Cloneable
- Enclosing class:
TruffleString
Node to read a codepoint at a given codepoint index. See
execute(AbstractTruffleString, int, TruffleString.Encoding)
for details.- Since:
- 22.1
-
Nested Class Summary
Nested classes/interfaces inherited from class com.oracle.truffle.api.nodes.Node
Node.Child, Node.Children
-
Method Summary
Modifier and TypeMethodDescriptioncreate()
Create a newTruffleString.CodePointAtIndexNode
.final int
execute
(AbstractTruffleString a, int i, TruffleString.Encoding expectedEncoding) Decode and return the codepoint at codepoint indexi
, withbest-effort
error handling.abstract int
execute
(AbstractTruffleString a, int i, TruffleString.Encoding expectedEncoding, TruffleString.ErrorHandling errorHandling) Decode and return the codepoint at codepoint indexi
.Get the uncached version ofTruffleString.CodePointAtIndexNode
.Methods inherited from class com.oracle.truffle.api.nodes.Node
accept, adoptChildren, atomic, atomic, copy, deepCopy, getChildren, getCost, getDebugProperties, getDescription, getEncapsulatingSourceSection, getLock, getParent, getRootNode, getSourceSection, insert, insert, isAdoptable, isSafelyReplaceableBy, notifyInserted, onReplace, replace, replace, reportPolymorphicSpecialize, reportReplace, toString
-
Method Details
-
execute
Decode and return the codepoint at codepoint indexi
, withbest-effort
error handling.- Since:
- 22.1
-
execute
public abstract int execute(AbstractTruffleString a, int i, TruffleString.Encoding expectedEncoding, TruffleString.ErrorHandling errorHandling) Decode and return the codepoint at codepoint indexi
.- Parameters:
errorHandling
- if set toTruffleString.ErrorHandling.BEST_EFFORT
, the return value on invalid codepoints depends onexpectedEncoding
:TruffleString.Encoding.UTF_8
: Unicode Replacement character0xFFFD
TruffleString.Encoding.UTF_16
: the (16-bit)char
value read at indexi
TruffleString.Encoding.UTF_32
: the (32-bit)int
value read at indexi
TruffleString.Encoding.US_ASCII
,TruffleString.Encoding.ISO_8859_1
,TruffleString.Encoding.BYTES
: the (8-bit) unsignedbyte
value read at indexi
- All other Encodings: Unicode Replacement character
0xFFFD
TruffleString.ErrorHandling.RETURN_NEGATIVE
,-1
will be returned instead. This parameter is expected to bepartial evaluation constant
.- Since:
- 22.3
-
create
Create a newTruffleString.CodePointAtIndexNode
.- Since:
- 22.1
-
getUncached
Get the uncached version ofTruffleString.CodePointAtIndexNode
.- Since:
- 22.1
-