3 " Maintainers: Ralph Becket <rwab1@cam.sri.co.uk>,
4 " Thomas Koehler <jean-luc@picard.franken.de>
5 " Last Change: 2001 May 10
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.
11 " Quit when a syntax file was already loaded
14 elseif exists("b:current_syntax")
18 " Prolog is case sensitive.
21 " Very simple highlighting for comments, clause heads and
22 " character codes. It respects prolog strings and atoms.
24 syn region prologCComment start=+/\*+ end=+\*/+
25 syn match prologComment +%.*+
27 syn keyword prologKeyword module meta_predicate multifile dynamic
28 syn match prologCharCode +0'\\\=.+
29 syn region prologString start=+"+ skip=+\\"+ end=+"+
30 syn region prologAtom start=+'+ skip=+\\'+ end=+'+
31 syn region prologClauseHead start=+^[a-z][^(]*(+ end=+:-\|\.\|-->+
33 if !exists("prolog_highlighting_clean")
36 " some common predicates are also highlighted as keywords
37 " is there a better solution?
38 syn keyword prologKeyword abolish current_output peek_code
39 syn keyword prologKeyword append current_predicate put_byte
40 syn keyword prologKeyword arg current_prolog_flag put_char
41 syn keyword prologKeyword asserta fail put_code
42 syn keyword prologKeyword assertz findall read
43 syn keyword prologKeyword at_end_of_stream float read_term
44 syn keyword prologKeyword atom flush_output repeat
45 syn keyword prologKeyword atom_chars functor retract
46 syn keyword prologKeyword atom_codes get_byte set_input
47 syn keyword prologKeyword atom_concat get_char set_output
48 syn keyword prologKeyword atom_length get_code set_prolog_flag
49 syn keyword prologKeyword atomic halt set_stream_position
50 syn keyword prologKeyword bagof integer setof
51 syn keyword prologKeyword call is stream_property
52 syn keyword prologKeyword catch nl sub_atom
53 syn keyword prologKeyword char_code nonvar throw
54 syn keyword prologKeyword char_conversion number true
55 syn keyword prologKeyword clause number_chars unify_with_occurs_check
56 syn keyword prologKeyword close number_codes var
57 syn keyword prologKeyword compound once write
58 syn keyword prologKeyword copy_term op write_canonical
59 syn keyword prologKeyword current_char_conversion open write_term
60 syn keyword prologKeyword current_input peek_byte writeq
61 syn keyword prologKeyword current_op peek_char
63 syn match prologOperator "=\\=\|=:=\|\\==\|=<\|==\|>=\|\\=\|\\+\|<\|>\|="
64 syn match prologAsIs "===\|\\===\|<=\|=>"
66 syn match prologNumber "\<[0123456789]*\>"
67 syn match prologCommentError "\*/"
68 syn match prologSpecialCharacter ";"
69 syn match prologSpecialCharacter "!"
70 syn match prologQuestion "?-.*\." contains=prologNumber
75 syn sync ccomment maxlines=50
78 " Define the default highlighting.
79 " For version 5.7 and earlier: only when not done already
80 " For version 5.8 and later: only when an item doesn't have highlighting yet
81 if version >= 508 || !exists("did_prolog_syn_inits")
83 let did_prolog_syn_inits = 1
84 command -nargs=+ HiLink hi link <args>
86 command -nargs=+ HiLink hi def link <args>
89 " The default highlighting.
90 HiLink prologComment Comment
91 HiLink prologCComment Comment
92 HiLink prologCharCode Special
94 if exists ("prolog_highlighting_clean")
96 HiLink prologKeyword Statement
97 HiLink prologClauseHead Statement
101 HiLink prologKeyword Keyword
102 HiLink prologClauseHead Constant
103 HiLink prologQuestion PreProc
104 HiLink prologSpecialCharacter Special
105 HiLink prologNumber Number
106 HiLink prologAsIs Normal
107 HiLink prologCommentError Error
108 HiLink prologAtom String
109 HiLink prologString String
110 HiLink prologOperator Operator
117 let b:current_syntax = "prolog"