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