1c1e37901SBram Moolenaar" Vim syntax file 2c1e37901SBram Moolenaar" Language: Vera 3c1e37901SBram Moolenaar" Maintainer: Dave Eggum (opine at bluebottle dOt com) 4c1e37901SBram Moolenaar" Last Change: 2005 Dec 19 5c1e37901SBram Moolenaar 6c1e37901SBram Moolenaar" NOTE: extra white space at the end of the line will be highlighted if you 7c1e37901SBram Moolenaar" add this line to your colorscheme: 8c1e37901SBram Moolenaar 9c1e37901SBram Moolenaar" highlight SpaceError guibg=#204050 10c1e37901SBram Moolenaar 11c1e37901SBram Moolenaar" (change the value for guibg to any color you like) 12c1e37901SBram Moolenaar 1389bcfda6SBram Moolenaar" quit when a syntax file was already loaded 1489bcfda6SBram Moolenaarif exists("b:current_syntax") 15c1e37901SBram Moolenaar finish 16c1e37901SBram Moolenaarendif 17c1e37901SBram Moolenaar 18c1e37901SBram Moolenaar" A bunch of useful Vera keywords 19c1e37901SBram Moolenaarsyn keyword veraStatement break return continue fork join terminate 20c1e37901SBram Moolenaarsyn keyword veraStatement breakpoint proceed 21c1e37901SBram Moolenaar 22c1e37901SBram Moolenaarsyn keyword veraLabel bad_state bad_trans bind constraint coverage_group 23c1e37901SBram Moolenaarsyn keyword veraLabel class CLOCK default function interface m_bad_state 24c1e37901SBram Moolenaarsyn keyword veraLabel m_bad_trans m_state m_trans program randseq state 25c1e37901SBram Moolenaarsyn keyword veraLabel task trans 26c1e37901SBram Moolenaar 27c1e37901SBram Moolenaarsyn keyword veraConditional if else case casex casez randcase 28c1e37901SBram Moolenaarsyn keyword veraRepeat repeat while for do foreach 29c1e37901SBram Moolenaarsyn keyword veraModifier after all any around assoc_size async 30c1e37901SBram Moolenaarsyn keyword veraModifier before big_endian bit_normal bit_reverse export 31c1e37901SBram Moolenaarsyn keyword veraModifier extends extern little_endian local hdl_node hdl_task 32c1e37901SBram Moolenaarsyn keyword veraModifier negedge none packed protected posedge public rules 33c1e37901SBram Moolenaarsyn keyword veraModifier shadow soft static super this typedef unpacked var 34c1e37901SBram Moolenaarsyn keyword veraModifier vca virtual virtuals wildcard with 35c1e37901SBram Moolenaar 36c1e37901SBram Moolenaarsyn keyword veraType reg string enum event bit 37c1e37901SBram Moolenaarsyn keyword veraType rand randc integer port prod 38c1e37901SBram Moolenaar 39c1e37901SBram Moolenaarsyn keyword veraDeprecated call_func call_task close_conn get_bind get_bind_id 40c1e37901SBram Moolenaarsyn keyword veraDeprecated get_conn_err mailbox_receive mailbox_send make_client 41c1e37901SBram Moolenaarsyn keyword veraDeprecated make_server simwave_plot up_connections 42c1e37901SBram Moolenaar 43c1e37901SBram Moolenaar" predefined tasks and functions 44c1e37901SBram Moolenaarsyn keyword veraTask alloc assoc_index cast_assign cm_coverage 45c1e37901SBram Moolenaarsyn keyword veraTask cm_get_coverage cm_get_limit delay error error_mode 46c1e37901SBram Moolenaarsyn keyword veraTask exit fclose feof ferror fflush flag fopen fprintf 47c1e37901SBram Moolenaarsyn keyword veraTask freadb freadh freadstr get_cycle get_env get_memsize 48c1e37901SBram Moolenaarsyn keyword veraTask get_plus_arg getstate get_systime get_time get_time_unit 49c1e37901SBram Moolenaarsyn keyword veraTask initstate lock_file mailbox_get mailbox_put os_command 50c1e37901SBram Moolenaarsyn keyword veraTask printf prodget prodset psprintf query query_str query_x 51c1e37901SBram Moolenaarsyn keyword veraTask rand48 random region_enter region_exit rewind 52c1e37901SBram Moolenaarsyn keyword veraTask semaphore_get semaphore_put setstate signal_connect 53c1e37901SBram Moolenaarsyn keyword veraTask sprintf srandom sscanf stop suspend_thread sync 54c1e37901SBram Moolenaarsyn keyword veraTask timeout trace trigger unit_delay unlock_file urand48 55c1e37901SBram Moolenaarsyn keyword veraTask urandom urandom_range vera_bit_reverse vera_crc 56c1e37901SBram Moolenaarsyn keyword veraTask vera_pack vera_pack_big_endian vera_plot 57c1e37901SBram Moolenaarsyn keyword veraTask vera_report_profile vera_unpack vera_unpack_big_endian 58c1e37901SBram Moolenaarsyn keyword veraTask vsv_call_func vsv_call_task vsv_get_conn_err 59c1e37901SBram Moolenaarsyn keyword veraTask vsv_make_client vsv_make_server vsv_up_connections 60c1e37901SBram Moolenaarsyn keyword veraTask vsv_wait_for_done vsv_wait_for_input wait_child wait_var 61c1e37901SBram Moolenaar 62c1e37901SBram Moolenaarsyn cluster veraOperGroup contains=veraOperator,veraOperParen,veraNumber,veraString,veraOperOk,veraType 63c1e37901SBram Moolenaar" syn match veraOperator "++\|--\|&\|\~&\||\|\~|\|^\|\~^\|\~\|><" 64c1e37901SBram Moolenaar" syn match veraOperator "*\|/\|%\|+\|-\|<<\|>>\|<\|<=\|>\|>=\|!in" 65c1e37901SBram Moolenaar" syn match veraOperator "=?=\|!?=\|==\|!=\|===\|!==\|&\~\|^\~\||\~" 66c1e37901SBram Moolenaar" syn match veraOperator "&&\|||\|=\|+=\|-=\|*=\|/=\|%=\|<<=\|>>=\|&=" 67c1e37901SBram Moolenaar" syn match veraOperator "|=\|^=\|\~&=\|\~|=\|\~^=" 68c1e37901SBram Moolenaar 69c1e37901SBram Moolenaarsyn match veraOperator "[&|\~><!*@+/=,.\^\-]" 70c1e37901SBram Moolenaarsyn keyword veraOperator or in dist not 71c1e37901SBram Moolenaar 72c1e37901SBram Moolenaar" open vera class methods 73c1e37901SBram Moolenaarsyn keyword veraMethods atobin atohex atoi atooct backref bittostr capacity 74c1e37901SBram Moolenaarsyn keyword veraMethods compare Configure constraint_mode delete DisableTrigger 75c1e37901SBram Moolenaarsyn keyword veraMethods DoAction empty EnableCount EnableTrigger Event find 76c1e37901SBram Moolenaarsyn keyword veraMethods find_index first first_index GetAssert get_at_least 77c1e37901SBram Moolenaarsyn keyword veraMethods get_auto_bin getc GetCount get_coverage_goal get_cov_weight 78c1e37901SBram Moolenaarsyn keyword veraMethods get_cross_bin_max GetFirstAssert GetName GetNextAssert 79c1e37901SBram Moolenaarsyn keyword veraMethods get_status get_status_msg hide hash icompare insert 80c1e37901SBram Moolenaarsyn keyword veraMethods inst_get_at_least inst_get_auto_bin_max inst_get_collect 81c1e37901SBram Moolenaarsyn keyword veraMethods inst_get_coverage_goal inst_get_cov_weight inst_getcross_bin_max 82c1e37901SBram Moolenaarsyn keyword veraMethods inst_query inst_set_at_least inst_set_auto_bin_max 83c1e37901SBram Moolenaarsyn keyword veraMethods inst_set_bin_activiation inst_set_collect inst_set_coverage_goal 84c1e37901SBram Moolenaarsyn keyword veraMethods inst_set_cov_weight inst_set_cross_bin_max itoa last last_index 85c1e37901SBram Moolenaarsyn keyword veraMethods len load match max max_index min min_index new object_compare 86c1e37901SBram Moolenaarsyn keyword veraMethods object_compare object_copy object_print pack pick_index 87c1e37901SBram Moolenaarsyn keyword veraMethods pop_back pop_front post_boundary postmatch post_pack post_pack 88c1e37901SBram Moolenaarsyn keyword veraMethods post_randomize post_randomize post_unpack post_unpack 89c1e37901SBram Moolenaarsyn keyword veraMethods pre_boundary prematch pre_pack pre_pack pre_randomize 90c1e37901SBram Moolenaarsyn keyword veraMethods pre-randomize pre_unpack push_back push_front putc query 91c1e37901SBram Moolenaarsyn keyword veraMethods query_str rand_mode randomize reserve reverse rsort search 92c1e37901SBram Moolenaarsyn keyword veraMethods set_at_least set_auto_bin_max set_bin_activiation 93c1e37901SBram Moolenaarsyn keyword veraMethods set_coverage_goal set_cov_weight set_cross_bin_max set_name 94c1e37901SBram Moolenaarsyn keyword veraMethods size sort substr sum thismatch tolower toupper unique_index 95c1e37901SBram Moolenaarsyn keyword veraMethods unpack Wait 96c1e37901SBram Moolenaar 97c1e37901SBram Moolenaar" interface keywords 98c1e37901SBram Moolenaarsyn keyword veraInterface ASYNC CLOCK gnr gr0 gr1 grx grz NHOLD nr NR0 NR1 99c1e37901SBram Moolenaarsyn keyword veraInterface NRZ NRZ NSAMPLE PHOLD PR0 PR1 PRX PRZ r0 r1 rx snr 100c1e37901SBram Moolenaarsyn keyword veraInterface sr0 sr1 srx srz depth inout input output 101c1e37901SBram Moolenaarsyn match veraInterface "\$\w\+" 102c1e37901SBram Moolenaar 103c1e37901SBram Moolenaar 104c1e37901SBram Moolenaarsyn keyword veraTodo contained TODO FIXME XXX FINISH 105c1e37901SBram Moolenaar 106c1e37901SBram Moolenaar" veraCommentGroup allows adding matches for special things in comments 107c1e37901SBram Moolenaarsyn cluster veraCommentGroup contains=veraTodo 108c1e37901SBram Moolenaar 109c1e37901SBram Moolenaar" String and Character constants 110c1e37901SBram Moolenaar" Highlight special characters (those which have a backslash) differently 111c1e37901SBram Moolenaarsyn match veraSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)" 112c1e37901SBram Moolenaarsyn match veraFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpnm]\|\[\^\=.[^]]*\]\)" contained 113c1e37901SBram Moolenaarsyn match veraFormat display "%%" contained 114c1e37901SBram Moolenaarsyn region veraString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=veraSpecial,veraFormat,@Spell 115c1e37901SBram Moolenaarsyn region veraConcat contained transparent oneline start='{' end='}' 116c1e37901SBram Moolenaar 117c1e37901SBram Moolenaar" veraCppString: same as veraString, but ends at end of line 118c1e37901SBram Moolenaarsyn region veraCppString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=veraSpecial,veraFormat,@Spell 119c1e37901SBram Moolenaar 120c1e37901SBram Moolenaarsyn match veraCharacter "'[^\\]'" 121c1e37901SBram Moolenaarsyn match veraCharacter "L'[^']*'" contains=veraSpecial 122c1e37901SBram Moolenaarsyn match veraSpecialError "'\\[^'\"?\\abefnrtv]'" 123c1e37901SBram Moolenaarsyn match veraSpecialCharacter "'\\['\"?\\abefnrtv]'" 124c1e37901SBram Moolenaarsyn match veraSpecialCharacter display "'\\\o\{1,3}'" 125c1e37901SBram Moolenaarsyn match veraSpecialCharacter display "'\\x\x\{1,2}'" 126c1e37901SBram Moolenaarsyn match veraSpecialCharacter display "L'\\x\x\+'" 127c1e37901SBram Moolenaar 128c1e37901SBram Moolenaar" highlight trailing white space 129c1e37901SBram Moolenaarsyn match veraSpaceError display excludenl "\s\+$" 130c1e37901SBram Moolenaarsyn match veraSpaceError display " \+\t"me=e-1 131c1e37901SBram Moolenaar 132c1e37901SBram Moolenaar"catch errors caused by wrong parenthesis and brackets 133c1e37901SBram Moolenaarsyn cluster veraParenGroup contains=veraParenError,veraIncluded,veraSpecial,veraCommentSkip,veraCommentString,veraComment2String,@veraCommentGroup,veraCommentStartError,veraUserCont,veraUserLabel,veraBitField,veraCommentSkip,veraOctalZero,veraCppOut,veraCppOut2,veraCppSkip,veraFormat,veraNumber,veraFloat,veraOctal,veraOctalError,veraNumbersCom 134c1e37901SBram Moolenaar 135c1e37901SBram Moolenaarsyn region veraParen transparent start='(' end=')' contains=ALLBUT,@veraParenGroup,veraCppParen,veraErrInBracket,veraCppBracket,veraCppString,@Spell 136c1e37901SBram Moolenaar" veraCppParen: same as veraParen but ends at end-of-line; used in veraDefine 137c1e37901SBram Moolenaarsyn region veraCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@veraParenGroup,veraErrInBracket,veraParen,veraBracket,veraString,@Spell 138c1e37901SBram Moolenaarsyn match veraParenError display "[\])]" 139c1e37901SBram Moolenaar" syn match veraErrInParen display contained "[\]{}]" 140c1e37901SBram Moolenaarsyn match veraErrInParen display contained "[\]]" 141c1e37901SBram Moolenaarsyn region veraBracket transparent start='\[' end=']' contains=ALLBUT,@veraParenGroup,veraErrInParen,veraCppParen,veraCppBracket,veraCppString,@Spell 142c1e37901SBram Moolenaar 143c1e37901SBram Moolenaar" veraCppBracket: same as veraParen but ends at end-of-line; used in veraDefine 144c1e37901SBram Moolenaarsyn region veraCppBracket transparent start='\[' skip='\\$' excludenl end=']' end='$' contained contains=ALLBUT,@veraParenGroup,veraErrInParen,veraParen,veraBracket,veraString,@Spell 145c1e37901SBram Moolenaarsyn match veraErrInBracket display contained "[);{}]" 146c1e37901SBram Moolenaar 147c1e37901SBram Moolenaar"integer number, or floating point number without a dot and with "f". 148c1e37901SBram Moolenaarsyn case ignore 149c1e37901SBram Moolenaarsyn match veraNumbers display transparent "\<\d\|\.\d" contains=veraNumber,veraFloat,veraOctalError,veraOctal 150c1e37901SBram Moolenaar" Same, but without octal error (for comments) 151c1e37901SBram Moolenaarsyn match veraNumbersCom display contained transparent "\<\d\|\.\d" contains=veraNumber,veraFloat,veraOctal 152c1e37901SBram Moolenaar" syn match veraNumber display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>" 153c1e37901SBram Moolenaar" "hex number 154c1e37901SBram Moolenaar" syn match veraNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>" 155c1e37901SBram Moolenaar" syn match veraNumber "\(\<[0-9]\+\|\)'[bdoh][0-9a-fxzA-FXZ_]\+\>" 156c1e37901SBram Moolenaarsyn match veraNumber "\<\(\<[0-9]\+\)\?\('[bdoh]\)\?[0-9a-fxz_]\+\>" 157c1e37901SBram Moolenaar" syn match veraNumber "\<[+-]\=[0-9]\+\>" 158c1e37901SBram Moolenaar" Flag the first zero of an octal number as something special 159c1e37901SBram Moolenaarsyn match veraOctal display contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=veraOctalZero 160c1e37901SBram Moolenaarsyn match veraOctalZero display contained "\<0" 161c1e37901SBram Moolenaarsyn match veraFloat display contained "\d\+f" 162c1e37901SBram Moolenaar"floating point number, with dot, optional exponent 163c1e37901SBram Moolenaarsyn match veraFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=" 164c1e37901SBram Moolenaar"floating point number, starting with a dot, optional exponent 165c1e37901SBram Moolenaarsyn match veraFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>" 166c1e37901SBram Moolenaar"floating point number, without dot, with exponent 167c1e37901SBram Moolenaarsyn match veraFloat display contained "\d\+e[-+]\=\d\+[fl]\=\>" 168c1e37901SBram Moolenaar"hexadecimal floating point number, optional leading digits, with dot, with exponent 169c1e37901SBram Moolenaarsyn match veraFloat display contained "0x\x*\.\x\+p[-+]\=\d\+[fl]\=\>" 170c1e37901SBram Moolenaar"hexadecimal floating point number, with leading digits, optional dot, with exponent 171c1e37901SBram Moolenaarsyn match veraFloat display contained "0x\x\+\.\=p[-+]\=\d\+[fl]\=\>" 172c1e37901SBram Moolenaar 173c1e37901SBram Moolenaar" flag an octal number with wrong digits 174c1e37901SBram Moolenaarsyn match veraOctalError display contained "0\o*[89]\d*" 175c1e37901SBram Moolenaarsyn case match 176c1e37901SBram Moolenaar 177c1e37901SBram Moolenaarlet vera_comment_strings = 1 178c1e37901SBram Moolenaar 179c1e37901SBram Moolenaarif exists("vera_comment_strings") 180c1e37901SBram Moolenaar " A comment can contain veraString, veraCharacter and veraNumber. 181c1e37901SBram Moolenaar " But a "*/" inside a veraString in a veraComment DOES end the comment! So we 182c1e37901SBram Moolenaar " need to use a special type of veraString: veraCommentString, which also ends on 183c1e37901SBram Moolenaar " "*/", and sees a "*" at the start of the line as comment again. 184c1e37901SBram Moolenaar " Unfortunately this doesn't work very well for // type of comments :-( 185c1e37901SBram Moolenaar syntax match veraCommentSkip contained "^\s*\*\($\|\s\+\)" 186c1e37901SBram Moolenaar syntax region veraCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=veraSpecial,veraCommentSkip 187c1e37901SBram Moolenaar syntax region veraComment2String contained start=+\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=veraSpecial 188c1e37901SBram Moolenaar syntax region veraCommentL start="//" skip="\\$" end="$" keepend contains=@veraCommentGroup,veraComment2String,veraCharacter,veraNumbersCom,veraSpaceError,@Spell 189c1e37901SBram Moolenaar if exists("vera_no_comment_fold") 190c1e37901SBram Moolenaar syntax region veraComment matchgroup=veraCommentStart start="/\*" end="\*/" contains=@veraCommentGroup,veraCommentStartError,veraCommentString,veraCharacter,veraNumbersCom,veraSpaceError,@Spell 191c1e37901SBram Moolenaar else 192c1e37901SBram Moolenaar syntax region veraComment matchgroup=veraCommentStart start="/\*" end="\*/" contains=@veraCommentGroup,veraCommentStartError,veraCommentString,veraCharacter,veraNumbersCom,veraSpaceError,@Spell fold 193c1e37901SBram Moolenaar endif 194c1e37901SBram Moolenaarelse 195c1e37901SBram Moolenaar syn region veraCommentL start="//" skip="\\$" end="$" keepend contains=@veraCommentGroup,veraSpaceError,@Spell 196c1e37901SBram Moolenaar if exists("vera_no_comment_fold") 197c1e37901SBram Moolenaar syn region veraComment matchgroup=veraCommentStart start="/\*" end="\*/" contains=@veraCommentGroup,veraCommentStartError,veraSpaceError,@Spell 198c1e37901SBram Moolenaar else 199c1e37901SBram Moolenaar syn region veraComment matchgroup=veraCommentStart start="/\*" end="\*/" contains=@veraCommentGroup,veraCommentStartError,veraSpaceError,@Spell fold 200c1e37901SBram Moolenaar endif 201c1e37901SBram Moolenaarendif 202c1e37901SBram Moolenaar" keep a // comment separately, it terminates a preproc. conditional 203c1e37901SBram Moolenaarsyntax match veraCommentError display "\*/" 204c1e37901SBram Moolenaarsyntax match veraCommentStartError display "/\*"me=e-1 contained 205c1e37901SBram Moolenaar 206c1e37901SBram Moolenaarsyntax region veraBlock start="{" end="}" transparent fold 207c1e37901SBram Moolenaar 208c1e37901SBram Moolenaar" open vera pre-defined constants 209c1e37901SBram Moolenaarsyn keyword veraConstant ALL ANY BAD_STATE BAD_TRANS CALL CHECK CHGEDGE 210c1e37901SBram Moolenaarsyn keyword veraConstant CLEAR COPY_NO_WAIT COPY_WAIT CROSS CROSS_TRANS 211c1e37901SBram Moolenaarsyn keyword veraConstant DEBUG DELETE EC_ARRAYX EC_CODE_END EC_CONFLICT 212c1e37901SBram Moolenaarsyn keyword veraConstant EC_EVNTIMOUT EC_EXPECT EC_FULLEXPECT EC_MBXTMOUT 213c1e37901SBram Moolenaarsyn keyword veraConstant EC_NEXPECT EC_RETURN EC_RGNTMOUT EC_SCONFLICT 214c1e37901SBram Moolenaarsyn keyword veraConstant EC_SEMTMOUT EC_SEXPECT EC_SFULLEXPECT EC_SNEXTPECT 215c1e37901SBram Moolenaarsyn keyword veraConstant EC_USERSET EQ EVENT FAIL FIRST FORK GE GOAL GT 216c1e37901SBram Moolenaarsyn keyword veraConstant HAND_SHAKE HI HIGH HNUM LE LIC_EXIT LIC_PRERR 217c1e37901SBram Moolenaarsyn keyword veraConstant LIC_PRWARN LIC_WAIT LO LOAD LOW LT MAILBOX MAX_COM 218c1e37901SBram Moolenaarsyn keyword veraConstant NAME NE NEGEDGE NEXT NO_OVERLAP NO_OVERLAP_STATE 219c1e37901SBram Moolenaarsyn keyword veraConstant NO_OVERLAP_TRANS NO_VARS NO_WAIT NUM NUM_BIN 220c1e37901SBram Moolenaarsyn keyword veraConstant NUM_DET null OFF OK OK_LAST ON ONE_BLAST ONE_SHOT ORDER 221c1e37901SBram Moolenaarsyn keyword veraConstant PAST_IT PERCENT POSEDGE PROGRAM RAWIN REGION REPORT 222c1e37901SBram Moolenaarsyn keyword veraConstant SAMPLE SAVE SEMAPHORE SET SILENT STATE stderr 223c1e37901SBram Moolenaarsyn keyword veraConstant stdin stdout STR STR_ERR_OUT_OF_RANGE 224c1e37901SBram Moolenaarsyn keyword veraConstant STR_ERR_REGEXP_SYNTAX SUM TRANS VERBOSE void WAIT 225c1e37901SBram Moolenaarsyn keyword veraConstant __LINE__ __FILE__ __DATE__ __TIME__ __VERA__ 226c1e37901SBram Moolenaarsyn keyword veraConstant __VERSION__ __VERA_VERSION__ __VERA_MINOR__ 227c1e37901SBram Moolenaarsyn keyword veraConstant __VERA_PATCH__ __VERA_VMC__ __VERA_VMC_MINOR__ 228c1e37901SBram Moolenaar 229c1e37901SBram Moolenaarsyn match veraUserConstant "\<[A-Z][A-Z0-9_]\+\>" 230c1e37901SBram Moolenaar 231c1e37901SBram Moolenaarsyn match veraClass "\zs\w\+\ze::" 232c1e37901SBram Moolenaarsyn match veraClass "\zs\w\+\ze\s\+\w\+\s*[=;,)\[]" contains=veraConstant,veraUserConstant 233c1e37901SBram Moolenaarsyn match veraClass "\zs\w\+\ze\s\+\w\+\s*$" contains=veraConstant,veraUserConstant 234c1e37901SBram Moolenaarsyn match veraUserMethod "\zs\w\+\ze\s*(" contains=veraConstant,veraUserConstant 235c1e37901SBram Moolenaarsyn match veraObject "\zs\w\+\ze\.\w" 236c1e37901SBram Moolenaarsyn match veraObject "\zs\w\+\ze\.\$\w" 237c1e37901SBram Moolenaar 238c1e37901SBram Moolenaar" Accept ` for # (Verilog) 239c1e37901SBram Moolenaarsyn region veraPreCondit start="^\s*\(`\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" end="//"me=s-1 contains=veraComment,veraCppString,veraCharacter,veraCppParen,veraParenError,veraNumbers,veraCommentError,veraSpaceError 240c1e37901SBram Moolenaarsyn match veraPreCondit display "^\s*\(`\|#\)\s*\(else\|endif\)\>" 241c1e37901SBram Moolenaarif !exists("vera_no_if0") 242c1e37901SBram Moolenaar syn region veraCppOut start="^\s*\(`\|#\)\s*if\s\+0\+\>" end=".\@=\|$" contains=veraCppOut2 243c1e37901SBram Moolenaar syn region veraCppOut2 contained start="0" end="^\s*\(`\|#\)\s*\(endif\>\|else\>\|elif\>\)" contains=veraSpaceError,veraCppSkip 244c1e37901SBram Moolenaar syn region veraCppSkip contained start="^\s*\(`\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(`\|#\)\s*endif\>" contains=veraSpaceError,veraCppSkip 245c1e37901SBram Moolenaarendif 246c1e37901SBram Moolenaarsyn region veraIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+ 247c1e37901SBram Moolenaarsyn match veraIncluded display contained "<[^>]*>" 248c1e37901SBram Moolenaarsyn match veraInclude display "^\s*\(`\|#\)\s*include\>\s*["<]" contains=veraIncluded 249c1e37901SBram Moolenaar"syn match veraLineSkip "\\$" 250c1e37901SBram Moolenaarsyn 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 251c1e37901SBram Moolenaarsyn region veraDefine start="^\s*\(`\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" end="//"me=s-1 contains=ALLBUT,@veraPreProcGroup,@Spell 252c1e37901SBram Moolenaarsyn region veraPreProc start="^\s*\(`\|#\)\s*\(pragma\>\|line\>\|warning\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@veraPreProcGroup,@Spell 253c1e37901SBram Moolenaar 254c1e37901SBram Moolenaar" Highlight User Labels 255c1e37901SBram Moolenaarsyn 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 256c1e37901SBram Moolenaarsyn region veraMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@veraMultiGroup,@Spell 257c1e37901SBram Moolenaar" syn region veraMulti transparent start='?' skip='::' end=':' contains=ALL 258c1e37901SBram Moolenaar" The above causes veraCppOut2 to catch on: 259c1e37901SBram Moolenaar" i = (isTrue) ? 0 : 1; 260c1e37901SBram Moolenaar" which ends up commenting the rest of the file 261c1e37901SBram Moolenaar 262c1e37901SBram Moolenaar" Avoid matching foo::bar() by requiring that the next char is not ':' 263c1e37901SBram Moolenaarsyn cluster veraLabelGroup contains=veraUserLabel 264c1e37901SBram Moolenaarsyn match veraUserCont display "^\s*\I\i*\s*:$" contains=@veraLabelGroup 265c1e37901SBram Moolenaarsyn match veraUserCont display ";\s*\I\i*\s*:$" contains=@veraLabelGroup 266c1e37901SBram Moolenaarsyn match veraUserCont display "^\s*\I\i*\s*:[^:]"me=e-1 contains=@veraLabelGroup 267c1e37901SBram Moolenaarsyn match veraUserCont display ";\s*\I\i*\s*:[^:]"me=e-1 contains=@veraLabelGroup 268c1e37901SBram Moolenaar 269c1e37901SBram Moolenaarsyn match veraUserLabel display "\I\i*" contained 270c1e37901SBram Moolenaar 271c1e37901SBram Moolenaar" Avoid recognizing most bitfields as labels 272c1e37901SBram Moolenaarsyn match veraBitField display "^\s*\I\i*\s*:\s*[1-9]"me=e-1 273c1e37901SBram Moolenaarsyn match veraBitField display ";\s*\I\i*\s*:\s*[1-9]"me=e-1 274c1e37901SBram Moolenaar 275c1e37901SBram Moolenaarif exists("vera_minlines") 276c1e37901SBram Moolenaar let b:vera_minlines = vera_minlines 277c1e37901SBram Moolenaarelse 278c1e37901SBram Moolenaar if !exists("vera_no_if0") 279c1e37901SBram Moolenaar let b:vera_minlines = 50 " #if 0 constructs can be long 280c1e37901SBram Moolenaar else 281c1e37901SBram Moolenaar let b:vera_minlines = 15 " mostly for () constructs 282c1e37901SBram Moolenaar endif 283c1e37901SBram Moolenaarendif 284c1e37901SBram Moolenaarexec "syn sync ccomment veraComment minlines=" . b:vera_minlines 285c1e37901SBram Moolenaar 286c1e37901SBram Moolenaar" Define the default highlighting. 28789bcfda6SBram Moolenaar" Only when an item doesn't have highlighting yet 288c1e37901SBram Moolenaar 289*f37506f6SBram Moolenaarhi def link veraClass Identifier 290*f37506f6SBram Moolenaarhi def link veraObject Identifier 291*f37506f6SBram Moolenaarhi def link veraUserMethod Function 292*f37506f6SBram Moolenaarhi def link veraTask Keyword 293*f37506f6SBram Moolenaarhi def link veraModifier Tag 294*f37506f6SBram Moolenaarhi def link veraDeprecated veraError 295*f37506f6SBram Moolenaarhi def link veraMethods Statement 296*f37506f6SBram Moolenaar" hi def link veraInterface Label 297*f37506f6SBram Moolenaarhi def link veraInterface Function 298c1e37901SBram Moolenaar 299*f37506f6SBram Moolenaarhi def link veraFormat veraSpecial 300*f37506f6SBram Moolenaarhi def link veraCppString veraString 301*f37506f6SBram Moolenaarhi def link veraCommentL veraComment 302*f37506f6SBram Moolenaarhi def link veraCommentStart veraComment 303*f37506f6SBram Moolenaarhi def link veraLabel Label 304*f37506f6SBram Moolenaarhi def link veraUserLabel Label 305*f37506f6SBram Moolenaarhi def link veraConditional Conditional 306*f37506f6SBram Moolenaarhi def link veraRepeat Repeat 307*f37506f6SBram Moolenaarhi def link veraCharacter Character 308*f37506f6SBram Moolenaarhi def link veraSpecialCharacter veraSpecial 309*f37506f6SBram Moolenaarhi def link veraNumber Number 310*f37506f6SBram Moolenaarhi def link veraOctal Number 311*f37506f6SBram Moolenaarhi def link veraOctalZero PreProc " link this to Error if you want 312*f37506f6SBram Moolenaarhi def link veraFloat Float 313*f37506f6SBram Moolenaarhi def link veraOctalError veraError 314*f37506f6SBram Moolenaarhi def link veraParenError veraError 315*f37506f6SBram Moolenaarhi def link veraErrInParen veraError 316*f37506f6SBram Moolenaarhi def link veraErrInBracket veraError 317*f37506f6SBram Moolenaarhi def link veraCommentError veraError 318*f37506f6SBram Moolenaarhi def link veraCommentStartError veraError 319*f37506f6SBram Moolenaarhi def link veraSpaceError SpaceError 320*f37506f6SBram Moolenaarhi def link veraSpecialError veraError 321*f37506f6SBram Moolenaarhi def link veraOperator Operator 322*f37506f6SBram Moolenaarhi def link veraStructure Structure 323*f37506f6SBram Moolenaarhi def link veraInclude Include 324*f37506f6SBram Moolenaarhi def link veraPreProc PreProc 325*f37506f6SBram Moolenaarhi def link veraDefine Macro 326*f37506f6SBram Moolenaarhi def link veraIncluded veraString 327*f37506f6SBram Moolenaarhi def link veraError Error 328*f37506f6SBram Moolenaarhi def link veraStatement Statement 329*f37506f6SBram Moolenaarhi def link veraPreCondit PreCondit 330*f37506f6SBram Moolenaarhi def link veraType Type 331*f37506f6SBram Moolenaar" hi def link veraConstant Constant 332*f37506f6SBram Moolenaarhi def link veraConstant Keyword 333*f37506f6SBram Moolenaarhi def link veraUserConstant Constant 334*f37506f6SBram Moolenaarhi def link veraCommentString veraString 335*f37506f6SBram Moolenaarhi def link veraComment2String veraString 336*f37506f6SBram Moolenaarhi def link veraCommentSkip veraComment 337*f37506f6SBram Moolenaarhi def link veraString String 338*f37506f6SBram Moolenaarhi def link veraComment Comment 339*f37506f6SBram Moolenaarhi def link veraSpecial SpecialChar 340*f37506f6SBram Moolenaarhi def link veraTodo Todo 341*f37506f6SBram Moolenaarhi def link veraCppSkip veraCppOut 342*f37506f6SBram Moolenaarhi def link veraCppOut2 veraCppOut 343*f37506f6SBram Moolenaarhi def link veraCppOut Comment 344c1e37901SBram Moolenaar 345c1e37901SBram Moolenaar 346c1e37901SBram Moolenaarlet b:current_syntax = "vera" 347c1e37901SBram Moolenaar 348c1e37901SBram Moolenaar" vim: ts=8 349