Added optional HL of language elements (ex vars) based on recommended naming convention.
This commit is contained in:
parent
5361ac5211
commit
d3071b81c3
4
README
4
README
|
@ -1,8 +1,12 @@
|
||||||
Based on:
|
Based on:
|
||||||
ttcn-syntax:
|
ttcn-syntax:
|
||||||
http://www.vim.org/scripts/script.php?script_id=753
|
http://www.vim.org/scripts/script.php?script_id=753
|
||||||
|
|
||||||
Folds: If the variable "g:ttcn_fold" is defined (e.g. by ":let g:ttcn_fold = 1" in your .vimrc file), folds will automatically be defined for each {...} block.
|
Folds: If the variable "g:ttcn_fold" is defined (e.g. by ":let g:ttcn_fold = 1" in your .vimrc file), folds will automatically be defined for each {...} block.
|
||||||
|
|
||||||
|
Highlight: If the variable "g:ttcn_hl_naming_convention" (e.g. by ":let g:ttcn_hl_naming_convention = 1" in your .vimrc file), Language elements following generic naming conventions will be highlighted.
|
||||||
|
This is not standardized but noted on http://www.ttcn-3.org/NamingConventions.htm.
|
||||||
|
|
||||||
ttcn-indent:
|
ttcn-indent:
|
||||||
http://www.vim.org/scripts/script.php?script_id=754
|
http://www.vim.org/scripts/script.php?script_id=754
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,6 @@ float
|
||||||
float2int
|
float2int
|
||||||
for
|
for
|
||||||
from
|
from
|
||||||
from
|
|
||||||
function
|
function
|
||||||
getcall
|
getcall
|
||||||
getreply
|
getreply
|
||||||
|
|
|
@ -1,20 +1,28 @@
|
||||||
" Vim filetype plugin file
|
" Vim filetype plugin file
|
||||||
" Language: TTCN-3
|
" Language: TTCN-3
|
||||||
" Maintainer: Stefan Karlsson <stefan.74@comhem.se>
|
" Maintainer: Stefan Karlsson <stefan.74@comhem.se>
|
||||||
" Last Change: 15 April 2004
|
" Maintainer: Gustaf Johansson <gustaf dot j at gmail dot com>
|
||||||
|
" Last Change: 15 September 2012
|
||||||
|
|
||||||
if exists("b:did_ftplugin")
|
if exists("b:did_ftplugin")
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let b:did_ftplugin = 1
|
let b:did_ftplugin = 1
|
||||||
|
|
||||||
|
if exists("b:undo_ftplugin")
|
||||||
|
let b:undo_ftplugin = b:undo_ftplugin . " | setlocal foldmethod< foldlevel< include< suffixesadd< formatoptions<"
|
||||||
|
else
|
||||||
|
let b:undo_ftplugin = "setlocal foldmethod< foldlevel< include< suffixesadd< formatoptions<"
|
||||||
|
endif
|
||||||
|
|
||||||
if exists("g:ttcn_fold")
|
if exists("g:ttcn_fold")
|
||||||
setlocal foldmethod=syntax
|
setlocal foldmethod=syntax
|
||||||
setlocal foldlevel=99
|
setlocal foldlevel=99
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Path to the dictionary (this path might need adjustment)
|
" Path to the dictionary (this path might need adjustment)
|
||||||
setlocal dict=~\vimfiles\dicts\ttcn.dict
|
" Set manually with: setlocal dict=~\path\to\ttcn.dict
|
||||||
|
let &dict=expand("<sfile>:p:h") . "\..\dicts\ttcn.dict"
|
||||||
|
|
||||||
" Enables gf, [I, [i, etc commands for ttcn files
|
" Enables gf, [I, [i, etc commands for ttcn files
|
||||||
setlocal include=^\\s*import\\s\\+from
|
setlocal include=^\\s*import\\s\\+from
|
||||||
|
@ -25,6 +33,5 @@ setlocal formatoptions-=t
|
||||||
|
|
||||||
" Enable auto breaking of comments and enable formatting of comments with
|
" Enable auto breaking of comments and enable formatting of comments with
|
||||||
" the gq command
|
" the gq command
|
||||||
setlocal formatoptions+=croq
|
setlocal formatoptions+=croq1n2
|
||||||
|
|
||||||
setlocal cinoptions=(1s
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ setlocal indentexpr=Get_ttcn_indent(v:lnum)
|
||||||
|
|
||||||
setlocal indentkeys=0{,0},0),!^F,o,O,e
|
setlocal indentkeys=0{,0},0),!^F,o,O,e
|
||||||
setlocal cinwords=
|
setlocal cinwords=
|
||||||
|
setlocal cinoptions=(1s
|
||||||
|
|
||||||
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
|
setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,29 @@ else
|
||||||
syn sync fromstart
|
syn sync fromstart
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Automatically define folds. You enable this feature with :let ttcn_fold=1.
|
" Automatically define folds. You enable this feature with :let g:ttcn_fold=1.
|
||||||
if exists("g:ttcn_fold") && g:ttcn_fold == 1
|
if exists("g:ttcn_fold") && g:ttcn_fold == 1
|
||||||
syn region ttcnFold start="{" end="}" transparent fold
|
syn region ttcnFold start="{" end="}" transparent fold
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Highlight declared language elements following generic naming conventions,
|
||||||
|
" not standardized but noted on http://www.ttcn-3.org/NamingConventions.htm.
|
||||||
|
" Enable this feature with :let g:ttcn_hl_naming_convention=1.
|
||||||
|
if exists("g:ttcn_hl_naming_convention") && g:ttcn_hl_naming_convention == 1
|
||||||
|
syn match ttcnAltStp "\<as\?_\w\+\>"
|
||||||
|
syn match ttcnConst "\<c\U\?_\w\+\>"
|
||||||
|
syn match ttcnEnum "\<e\U\?_\w\+\>"
|
||||||
|
syn match ttcnFunc "\<f\U\?_\w\+\>"
|
||||||
|
syn match ttcnParam "\<p\U\?_\w\+\>"
|
||||||
|
syn match ttcnTempl "\<m\U\?_\w\+\>"
|
||||||
|
syn match ttcnVar "\<v\U\?_\w\+\>"
|
||||||
|
syn match ttcnTimer "\<[tT]\U\?_\w\+\>"
|
||||||
|
endif
|
||||||
|
|
||||||
|
" ETSI ES 201 873-10 V3.4.1
|
||||||
|
" Part 10: TTCN-3 Documentation Comment Specification
|
||||||
|
syn match ttcnDocComment "@\<\(author\|config\|desc\|exception\|member\|param\|purpose\|remark\|return\|see\|since\|status\|url\|verdict\|version\)\>" contained
|
||||||
|
|
||||||
" Built-in types
|
" Built-in types
|
||||||
syn keyword ttcnType address anytype boolean char default float integer
|
syn keyword ttcnType address anytype boolean char default float integer
|
||||||
syn keyword ttcnType objid verdicttype timer set record union
|
syn keyword ttcnType objid verdicttype timer set record union
|
||||||
|
@ -38,7 +56,7 @@ syn match ttcnError "\<universal\>"
|
||||||
syn match ttcnType "\<universal\s\+charstring\>"
|
syn match ttcnType "\<universal\s\+charstring\>"
|
||||||
|
|
||||||
" Type definitions
|
" Type definitions
|
||||||
syn keyword ttcnTypDef type message procedure mixed
|
syn keyword ttcnTypDef type message procedure mixed
|
||||||
|
|
||||||
" Storage classes
|
" Storage classes
|
||||||
syn keyword ttcnStore var const external
|
syn keyword ttcnStore var const external
|
||||||
|
@ -130,7 +148,7 @@ syn keyword ttcnFunc oct2int oct2bit oct2hex oct2str oct2char
|
||||||
syn keyword ttcnFunc str2int str2oct str2float enum2int
|
syn keyword ttcnFunc str2int str2oct str2float enum2int
|
||||||
syn keyword ttcnFunc lengthof sizeof ispresent ischosen
|
syn keyword ttcnFunc lengthof sizeof ispresent ischosen
|
||||||
syn keyword ttcnFunc isvalue regexp substr replace encvalue
|
syn keyword ttcnFunc isvalue regexp substr replace encvalue
|
||||||
syn keyword ttcnFunc decvalue rnd
|
syn keyword ttcnFunc decvalue rnd isbound log2str
|
||||||
|
|
||||||
" Various keywords
|
" Various keywords
|
||||||
syn keyword ttcnKeyw in out inout any all sender to value modifies
|
syn keyword ttcnKeyw in out inout any all sender to value modifies
|
||||||
|
@ -150,19 +168,18 @@ syn match ttcnNumber "-infinity\>"
|
||||||
syn keyword ttcnBool true false
|
syn keyword ttcnBool true false
|
||||||
syn keyword ttcnConst omit null pass fail inconc none error
|
syn keyword ttcnConst omit null pass fail inconc none error
|
||||||
syn region ttcnString start=/"/ end=/"/ skip=/\\"/ oneline
|
syn region ttcnString start=/"/ end=/"/ skip=/\\"/ oneline
|
||||||
syn match ttcnString /'[01]\+'B/
|
syn match ttcnString /'[01]*'B/
|
||||||
syn match ttcnString /'\x\+'H/
|
syn match ttcnString /'\x*'H/
|
||||||
syn match ttcnString /'\(\x\x\)\+'O/
|
syn match ttcnString /'\(\x\x\)*'O/
|
||||||
syn match ttcnError /'\x\(\x\x\)\*'O/
|
syn match ttcnError /'\x\(\x\x\)*'O/
|
||||||
syn match ttcnError /''[BHO]/
|
|
||||||
|
|
||||||
" Comments
|
" Comments
|
||||||
if version < 700
|
if version < 700
|
||||||
syn match ttcnCmnt "//.*" contains=ttcnTodo
|
syn match ttcnCmnt "//.*" contains=ttcnTodo,ttcnDocComment
|
||||||
syn region ttcnCmnt start="/\*" end="\*/" contains=ttcnTodo
|
syn region ttcnCmnt start="/\*" end="\*/" contains=ttcnTodo,ttcnDocComment
|
||||||
else
|
else
|
||||||
syn match ttcnCmnt "//.*" contains=ttcnTodo,@Spell
|
syn match ttcnCmnt "//.*" contains=ttcnTodo,ttcnDocComment,@Spell
|
||||||
syn region ttcnCmnt start="/\*" end="\*/" contains=ttcnTodo,@Spell
|
syn region ttcnCmnt start="/\*" end="\*/" contains=ttcnTodo,ttcnDocComment,@Spell
|
||||||
endif
|
endif
|
||||||
|
|
||||||
syn case ignore
|
syn case ignore
|
||||||
|
@ -180,34 +197,47 @@ if version >= 508 || !exists("g:did_ttcn_syn_inits")
|
||||||
command -nargs=+ HiLink hi def link <args>
|
command -nargs=+ HiLink hi def link <args>
|
||||||
endif
|
endif
|
||||||
|
|
||||||
HiLink ttcnAttrib PreProc
|
HiLink ttcnAttrib PreProc
|
||||||
HiLink ttcnBool Boolean
|
HiLink ttcnBool Boolean
|
||||||
HiLink ttcnConst Constant
|
HiLink ttcnConst Constant
|
||||||
HiLink ttcnCmnt Comment
|
HiLink ttcnCmnt Comment
|
||||||
HiLink ttcnCond Conditional
|
HiLink ttcnCond Conditional
|
||||||
HiLink ttcnSpecial Special
|
HiLink ttcnSpecial Special
|
||||||
HiLink ttcnScope StorageClass
|
HiLink ttcnScope StorageClass
|
||||||
HiLink ttcnDecl Statement
|
HiLink ttcnDecl Statement
|
||||||
HiLink ttcnError Error
|
HiLink ttcnError Error
|
||||||
HiLink ttcnExcept Exception
|
HiLink ttcnExcept Exception
|
||||||
HiLink ttcnFunc Function
|
HiLink ttcnFunc Function
|
||||||
HiLink ttcnKeyw Keyword
|
HiLink ttcnKeyw Keyword
|
||||||
HiLink ttcnLabel Label
|
HiLink ttcnLabel Label
|
||||||
HiLink ttcnModule Include
|
HiLink ttcnModule Include
|
||||||
HiLink ttcnPreProc PreProc
|
HiLink ttcnPreProc PreProc
|
||||||
HiLink ttcnInclude Include
|
HiLink ttcnInclude Include
|
||||||
HiLink ttcnDefine Define
|
HiLink ttcnDefine Define
|
||||||
HiLink ttcnPreCond PreCondit
|
HiLink ttcnPreCond PreCondit
|
||||||
HiLink ttcnNumber Number
|
HiLink ttcnNumber Number
|
||||||
HiLink ttcnOper Operator
|
HiLink ttcnOper Operator
|
||||||
HiLink ttcnRepeat Repeat
|
HiLink ttcnRepeat Repeat
|
||||||
HiLink ttcnStat Statement
|
HiLink ttcnStat Statement
|
||||||
HiLink ttcnStore StorageClass
|
HiLink ttcnStore StorageClass
|
||||||
HiLink ttcnString String
|
HiLink ttcnString String
|
||||||
HiLink ttcnTodo Todo
|
HiLink ttcnTodo Todo
|
||||||
HiLink ttcnType Type
|
HiLink ttcnType Type
|
||||||
HiLink ttcnTypDef TypeDef
|
HiLink ttcnTypDef TypeDef
|
||||||
HiLink ttcnMacro Macro
|
HiLink ttcnMacro Macro
|
||||||
|
HiLink ttcnDocComment SpecialComment
|
||||||
|
|
||||||
|
if exists("g:ttcn_hl_naming_convention") && g:ttcn_hl_naming_convention == 1
|
||||||
|
HiLink ttcnAltStp Function
|
||||||
|
HiLink ttcnConst Constant
|
||||||
|
HiLink ttcnEnum Structure
|
||||||
|
HiLink ttcnFunc Function
|
||||||
|
HiLink ttcnParam Identifier
|
||||||
|
HiLink ttcnTempl Function
|
||||||
|
HiLink ttcnVar Identifier
|
||||||
|
HiLink ttcnTimer Special
|
||||||
|
endif
|
||||||
|
|
||||||
delcommand HiLink
|
delcommand HiLink
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in New Issue