1" Vim syntax file 2" Language: PROLOG 3" Maintainers: Thomas Koehler <[email protected]> 4" Last Change: 2013 May 23 5" URL: http://gott-gehabt.de/800_wer_wir_sind/thomas/Homepage/Computer/vim/syntax/prolog.vim 6 7" There are two sets of highlighting in here: 8" If the "prolog_highlighting_clean" variable exists, it is rather sparse. 9" Otherwise you get more highlighting. 10 11" quit when a syntax file was already loaded 12if exists("b:current_syntax") 13 finish 14endif 15 16" Prolog is case sensitive. 17syn case match 18 19" Very simple highlighting for comments, clause heads and 20" character codes. It respects prolog strings and atoms. 21 22syn region prologCComment start=+/\*+ end=+\*/+ 23syn match prologComment +%.*+ 24 25syn keyword prologKeyword module meta_predicate multifile dynamic 26syn match prologCharCode +0'\\\=.+ 27syn region prologString start=+"+ skip=+\\\\\|\\"+ end=+"+ 28syn region prologAtom start=+'+ skip=+\\\\\|\\'+ end=+'+ 29syn region prologClause matchgroup=prologClauseHead start=+^\s*[a-z]\w*+ matchgroup=Normal end=+\.\s\|\.$+ contains=ALLBUT,prologClause 30 31if !exists("prolog_highlighting_clean") 32 33 " some keywords 34 " some common predicates are also highlighted as keywords 35 " is there a better solution? 36 syn keyword prologKeyword abolish current_output peek_code 37 syn keyword prologKeyword append current_predicate put_byte 38 syn keyword prologKeyword arg current_prolog_flag put_char 39 syn keyword prologKeyword asserta fail put_code 40 syn keyword prologKeyword assertz findall read 41 syn keyword prologKeyword at_end_of_stream float read_term 42 syn keyword prologKeyword atom flush_output repeat 43 syn keyword prologKeyword atom_chars functor retract 44 syn keyword prologKeyword atom_codes get_byte set_input 45 syn keyword prologKeyword atom_concat get_char set_output 46 syn keyword prologKeyword atom_length get_code set_prolog_flag 47 syn keyword prologKeyword atomic halt set_stream_position 48 syn keyword prologKeyword bagof integer setof 49 syn keyword prologKeyword call is stream_property 50 syn keyword prologKeyword catch nl sub_atom 51 syn keyword prologKeyword char_code nonvar throw 52 syn keyword prologKeyword char_conversion number true 53 syn keyword prologKeyword clause number_chars unify_with_occurs_check 54 syn keyword prologKeyword close number_codes var 55 syn keyword prologKeyword compound once write 56 syn keyword prologKeyword copy_term op write_canonical 57 syn keyword prologKeyword current_char_conversion open write_term 58 syn keyword prologKeyword current_input peek_byte writeq 59 syn keyword prologKeyword current_op peek_char 60 61 syn match prologOperator "=\\=\|=:=\|\\==\|=<\|==\|>=\|\\=\|\\+\|<\|>\|=" 62 syn match prologAsIs "===\|\\===\|<=\|=>" 63 64 syn match prologNumber "\<[0123456789]*\>'\@!" 65 syn match prologCommentError "\*/" 66 syn match prologSpecialCharacter ";" 67 syn match prologSpecialCharacter "!" 68 syn match prologSpecialCharacter ":-" 69 syn match prologSpecialCharacter "-->" 70 syn match prologQuestion "?-.*\." contains=prologNumber 71 72 73endif 74 75syn sync maxlines=50 76 77 78" Define the default highlighting. 79" Only when an item doesn't have highlighting yet 80 81" The default highlighting. 82hi def link prologComment Comment 83hi def link prologCComment Comment 84hi def link prologCharCode Special 85 86if exists ("prolog_highlighting_clean") 87 88hi def link prologKeyword Statement 89hi def link prologClauseHead Statement 90hi def link prologClause Normal 91 92else 93 94hi def link prologKeyword Keyword 95hi def link prologClauseHead Constant 96hi def link prologClause Normal 97hi def link prologQuestion PreProc 98hi def link prologSpecialCharacter Special 99hi def link prologNumber Number 100hi def link prologAsIs Normal 101hi def link prologCommentError Error 102hi def link prologAtom String 103hi def link prologString String 104hi def link prologOperator Operator 105 106endif 107 108 109let b:current_syntax = "prolog" 110 111" vim: ts=8 112