From c5d9a07e96346efa06926a1369f6041436b69f4d Mon Sep 17 00:00:00 2001 From: Natapat Samutpong Date: Thu, 24 Mar 2022 09:36:26 +0700 Subject: [PATCH] vim syntax file --- crates/hir/src/lib.rs | 8 ++++---- editor/hazure.vim | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 editor/hazure.vim diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index bbbd29b..4fb8814 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -448,9 +448,9 @@ fn gen_type_hint(type_hint: &str) -> String { "string" => "string".to_string(), "void" => "void".to_string(), // TODO: Un-hardcode types - "vec_int" => "number[]".to_string(), - "vec_bool" => "boolean[]".to_string(), - "vec_str" => "string[]".to_string(), + "vec_int" => "number[]".to_string(), + "vec_bool" => "boolean[]".to_string(), + "vec_string" => "string[]".to_string(), _ => { dbg!(type_hint); todo!() } } -} \ No newline at end of file +} diff --git a/editor/hazure.vim b/editor/hazure.vim new file mode 100644 index 0000000..a0b09d0 --- /dev/null +++ b/editor/hazure.vim @@ -0,0 +1,36 @@ +" Vim syntax file +" Language: Hazure + +if exists("b:current_syntax") + finish +endif + +set iskeyword=a-z,A-Z,_ + +" Todos +syn keyword hazureTodos TODO XXX FIXME NOTE + +" Language keywords +syn keyword hazureKeywords let mut fun do end if then else case of return pub +syn keyword hazureTypes int string bool void vec_int vec_string vec_bool + +" Comments +syn region hazureCommentLine start="--" end="$" contains=hazureTodos +syn region hazureCommentBlock start="-{" end="}-" contains=hazureTodos + +" Strings +syn region hazureString start=/\v"/ skip=/\v\\./ end=/\v"/ + +" Numbers +syn region hazureNumber start=/\s\d/ skip=/\d/ end=/\s/ + +" Set hilighting +hi def link hazureTodos Todo +hi def link hazureKeywords Keyword +hi def link hazureTypes Types +hi def link hazureCommentLine Comment +hi def link hazureCommentBlock Comment +hi def link hazureString String +hi def link hazureNumber Number + +let b:current_syntax="hazure"