Package com.oracle.truffle.api.strings
Class TruffleString.ByteLengthOfCodePointNode
java.lang.Object
com.oracle.truffle.api.nodes.Node
com.oracle.truffle.api.strings.TruffleString.ByteLengthOfCodePointNode
- All Implemented Interfaces:
NodeInterface
,Cloneable
- Enclosing class:
TruffleString
Node to get the number of bytes occupied by the codepoint starting at a given byte 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.ByteLengthOfCodePointNode
.final int
execute
(AbstractTruffleString a, int byteIndex, TruffleString.Encoding expectedEncoding) Get the number of bytes occupied by the codepoint starting atbyteIndex
, withbest-effort
error handling.abstract int
execute
(AbstractTruffleString a, int byteIndex, TruffleString.Encoding expectedEncoding, TruffleString.ErrorHandling errorHandling) Get the number of bytes occupied by the codepoint starting atbyteIndex
.Get the uncached version ofTruffleString.ByteLengthOfCodePointNode
.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, toString
-
Method Details
-
execute
public final int execute(AbstractTruffleString a, int byteIndex, TruffleString.Encoding expectedEncoding) Get the number of bytes occupied by the codepoint starting atbyteIndex
, withbest-effort
error handling.- Since:
- 22.1
-
execute
public abstract int execute(AbstractTruffleString a, int byteIndex, TruffleString.Encoding expectedEncoding, TruffleString.ErrorHandling errorHandling) Get the number of bytes occupied by the codepoint starting atbyteIndex
.- Parameters:
errorHandling
- if set toTruffleString.ErrorHandling.BEST_EFFORT
, this node will return the encoding's minimum number of bytes per codepoint if an error occurs while reading the codepoint. If set toTruffleString.ErrorHandling.RETURN_NEGATIVE
, a negative value will be returned instead, where two error cases are distinguished: if the codepoint is invalid, the return value is -1. If the codepoint is an unfinished, possibly valid byte sequence at the end of the string, the return value is-1 - (number of missing bytes)
. This parameter is expected to bepartial evaluation constant
.- Since:
- 22.3
-
create
Create a newTruffleString.ByteLengthOfCodePointNode
.- Since:
- 22.1
-
getUncached
Get the uncached version ofTruffleString.ByteLengthOfCodePointNode
.- Since:
- 22.1
-