From 16215e79b02f768e022030333e8a9da38f84882d Mon Sep 17 00:00:00 2001 From: Vojtech Forejt Date: Thu, 20 Oct 2011 15:58:18 +0000 Subject: [PATCH] syntax highlighting for Vim git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@4095 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- prism/etc/syntax-highlighters/vim/README | 7 ++++ .../syntax-highlighters/vim/prismmodel.vim | 36 +++++++++++++++++ .../syntax-highlighters/vim/prismproperty.vim | 40 +++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 prism/etc/syntax-highlighters/vim/README create mode 100644 prism/etc/syntax-highlighters/vim/prismmodel.vim create mode 100644 prism/etc/syntax-highlighters/vim/prismproperty.vim diff --git a/prism/etc/syntax-highlighters/vim/README b/prism/etc/syntax-highlighters/vim/README new file mode 100644 index 00000000..01f61cb9 --- /dev/null +++ b/prism/etc/syntax-highlighters/vim/README @@ -0,0 +1,7 @@ +To install, copy the files prismmodel.vim and prismproperty.vim to a directory where syntax files reside, e.g. on Unix this can be the ~/.vim/syntax/ directory + +Then add the following 3 lines to your filetype.vim (on Unix, this can be in ~/.vim/filetype.vim): + +au BufRead,BufNewFile *.[pns]m setfiletype prismmodel +au BufRead,BufNewFile *.smg setfiletype prismmodel +au BufRead,BufNewFile *.pctl setfiletype prismproperty diff --git a/prism/etc/syntax-highlighters/vim/prismmodel.vim b/prism/etc/syntax-highlighters/vim/prismmodel.vim new file mode 100644 index 00000000..60831c9f --- /dev/null +++ b/prism/etc/syntax-highlighters/vim/prismmodel.vim @@ -0,0 +1,36 @@ +" Vim syntax file +" Language: PRISM model files +" Latest Revision: 20 October 2011 + +if exists("b:current_syntax") + finish +endif + +syn keyword prismStructureKeyword ctmc dtmc mdp smg module endmodule formula nondeterministic probabilistic pta stochastic invariant endinvariant rewards endrewards init endinit system endsystem player endplayer +syn keyword prismBool true false +syn keyword prismVariableType bool clock const double global int rate label filter func +syn keyword prismFunction max min + +syn region prismString start='"' end='"' + +syn match prismOp "[&|<>=!+\-*/:?]" +syn match prismNumber "[0-9][0-9]*" +syn match prismVariableName "[_a-zA-Z][_a-zA-Z0-9]*" +syn match prismComment "//.*$" +syn match prismArrow "->" +syn match prismActionEmpty "\[\]" +syn match prismAction "\[[a-zA-Z][a-zA-Z0-9]*\]" + +" A, , C E, F, G, I, X, Pmax, Pmin, P prob, Rmax, Rmin, R, S, U, W. + +hi def link prismStructureKeyword Keyword +hi def link prismVariableType Type +hi def link prismVariableName Identifier +hi def link prismNumber Number +hi def link prismBool Boolean +hi def link prismComment Comment +hi def link prismString String +hi def link prismArrow Operator +hi def link prismOp Operator +hi def link prismActionEmpty Special +hi def link prismAction Special diff --git a/prism/etc/syntax-highlighters/vim/prismproperty.vim b/prism/etc/syntax-highlighters/vim/prismproperty.vim new file mode 100644 index 00000000..1eec2ac2 --- /dev/null +++ b/prism/etc/syntax-highlighters/vim/prismproperty.vim @@ -0,0 +1,40 @@ +" Vim syntax file +" Language: PRISM property files +" Latest Revision: 20 October 2011 + +if exists("b:current_syntax") + finish +endif + +syn match prismOp "[&|=<>]" +syn keyword prismFilterParam min max count sum avg first range forall exists state argmin argmax print +syn keyword prismStructureKeyword filter +syn keyword prismBool true false +syn keyword prismVariableType bool double int const +syn match prismVariableName "[_a-zA-Z][_a-zA-Z0-9]*" +syn match prismNumber "[0-9][0-9]*" +syn match prismComment "//.*$" contains=prismResult +syn match prismResult "RESULT.*$" contained +syn match prismStatePROperator "[PRS]\({[^\}]*}\|\)\(min\|max\|\)[=<>?]*[0-9]*" contains=prismNumberInOperator,prismString +syn match prismTemporalOperator "[ACEFGIXUW][=<>?]*[0-9]*" contains=prismNumberInOperator +syn match prismCoalition "<<[^>]*>>" contains=prismNumberInOperator +syn match prismNumberInOperator "[0-9]*" contained +syn region prismString start='"' end='"' + + + +hi def link prismStructureKeyword Keyword +hi def link prismVariableType Type +hi def link prismVariableName Identifier +hi def link prismBool Boolean +hi def link prismNumberInOperator Number +hi def link prismNumber Number +hi def link prismComment Comment +hi def link prismString String +hi def link prismStatePROperator Operator +hi def link prismTemporalOperator Operator +hi def link prismTempOperator Operator +hi def link prismCoalition Operator +hi def link prismFilterParam Keyword +hi def link prismOp Operator +hi def link prismResult PreProc