" Vim syntax file
" Language: Vera
" Maintainer: Dave Eggum (opine at bluebottle dOt com)
" Last Change: 2005 Dec 19
" NOTE: extra white space at the end of the line will be highlighted if you
" add this line to your colorscheme:
" highlight SpaceError guibg=#204050
" (change the value for guibg to any color you like)
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
" A bunch of useful Vera keywords
syn keyword veraStatement break return continue fork join terminate
syn keyword veraStatement breakpoint proceed
syn keyword veraLabel bad_state bad_trans bind constraint coverage_group
syn keyword veraLabel class CLOCK default function interface m_bad_state
syn keyword veraLabel m_bad_trans m_state m_trans program randseq state
syn keyword veraLabel task trans
syn keyword veraConditional if else case casex casez randcase
syn keyword veraRepeat repeat while for do foreach
syn keyword veraModifier after all any around assoc_size async
syn keyword veraModifier before big_endian bit_normal bit_reverse export
syn keyword veraModifier extends extern little_endian local hdl_node hdl_task
syn keyword veraModifier negedge none packed protected posedge public rules
syn keyword veraModifier shadow soft static super this typedef unpacked var
syn keyword veraModifier vca virtual virtuals wildcard with
syn keyword veraType reg string enum event bit
syn keyword veraType rand randc integer port prod
syn keyword veraDeprecated call_func call_task close_conn get_bind get_bind_id
syn keyword veraDeprecated get_conn_err mailbox_receive mailbox_send make_client
syn keyword veraDeprecated make_server simwave_plot up_connections
" predefined tasks and functions
syn keyword veraTask alloc assoc_index cast_assign cm_coverage
syn keyword veraTask cm_get_coverage cm_get_limit delay error error_mode
syn keyword veraTask exit fclose feof ferror fflush flag fopen fprintf
syn keyword veraTask freadb freadh freadstr get_cycle get_env get_memsize
syn keyword veraTask get_plus_arg getstate get_systime get_time get_time_unit
syn keyword veraTask initstate lock_file mailbox_get mailbox_put os_command
syn keyword veraTask printf prodget prodset psprintf query query_str query_x
syn keyword veraTask rand48 random region_enter region_exit rewind
syn keyword veraTask semaphore_get semaphore_put setstate signal_connect
syn keyword veraTask sprintf srandom sscanf stop suspend_thread sync
syn keyword veraTask timeout trace trigger unit_delay unlock_file urand48
syn keyword veraTask urandom urandom_range vera_bit_reverse vera_crc
syn keyword veraTask vera_pack vera_pack_big_endian vera_plot
syn keyword veraTask vera_report_profile vera_unpack vera_unpack_big_endian
syn keyword veraTask vsv_call_func vsv_call_task vsv_get_conn_err
syn keyword veraTask vsv_make_client vsv_make_server vsv_up_connections
syn keyword veraTask vsv_wait_for_done vsv_wait_for_input wait_child wait_var
syn cluster veraOperGroup contains=veraOperator,veraOperParen,veraNumber,veraString,veraOperOk,veraType
" syn match veraOperator "++\|--\|&\|\~&\||\|\~|\|^\|\~^\|\~\|><"
" syn match veraOperator "*\|/\|%\|+\|-\|<<\|>>\|<\|<=\|>\|>=\|!in"
" syn match veraOperator "=?=\|!?=\|==\|!=\|===\|!==\|&\~\|^\~\||\~"
" syn match veraOperator "&&\|||\|=\|+=\|-=\|*=\|/=\|%=\|<<=\|>>=\|&="
" syn match veraOperator "|=\|^=\|\~&=\|\~|=\|\~^="
syn match veraOperator "[&|\~>"
" "hex number
" syn match veraNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
" syn match veraNumber "\(\<[0-9]\+\|\)'[bdoh][0-9a-fxzA-FXZ_]\+\>"
syn match veraNumber "\<\(\<[0-9]\+\)\?\('[bdoh]\)\?[0-9a-fxz_]\+\>"
" syn match veraNumber "\<[+-]\=[0-9]\+\>"
" Flag the first zero of an octal number as something special
syn match veraOctal display contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=veraOctalZero
syn match veraOctalZero display contained "\<0"
syn match veraFloat display contained "\d\+f"
"floating point number, with dot, optional exponent
syn match veraFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\="
"floating point number, starting with a dot, optional exponent
syn match veraFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
"floating point number, without dot, with exponent
syn match veraFloat display contained "\d\+e[-+]\=\d\+[fl]\=\>"
"hexadecimal floating point number, optional leading digits, with dot, with exponent
syn match veraFloat display contained "0x\x*\.\x\+p[-+]\=\d\+[fl]\=\>"
"hexadecimal floating point number, with leading digits, optional dot, with exponent
syn match veraFloat display contained "0x\x\+\.\=p[-+]\=\d\+[fl]\=\>"
" flag an octal number with wrong digits
syn match veraOctalError display contained "0\o*[89]\d*"
syn case match
let vera_comment_strings = 1
if exists("vera_comment_strings")
" A comment can contain veraString, veraCharacter and veraNumber.
" But a "*/" inside a veraString in a veraComment DOES end the comment! So we
" need to use a special type of veraString: veraCommentString, which also ends on
" "*/", and sees a "*" at the start of the line as comment again.
" Unfortunately this doesn't work very well for // type of comments :-(
syntax match veraCommentSkip contained "^\s*\*\($\|\s\+\)"
syntax region veraCommentString contained start=+L\=\\\@"
syn match veraClass "\zs\w\+\ze::"
syn match veraClass "\zs\w\+\ze\s\+\w\+\s*[=;,)\[]" contains=veraConstant,veraUserConstant
syn match veraClass "\zs\w\+\ze\s\+\w\+\s*$" contains=veraConstant,veraUserConstant
syn match veraUserMethod "\zs\w\+\ze\s*(" contains=veraConstant,veraUserConstant
syn match veraObject "\zs\w\+\ze\.\w"
syn match veraObject "\zs\w\+\ze\.\$\w"
" Accept ` for # (Verilog)
syn region veraPreCondit start="^\s*\(`\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 contains=veraComment,veraCppString,veraCharacter,veraCppParen,veraParenError,veraNumbers,veraCommentError,veraSpaceError
syn match veraPreCondit display "^\s*\(`\|#\)\s*\(else\|endif\)\>"
if !exists("vera_no_if0")
syn region veraCppOut start="^\s*\(`\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=veraCppOut2
syn region veraCppOut2 contained start="0" end="^\s*\(`\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=veraSpaceError,veraCppSkip
syn region veraCppSkip contained start="^\s*\(`\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(`\|#\)\s*endif\>" contains=veraSpaceError,veraCppSkip
endif
syn region veraIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
syn match veraIncluded display contained "<[^>]*>"
syn match veraInclude display "^\s*\(`\|#\)\s*include\>\s*["<]" contains=veraIncluded
"syn match veraLineSkip "\\$"
syn cluster veraPreProcGroup contains=veraPreCondit,veraIncluded,veraInclude,veraDefine,veraErrInParen,veraErrInBracket,veraUserLabel,veraSpecial,veraOctalZero,veraCppOut,veraCppOut2,veraCppSkip,veraFormat,veraNumber,veraFloat,veraOctal,veraOctalError,veraNumbersCom,veraString,veraCommentSkip,veraCommentString,veraComment2String,@veraCommentGroup,veraCommentStartError,veraParen,veraBracket,veraMulti
syn region veraDefine start="^\s*\(`\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" end="//"me=s-1 contains=ALLBUT,@veraPreProcGroup,@Spell
syn region veraPreProc start="^\s*\(`\|#\)\s*\(pragma\>\|line\>\|warning\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@veraPreProcGroup,@Spell
" Highlight User Labels
syn cluster veraMultiGroup contains=veraIncluded,veraSpecial,veraCommentSkip,veraCommentString,veraComment2String,@veraCommentGroup,veraCommentStartError,veraUserCont,veraUserLabel,veraBitField,veraOctalZero,veraCppOut,veraCppOut2,veraCppSkip,veraFormat,veraNumber,veraFloat,veraOctal,veraOctalError,veraNumbersCom,veraCppParen,veraCppBracket,veraCppString
syn region veraMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@veraMultiGroup,@Spell
" syn region veraMulti transparent start='?' skip='::' end=':' contains=ALL
" The above causes veraCppOut2 to catch on:
" i = (isTrue) ? 0 : 1;
" which ends up commenting the rest of the file
" Avoid matching foo::bar() by requiring that the next char is not ':'
syn cluster veraLabelGroup contains=veraUserLabel
syn match veraUserCont display "^\s*\I\i*\s*:$" contains=@veraLabelGroup
syn match veraUserCont display ";\s*\I\i*\s*:$" contains=@veraLabelGroup
syn match veraUserCont display "^\s*\I\i*\s*:[^:]"me=e-1 contains=@veraLabelGroup
syn match veraUserCont display ";\s*\I\i*\s*:[^:]"me=e-1 contains=@veraLabelGroup
syn match veraUserLabel display "\I\i*" contained
" Avoid recognizing most bitfields as labels
syn match veraBitField display "^\s*\I\i*\s*:\s*[1-9]"me=e-1
syn match veraBitField display ";\s*\I\i*\s*:\s*[1-9]"me=e-1
if exists("vera_minlines")
let b:vera_minlines = vera_minlines
else
if !exists("vera_no_if0")
let b:vera_minlines = 50 " #if 0 constructs can be long
else
let b:vera_minlines = 15 " mostly for () constructs
endif
endif
exec "syn sync ccomment veraComment minlines=" . b:vera_minlines
" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_vera_syn_inits")
if version < 508
let did_vera_syn_inits = 1
command -nargs=+ HiLink hi link