diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7d35e27 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_module/ +.idea/ +old.js diff --git a/move.js b/move.js new file mode 100644 index 0000000..68a7f4a --- /dev/null +++ b/move.js @@ -0,0 +1,87 @@ +/* +Language: move +Author: Yusong Wang +Contributors: Yusong Wang +Website: +Category: common, system +*/ + +/** @type LanguageFn */ +export default function move(hljs) { + //const regex = hljs.regex; + + const KEYWORDS = [ + "abort", + "acquires", + "has", + "as", + "break", + "continue", + "copy", + "drop", + "key", + "mut", + "store", + "define", + "else", + "false", + "fun", + "if", + "invariant", + "let", + "loop", + "module", + "entry", + "move", + "native", + "public", + "const", + "return", + "spec", + "struct", + "true", + "use", + "while" + ]; + + const LITERALS = [ + "true", + "false" + ]; + + const BUILTINS = [ + "move_to_sender", + "borrow_global", + "emit_event", + "borrow_global_mut", + "has", + "move_from", + "exists", + ]; + + const TYPES = [ + "u8", + "u64", + "u128", + "u256", + "vector", + "address", + "bool" + ]; + + return { + name: 'move', + aliases: ['move'], + keywords: { + $pattern: hljs.IDENT_RE + '!?', + type: TYPES, + keyword: KEYWORDS, + literal: LITERALS, + built_in: BUILTINS + }, + illegal: '