/* Language: Sway Author: Fuel devprogram@fuel.sh Contributors: Elvis Dedic , 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 = [ "as", "asm", "contract", "deref", "enum", "fn", "impl", "let", "library", "match", "mut", "predicate", "ref", "return", "script", "Self", "self", "str", "struct", "trait", "use", "where", "while", ]; const LITERALS = [ "true", "false", ]; const BUILTINS = [ ]; const TYPES = [ "u8", "u16", "u32", "u64", ]; return { name: 'Sway', aliases: [ 'sw' ], keywords: { $pattern: hljs.IDENT_RE + '!?', type: TYPES, keyword: KEYWORDS, literal: LITERALS, built_in: BUILTINS }, illegal: '' }, FUNCTION_INVOKE ] }; }