blob: 3b09bb3548aa2e4f3e366b34b4db1975011a98a9 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: PROLOG
Bram Moolenaar64d8e252016-09-06 22:12:34 +02003" Maintainer: Thomas Koehler <jean-luc@picard.franken.de>
4" Please be aware: I'm often slow to answer email due to a high
5" non-computer related workload (sometimes 4-8 weeks)
6" Last Change: 2016 September 6
Bram Moolenaar543b7ef2013-06-01 14:50:56 +02007" URL: http://gott-gehabt.de/800_wer_wir_sind/thomas/Homepage/Computer/vim/syntax/prolog.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +00008
9" There are two sets of highlighting in here:
10" If the "prolog_highlighting_clean" variable exists, it is rather sparse.
11" Otherwise you get more highlighting.
12
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020013" quit when a syntax file was already loaded
14if exists("b:current_syntax")
Bram Moolenaar071d4272004-06-13 20:20:40 +000015 finish
16endif
17
18" Prolog is case sensitive.
19syn case match
20
21" Very simple highlighting for comments, clause heads and
22" character codes. It respects prolog strings and atoms.
23
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020024syn region prologCComment start=+/\*+ end=+\*/+
25syn match prologComment +%.*+
Bram Moolenaar071d4272004-06-13 20:20:40 +000026
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020027syn keyword prologKeyword module meta_predicate multifile dynamic
28syn match prologCharCode +0'\\\=.+
29syn region prologString start=+"+ skip=+\\\\\|\\"+ end=+"+
30syn region prologAtom start=+'+ skip=+\\\\\|\\'+ end=+'+
31syn region prologClause matchgroup=prologClauseHead start=+^\s*[a-z]\w*+ matchgroup=Normal end=+\.\s\|\.$+ contains=ALLBUT,prologClause
Bram Moolenaar071d4272004-06-13 20:20:40 +000032
33if !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
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020043 syn keyword prologKeyword at_end_of_stream float read_term
Bram Moolenaar071d4272004-06-13 20:20:40 +000044 syn keyword prologKeyword atom flush_output repeat
45 syn keyword prologKeyword atom_chars functor retract
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020046 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
Bram Moolenaar071d4272004-06-13 20:20:40 +000049 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
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020057 syn keyword prologKeyword compound once write
Bram Moolenaar071d4272004-06-13 20:20:40 +000058 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
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020066 syn match prologNumber "\<[0123456789]*\>'\@!"
Bram Moolenaar071d4272004-06-13 20:20:40 +000067 syn match prologCommentError "\*/"
68 syn match prologSpecialCharacter ";"
69 syn match prologSpecialCharacter "!"
Bram Moolenaar543b7ef2013-06-01 14:50:56 +020070 syn match prologSpecialCharacter ":-"
71 syn match prologSpecialCharacter "-->"
72 syn match prologQuestion "?-.*\." contains=prologNumber
Bram Moolenaar071d4272004-06-13 20:20:40 +000073
74
75endif
76
Bram Moolenaar3918c952005-03-15 22:34:55 +000077syn sync maxlines=50
Bram Moolenaar071d4272004-06-13 20:20:40 +000078
79
80" Define the default highlighting.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020081" Only when an item doesn't have highlighting yet
Bram Moolenaar071d4272004-06-13 20:20:40 +000082
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020083" The default highlighting.
Bram Moolenaarf37506f2016-08-31 22:22:10 +020084hi def link prologComment Comment
85hi def link prologCComment Comment
86hi def link prologCharCode Special
Bram Moolenaar071d4272004-06-13 20:20:40 +000087
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020088if exists ("prolog_highlighting_clean")
Bram Moolenaar071d4272004-06-13 20:20:40 +000089
Bram Moolenaarf37506f2016-08-31 22:22:10 +020090hi def link prologKeyword Statement
91hi def link prologClauseHead Statement
92hi def link prologClause Normal
Bram Moolenaar071d4272004-06-13 20:20:40 +000093
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020094else
Bram Moolenaar071d4272004-06-13 20:20:40 +000095
Bram Moolenaarf37506f2016-08-31 22:22:10 +020096hi def link prologKeyword Keyword
97hi def link prologClauseHead Constant
98hi def link prologClause Normal
99hi def link prologQuestion PreProc
100hi def link prologSpecialCharacter Special
101hi def link prologNumber Number
102hi def link prologAsIs Normal
103hi def link prologCommentError Error
104hi def link prologAtom String
105hi def link prologString String
106hi def link prologOperator Operator
Bram Moolenaar071d4272004-06-13 20:20:40 +0000107
Bram Moolenaar071d4272004-06-13 20:20:40 +0000108endif
109
Bram Moolenaar89bcfda2016-08-30 23:26:57 +0200110
Bram Moolenaar071d4272004-06-13 20:20:40 +0000111let b:current_syntax = "prolog"
112
113" vim: ts=8