| 33 | { |
| 34 | |
| 35 | std::optional<SemanticTokenType> semanticTokenTypeForType(frontend::Type const* _type) |
| 36 | { |
| 37 | if (!_type) |
| 38 | return std::nullopt; |
| 39 | |
| 40 | switch (_type->category()) |
| 41 | { |
| 42 | case frontend::Type::Category::Address: return SemanticTokenType::Class; |
| 43 | case frontend::Type::Category::Bool: return SemanticTokenType::Number; |
| 44 | case frontend::Type::Category::Enum: return SemanticTokenType::Enum; |
| 45 | case frontend::Type::Category::Function: return SemanticTokenType::Function; |
| 46 | case frontend::Type::Category::Integer: return SemanticTokenType::Number; |
| 47 | case frontend::Type::Category::RationalNumber: return SemanticTokenType::Number; |
| 48 | case frontend::Type::Category::StringLiteral: return SemanticTokenType::String; |
| 49 | case frontend::Type::Category::Struct: return SemanticTokenType::Struct; |
| 50 | case frontend::Type::Category::Contract: return SemanticTokenType::Class; |
| 51 | default: |
| 52 | lspDebug(fmt::format("semanticTokenTypeForType: unknown category: {}", static_cast<unsigned>(_type->category()))); |
| 53 | return SemanticTokenType::Type; |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | SemanticTokenType semanticTokenTypeForExpression(frontend::Type const* _type) |
| 58 | { |