summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Richard <johnny@johnnyrichard.com>2024-08-12 23:30:54 +0200
committerJohnny Richard <johnny@johnnyrichard.com>2024-08-12 23:59:52 +0200
commitf1cce688ccd11b4cde93dab0d2e59242a0e574b3 (patch)
tree3cbf72160529295115fca27d9923a8b64e1dd7c1
parent6e693237f959170e5ed616027f216bf449804e09 (diff)
syntax: Add basic structure to syntax file
Signed-off-by: Johnny Richard <johnny@johnnyrichard.com>
-rw-r--r--ftdetect/olang.vim1
-rw-r--r--syntax/olang.vim35
2 files changed, 36 insertions, 0 deletions
diff --git a/ftdetect/olang.vim b/ftdetect/olang.vim
new file mode 100644
index 0000000..c450014
--- /dev/null
+++ b/ftdetect/olang.vim
@@ -0,0 +1 @@
+au BufRead,BufNewFile *.ol set filetype=olang
diff --git a/syntax/olang.vim b/syntax/olang.vim
new file mode 100644
index 0000000..cca62fc
--- /dev/null
+++ b/syntax/olang.vim
@@ -0,0 +1,35 @@
+" Vim syntax file
+" Language: O Language
+" Maintainer: Johnny Richard
+
+if exists("b:current_syntax")
+ finish
+endif
+
+hi link olangFuncName Function
+hi link olangFunction Function
+hi link olangKeyword Keyword
+hi link olangOperator Operator
+hi link olangString String
+hi link olangType Type
+
+hi link olangNumber Number
+hi link olangDecNumber olangNumber
+
+hi link olangCommentLine Comment
+
+syn keyword olangType u32
+syn keyword olangOperator * / + - << >> <= =< %
+syn keyword olangKeyword return var val let pub ns
+syn keyword olangKeyword fn nextgroup=olangFuncName skipwhite skipempty
+
+syn match olangDecNumber "\<[[:digit:]]*\>" display
+syn match olangFuncName "[[:alpha:]][[:alnum:]]*" display contained
+
+syn region olangString start=+"+ end=+"+
+syn region olangCommentLine start="#" end="$"
+
+syn sync minlines=200
+syn sync maxlines=500
+
+let b:current_syntax = "olang"