1
1
/*
2
- * Copyright (c) 2023, 2024 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2023, 2025 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* The Universal Permissive License (UPL), Version 1.0
@@ -690,13 +690,13 @@ private Object parseText(TruffleStringIterator iterator,
690
690
InlinedBranchProfile errorBranch ) {
691
691
var partialResult = Strings .builderCreate ();
692
692
while (iterator .hasNext ()) {
693
- int ch = iteratorNextNode .execute (iterator );
693
+ int ch = iteratorNextNode .execute (iterator , TruffleString . Encoding . UTF_16 );
694
694
if (ch == '\\' ) {
695
695
if (!iterator .hasNext ()) {
696
696
// Lone backslash at the end.
697
697
return Undefined .instance ;
698
698
}
699
- final int next = iteratorNextNode .execute (iterator );
699
+ final int next = iteratorNextNode .execute (iterator , TruffleString . Encoding . UTF_16 );
700
700
switch (next ) {
701
701
case '0' : {
702
702
// only `\0` by itself is allowed but not e.g. `\02`.
@@ -741,8 +741,8 @@ private Object parseText(TruffleStringIterator iterator,
741
741
appendCharNode .execute (partialResult , '\\' );
742
742
break ;
743
743
case '\r' : // CR | CRLF
744
- if (iteratorNextNode .execute (iterator ) != '\n' ) {
745
- iteratorPreviousNode .execute (iterator );
744
+ if (iteratorNextNode .execute (iterator , TruffleString . Encoding . UTF_16 ) != '\n' ) {
745
+ iteratorPreviousNode .execute (iterator , TruffleString . Encoding . UTF_16 );
746
746
}
747
747
break ;
748
748
case '\n' :
@@ -789,8 +789,8 @@ private Object parseText(TruffleStringIterator iterator,
789
789
}
790
790
791
791
private int peekNext (TruffleStringIterator iterator ) {
792
- int ch = iteratorNextNode .execute (iterator );
793
- iteratorPreviousNode .execute (iterator );
792
+ int ch = iteratorNextNode .execute (iterator , TruffleString . Encoding . UTF_16 );
793
+ iteratorPreviousNode .execute (iterator , TruffleString . Encoding . UTF_16 );
794
794
return ch ;
795
795
}
796
796
@@ -806,13 +806,13 @@ private int unicodeEscapeSequence(TruffleStringIterator iterator,
806
806
807
807
private int varlenHexSequence (TruffleStringIterator iterator ,
808
808
InlinedBranchProfile errorBranch ) {
809
- int ch = iteratorNextNode .execute (iterator );
809
+ int ch = iteratorNextNode .execute (iterator , TruffleString . Encoding . UTF_16 );
810
810
assert ch == '{' ;
811
811
812
812
int value = 0 ;
813
813
boolean firstIteration = true ;
814
814
while (iterator .hasNext ()) {
815
- ch = iteratorNextNode .execute (iterator );
815
+ ch = iteratorNextNode .execute (iterator , TruffleString . Encoding . UTF_16 );
816
816
if (ch == '}' ) {
817
817
if (!firstIteration ) {
818
818
break ;
@@ -846,7 +846,7 @@ private int hexSequence(TruffleStringIterator iterator, int length,
846
846
int value = 0 ;
847
847
int i ;
848
848
for (i = 0 ; i < length && iterator .hasNext (); i ++) {
849
- int ch = iteratorNextNode .execute (iterator );
849
+ int ch = iteratorNextNode .execute (iterator , TruffleString . Encoding . UTF_16 );
850
850
int digit = convertDigit (ch , 16 );
851
851
if (digit == -1 ) {
852
852
errorBranch .enter (this );
0 commit comments