Skip to content

Commit 8b015a3

Browse files
committed
Fix: do not consume quote look-ahead in f-string.
1 parent cc53818 commit 8b015a3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/literal/FormatStringLiteralNode.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,12 @@ protected static int[][] createTokens(FormatStringLiteralNode node, StringPart[]
348348
boolean triple = false;
349349
boolean inString = true;
350350
index++;
351-
if (index < len && startq == text.charAt(index)) {
352-
index++;
353-
if (index < len && startq == text.charAt(index)) {
351+
if (index < len && startq == text.charAt(index )) {
352+
if (index + 1 < len && startq == text.charAt(index + 1)) {
354353
// we are in ''' or """ string
355354
triple = true;
355+
356+
// fully consume the quotes
356357
index++;
357358
} else {
358359
// we are in empty string "" or ''

0 commit comments

Comments
 (0)