/* Language: Sway Author: Fuel Labs contact@fuel.sh Contributors: Fuel Labs , Website: https://fuel.sh Category: smart contracts, layer 2, blockchain, */ import * as regex from '../lib/regex.js'; /** @type LanguageFn */ export default function(hljs) { const FUNCTION_INVOKE = { className: "title.function.invoke", relevance: 0, begin: regex.concat( /\b/, /(?!let\b)/, hljs.IDENT_RE, regex.lookahead(/\s*\(/)) }; const NUMBER_SUFFIX = '([u](8|16|32|64))\?'; const KEYWORDS = [ "abi", "as", "asm", "break", "const", "continue", "contract", "deref", "else", "enum", "fn", "for", "if", "impl", "let", "library", "mod", "match", "mut", "predicate", "pub", "ref", "return", "script", "Self", "self", "storage", "str", "struct", "type", "trait", "use", "where", "while", ]; const LITERALS = [ "true", "false", "Some", "None", "Ok", "Err", ]; const BUILTINS = [ ]; const TYPES = [ "bool", "char", "u8", "u16", "u32", "u64", "b256", "str", "Self" ]; return { name: 'Sway', aliases: [ 'sw' ], keywords: { $pattern: hljs.IDENT_RE + '!?', keyword: KEYWORDS, literal: LITERALS, built_in: TYPES }, illegal: '' }, FUNCTION_INVOKE ] }; }