Added the "negation" semantic token

This commit is contained in:
daladim 2025-10-23 16:35:49 +02:00
parent 50577871b1
commit 68cb0a9b3f
4 changed files with 7 additions and 2 deletions

View file

@ -137,7 +137,7 @@ fn punctuation(
}
(T![!], MACRO_RULES) => HlPunct::MacroBang.into(),
(T![!], NEVER_TYPE) => HlTag::BuiltinType.into(),
(T![!], PREFIX_EXPR) => HlOperator::Logical.into(),
(T![!], PREFIX_EXPR) => HlOperator::Negation.into(),
(T![*], PTR_TYPE) => HlTag::Keyword.into(),
(T![*], PREFIX_EXPR) => {
let h = HlTag::Operator(HlOperator::Other).into();

View file

@ -124,8 +124,10 @@ pub enum HlOperator {
Bitwise,
/// +, -, *, /, +=, -=, *=, /=
Arithmetic,
/// &&, ||, !
/// &&, ||
Logical,
/// !
Negation,
/// >, <, ==, >=, <=, !=
Comparison,
/// Other operators
@ -194,6 +196,7 @@ impl HlTag {
HlOperator::Arithmetic => "arithmetic",
HlOperator::Logical => "logical",
HlOperator::Comparison => "comparison",
HlOperator::Negation => "negation",
HlOperator::Other => "operator",
},
HlTag::StringLiteral => "string_literal",

View file

@ -91,6 +91,7 @@ define_semantic_token_types![
(LIFETIME, "lifetime"),
(LOGICAL, "logical") => OPERATOR,
(MACRO_BANG, "macroBang") => MACRO,
(NEGATION, "negation") => OPERATOR,
(PARENTHESIS, "parenthesis"),
(PROC_MACRO, "procMacro") => MACRO,
(PUNCTUATION, "punctuation"),

View file

@ -840,6 +840,7 @@ fn semantic_token_type_and_modifiers(
HlOperator::Bitwise => types::BITWISE,
HlOperator::Arithmetic => types::ARITHMETIC,
HlOperator::Logical => types::LOGICAL,
HlOperator::Negation => types::NEGATION,
HlOperator::Comparison => types::COMPARISON,
HlOperator::Other => types::OPERATOR,
},