summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2025-09-28 00:16:56 -0400
committerpommicket <pommicket@gmail.com>2025-09-28 00:16:56 -0400
commit1241921c98705d60022150e0d58362f3bcf6342a (patch)
tree35021e16bd140813410abaa800131ab2174ab1ce
parent896ad5c758ed33905b79c98dc5759d0f5675eb37 (diff)
Add syntax highlighting for upcoming Python 3.14 t-strings
-rw-r--r--main.c1
-rw-r--r--syntax.c9
2 files changed, 5 insertions, 5 deletions
diff --git a/main.c b/main.c
index 3c2cd98..ca3aa69 100644
--- a/main.c
+++ b/main.c
@@ -1,6 +1,5 @@
/*
TODO:
-- syntax highlighting for Python t-strings
- don't autocomplete when tab is pressed if there is text selected
- highlight <https://example.org> correctly in Markdown
- highlight (https://example.org) correctly in Markdown (exactly which characters are allowed in links?)
diff --git a/syntax.c b/syntax.c
index 07e0dfb..f1cd885 100644
--- a/syntax.c
+++ b/syntax.c
@@ -775,9 +775,9 @@ static void syntax_highlight_python(SyntaxState *state, const char32_t *line, u3
i = line_len - 1;
}
break;
- // format/raw/byte/unicode string
- case 'f': case 'r': case 'b': case 'u':
- case 'F': case 'R': case 'B': case 'U':
+ // format/raw/byte/unicode/template string
+ case 'f': case 'r': case 'b': case 'u': case 't':
+ case 'F': case 'R': case 'B': case 'U': case 'T':
if (!in_string && !interpolating) {
bool is_string = true;
u32 j;
@@ -787,7 +787,8 @@ static void syntax_highlight_python(SyntaxState *state, const char32_t *line, u3
if (d == '\'' || d == '"')
break;
if (d == 'r' || d == 'f' || d == 'b' || d == 'u'
- || d == 'R' || d == 'F' || d == 'B' || d == 'U') {
+ || d == 'R' || d == 'F' || d == 'B' || d == 'U'
+ || d == 't' || d == 'T') {
fstring |= d == 'f' || d == 'F';
continue;
}