From 315d5a30dc3e8916141e939210fde10672a351a0 Mon Sep 17 00:00:00 2001 From: Prudhvi Boyapalli Date: Tue, 22 Jun 2021 14:25:20 -0700 Subject: [PATCH] Initial implementation --- ftdetect/reflow.vim | 1 + syntax/reflow.vim | 60 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 ftdetect/reflow.vim create mode 100644 syntax/reflow.vim diff --git a/ftdetect/reflow.vim b/ftdetect/reflow.vim new file mode 100644 index 0000000..f0b8019 --- /dev/null +++ b/ftdetect/reflow.vim @@ -0,0 +1 @@ +au BufRead,BufNewFile *.rf set filetype=reflow diff --git a/syntax/reflow.vim b/syntax/reflow.vim new file mode 100644 index 0000000..74c4ea5 --- /dev/null +++ b/syntax/reflow.vim @@ -0,0 +1,60 @@ +" Vim syntax file +" Language: Reflow +" Maintainer: pboyapalli@grailbio.com +" Latest Revision: 24 July 2020 +" Reference: https://sg.eng.grail.com/grail/grail/-/blob/go/src/github.com/grailbio/reflow/LANGUAGE.md + + +" Language +syntax keyword reflowKeyword Main val image mem cpu param intern extern +syntax keyword reflowStatement exec func make reduce panic +syntax keyword reflowStructure switch case +syntax match reflowPreprocessor "@\w*" " matches the word after '@', like '@requires' +syntax match reflowPreprocessor "{{.*}}" " matches these things: '{{out}}' + +syntax match swiftOperator "\v\~\>" +syntax match reflowOperator "\v\s+!" +syntax match reflowOperator "\v\%" +syntax match reflowOperator "\v\&" +syntax match reflowOperator "\v\*" +syntax match reflowOperator "\v-" +syntax match reflowOperator "\v\+" +syntax match reflowOperator "\v\=" +syntax match reflowOperator "\v\|" +syntax match reflowOperator "\v\/" +syntax match reflowOperator "\v\<" +syntax match reflowOperator "\v\>" + +" Types +syntax region reflowString start=/"/ skip=/\\"/ end=/"/ oneline +syntax match reflowNumber "\v<\d+>" " matches whole numbers like 10 +syntax match reflowNumber "\v<\d+\.\d+>" " matches decimal numbers like 3.14 +syntax match reflowNumber "\v<\d*\.?\d+([Ee]-?)?\d+>" " matches notation like 3e10, 0.5E-8 +syntax keyword reflowBoolean true false +syntax keyword reflowConstant KiB MiB GiB TiB + +" Comments +syntax keyword reflowTodo contained TODO todo NOTE note +syntax match reflowComment "//.*$" contains=reflowTodo + + + +" Highlighting +highlight default link reflowKeyword Keyword +highlight default link reflowStatement Statement +highlight default link reflowStructure Structure +highlight default link reflowAttribute PreProc +highlight default link reflowOperator Operator +highlight default link reflowImport Include +highlight default link reflowType Type +highlight default link reflowPreprocessor PreProc + +highlight default link reflowString String +highlight default link reflowNumber Number +highlight default link reflowBoolean Boolean +highlight default link reflowConstant Constant + +highlight default link reflowTodo Todo +highlight default link reflowComment Comment + +