From ed4c68db64dd977984fff2210e99e4a681433565 Mon Sep 17 00:00:00 2001 From: wangyusong Date: Sat, 6 May 2023 16:07:09 +0800 Subject: [PATCH] init the move.js --- .gitignore | 3 ++ move.js | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 .gitignore create mode 100644 move.js 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: '