summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-11-04 10:43:23 -0400
committerpommicket <pommicket@gmail.com>2022-11-04 10:43:23 -0400
commitdbd8b9c4408d31e624ec5be920610e4f3d47394d (patch)
treeadfa7a99fe0e79c718041a58058d153bb4d6af39
parent45a9d9bec845bc62fa24e8390bb55a33ea45f198 (diff)
fixed highlighting rust,python
-rw-r--r--syntax.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/syntax.c b/syntax.c
index 6912671..f84c6c9 100644
--- a/syntax.c
+++ b/syntax.c
@@ -380,7 +380,7 @@ static void syntax_highlight_rust(SyntaxState *state, char32_t const *line, u32
dealt_with = true;
}
}
- break;
+ goto keyword_check;
case 'b':
if (char_types && !comment_depth) {
if ((has_1_char && line[i+1] == '"')
@@ -395,7 +395,7 @@ static void syntax_highlight_rust(SyntaxState *state, char32_t const *line, u32
dealt_with = true;
}
}
- break;
+ goto keyword_check;
case '"':
if (!comment_depth) {
if (in_string) {
@@ -502,7 +502,8 @@ static void syntax_highlight_rust(SyntaxState *state, char32_t const *line, u32
}
}
break;
- default: {
+ default:
+ keyword_check: {
if ((i && is32_ident(line[i - 1])) || !is32_ident(c))
break; // can't be a keyword on its own.
if (i >= 2 && line[i-2] == 'r' && line[i-1] == '#') {
@@ -587,7 +588,7 @@ static void syntax_highlight_python(SyntaxState *state, char32_t const *line, u3
char_types[i] = SYNTAX_STRING;
dealt_with = true;
}
- break;
+ goto keyword_check;
case '\'':
case '"': {
bool dbl_quoted = c == '"';
@@ -634,6 +635,7 @@ static void syntax_highlight_python(SyntaxState *state, char32_t const *line, u3
++backslashes;
break;
default:
+ keyword_check:
if ((i && is32_ident(line[i - 1])) || !is32_ident(c))
break; // can't be a keyword on its own.