7
|
1 " Vim syntax file
|
|
2 " Language: PROLOG
|
203
|
3 " Maintainers: Thomas Koehler <jean-luc@picard.franken.de>
|
2034
|
4 " Last Change: 2009 Dec 04
|
|
5 " URL: http://gott-gehabt.de/800_wer_wir_sind/thomas/Homepage/Computer/vim/syntax/prolog.vim
|
7
|
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
|
|
12 if version < 600
|
|
13 syntax clear
|
|
14 elseif exists("b:current_syntax")
|
|
15 finish
|
|
16 endif
|
|
17
|
|
18 " Prolog is case sensitive.
|
|
19 syn case match
|
|
20
|
|
21 " Very simple highlighting for comments, clause heads and
|
|
22 " character codes. It respects prolog strings and atoms.
|
|
23
|
|
24 syn region prologCComment start=+/\*+ end=+\*/+
|
|
25 syn match prologComment +%.*+
|
|
26
|
|
27 syn keyword prologKeyword module meta_predicate multifile dynamic
|
|
28 syn match prologCharCode +0'\\\=.+
|
1620
|
29 syn region prologString start=+"+ skip=+\\\\\|\\"+ end=+"+
|
|
30 syn region prologAtom start=+'+ skip=+\\\\\|\\'+ end=+'+
|
|
31 syn region prologClauseHead start=+^[a-z][^(]*(+ skip=+\.[^ ]+ end=+:-\|\.$\|\.[ ]\|-->+ contains=prologComment,prologCComment,prologString
|
7
|
32
|
|
33 if !exists("prolog_highlighting_clean")
|
|
34
|
|
35 " some keywords
|
|
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
|
|
62
|
|
63 syn match prologOperator "=\\=\|=:=\|\\==\|=<\|==\|>=\|\\=\|\\+\|<\|>\|="
|
|
64 syn match prologAsIs "===\|\\===\|<=\|=>"
|
|
65
|
2034
|
66 syn match prologNumber "\<[0123456789]*\>'\@!"
|
7
|
67 syn match prologCommentError "\*/"
|
|
68 syn match prologSpecialCharacter ";"
|
|
69 syn match prologSpecialCharacter "!"
|
|
70 syn match prologQuestion "?-.*\." contains=prologNumber
|
|
71
|
|
72
|
|
73 endif
|
|
74
|
203
|
75 syn sync maxlines=50
|
7
|
76
|
|
77
|
|
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")
|
|
82 if version < 508
|
|
83 let did_prolog_syn_inits = 1
|
|
84 command -nargs=+ HiLink hi link <args>
|
|
85 else
|
|
86 command -nargs=+ HiLink hi def link <args>
|
|
87 endif
|
|
88
|
|
89 " The default highlighting.
|
|
90 HiLink prologComment Comment
|
|
91 HiLink prologCComment Comment
|
|
92 HiLink prologCharCode Special
|
|
93
|
|
94 if exists ("prolog_highlighting_clean")
|
|
95
|
|
96 HiLink prologKeyword Statement
|
|
97 HiLink prologClauseHead Statement
|
|
98
|
|
99 else
|
|
100
|
|
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
|
|
111
|
|
112 endif
|
|
113
|
|
114 delcommand HiLink
|
|
115 endif
|
|
116
|
|
117 let b:current_syntax = "prolog"
|
|
118
|
|
119 " vim: ts=8
|