| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | " Vim syntax file | 
					
						
							|  |  |  | " Language:    PROLOG | 
					
						
							| 
									
										
										
										
											2019-08-31 16:20:32 +02:00
										 |  |  | " Maintainer:  Anton Kochkov <anton.kochkov@gmail.com> | 
					
						
							| 
									
										
										
										
											2021-01-11 19:40:15 +01:00
										 |  |  | " Last Change: 2021 Jan 05 | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | " There are two sets of highlighting in here: | 
					
						
							|  |  |  | " If the "prolog_highlighting_clean" variable exists, it is rather sparse. | 
					
						
							|  |  |  | " Otherwise you get more highlighting. | 
					
						
							| 
									
										
										
										
											2019-08-31 16:20:32 +02:00
										 |  |  | " | 
					
						
							|  |  |  | " You can also set the "prolog_highlighting_no_keyword" variable. If set, | 
					
						
							|  |  |  | " keywords will not be highlighted. | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-30 23:26:57 +02:00
										 |  |  | " quit when a syntax file was already loaded | 
					
						
							|  |  |  | if exists("b:current_syntax") | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  |   finish | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " Prolog is case sensitive. | 
					
						
							|  |  |  | syn case match | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " Very simple highlighting for comments, clause heads and | 
					
						
							|  |  |  | " character codes.  It respects prolog strings and atoms. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-11 19:40:15 +01:00
										 |  |  | syn region   prologCComment start=+/\*+ end=+\*/+ contains=@Spell | 
					
						
							|  |  |  | syn match    prologComment  +%.*+ contains=@Spell | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-31 16:20:32 +02:00
										 |  |  | if !exists("prolog_highlighting_no_keyword") | 
					
						
							|  |  |  |   syn keyword  prologKeyword  module meta_predicate multifile dynamic | 
					
						
							|  |  |  | endif | 
					
						
							| 
									
										
										
										
											2013-06-01 14:50:56 +02:00
										 |  |  | syn match    prologCharCode +0'\\\=.+ | 
					
						
							| 
									
										
										
										
											2021-01-11 19:40:15 +01:00
										 |  |  | syn region   prologString   start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell | 
					
						
							| 
									
										
										
										
											2013-06-01 14:50:56 +02:00
										 |  |  | syn region   prologAtom     start=+'+ skip=+\\\\\|\\'+ end=+'+ | 
					
						
							| 
									
										
										
										
											2021-01-11 19:40:15 +01:00
										 |  |  | syn region   prologClause   matchgroup=prologClauseHead start=+^\s*[a-z]\w*+ matchgroup=Normal end=+\.\s\|\.$+ contains=ALLBUT,prologClause contains=@NoSpell | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | if !exists("prolog_highlighting_clean") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   " some keywords | 
					
						
							|  |  |  |   " some common predicates are also highlighted as keywords | 
					
						
							|  |  |  |   " is there a better solution? | 
					
						
							| 
									
										
										
										
											2019-08-31 16:20:32 +02:00
										 |  |  |   if !exists("prolog_highlighting_no_keyword") | 
					
						
							|  |  |  |     syn keyword prologKeyword   abolish current_output  peek_code | 
					
						
							|  |  |  |     syn keyword prologKeyword   append  current_predicate       put_byte | 
					
						
							|  |  |  |     syn keyword prologKeyword   arg     current_prolog_flag     put_char | 
					
						
							|  |  |  |     syn keyword prologKeyword   asserta fail    put_code | 
					
						
							|  |  |  |     syn keyword prologKeyword   assertz findall read | 
					
						
							|  |  |  |     syn keyword prologKeyword   at_end_of_stream        float   read_term | 
					
						
							|  |  |  |     syn keyword prologKeyword   atom    flush_output    repeat | 
					
						
							|  |  |  |     syn keyword prologKeyword   atom_chars      functor retract | 
					
						
							|  |  |  |     syn keyword prologKeyword   atom_codes      get_byte        set_input | 
					
						
							|  |  |  |     syn keyword prologKeyword   atom_concat     get_char        set_output | 
					
						
							|  |  |  |     syn keyword prologKeyword   atom_length     get_code        set_prolog_flag | 
					
						
							|  |  |  |     syn keyword prologKeyword   atomic  halt    set_stream_position | 
					
						
							|  |  |  |     syn keyword prologKeyword   bagof   integer setof | 
					
						
							|  |  |  |     syn keyword prologKeyword   call    is      stream_property | 
					
						
							|  |  |  |     syn keyword prologKeyword   catch   nl      sub_atom | 
					
						
							|  |  |  |     syn keyword prologKeyword   char_code       nonvar  throw | 
					
						
							|  |  |  |     syn keyword prologKeyword   char_conversion number  true | 
					
						
							|  |  |  |     syn keyword prologKeyword   clause  number_chars    unify_with_occurs_check | 
					
						
							|  |  |  |     syn keyword prologKeyword   close   number_codes    var | 
					
						
							|  |  |  |     syn keyword prologKeyword   compound        once    write | 
					
						
							|  |  |  |     syn keyword prologKeyword   copy_term       op      write_canonical | 
					
						
							|  |  |  |     syn keyword prologKeyword   current_char_conversion open    write_term | 
					
						
							|  |  |  |     syn keyword prologKeyword   current_input   peek_byte       writeq | 
					
						
							|  |  |  |     syn keyword prologKeyword   current_op      peek_char | 
					
						
							|  |  |  |   endif | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-31 16:20:32 +02:00
										 |  |  |   syn match   prologOperator "=\\=\|=:=\|\\==\|=<\|==\|>=\|\\=\|\\+\|=\.\.\|<\|>\|=" | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  |   syn match   prologAsIs     "===\|\\===\|<=\|=>" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-31 16:20:32 +02:00
										 |  |  |   syn match   prologNumber            "\<\d*\>'\@!" | 
					
						
							|  |  |  |   syn match   prologNumber            "\<0[xX]\x*\>'\@!" | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  |   syn match   prologCommentError      "\*/" | 
					
						
							|  |  |  |   syn match   prologSpecialCharacter  ";" | 
					
						
							|  |  |  |   syn match   prologSpecialCharacter  "!" | 
					
						
							| 
									
										
										
										
											2013-06-01 14:50:56 +02:00
										 |  |  |   syn match   prologSpecialCharacter  ":-" | 
					
						
							|  |  |  |   syn match   prologSpecialCharacter  "-->" | 
					
						
							|  |  |  |   syn match   prologQuestion          "?-.*\."  contains=prologNumber | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-03-15 22:34:55 +00:00
										 |  |  | syn sync maxlines=50 | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " Define the default highlighting. | 
					
						
							| 
									
										
										
										
											2016-08-30 23:26:57 +02:00
										 |  |  | " Only when an item doesn't have highlighting yet | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " The default highlighting. | 
					
						
							| 
									
										
										
										
											2016-08-31 22:22:10 +02:00
										 |  |  | hi def link prologComment          Comment | 
					
						
							|  |  |  | hi def link prologCComment         Comment | 
					
						
							|  |  |  | hi def link prologCharCode         Special | 
					
						
							| 
									
										
										
										
											2016-08-30 23:26:57 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | if exists ("prolog_highlighting_clean") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-31 22:22:10 +02:00
										 |  |  | hi def link prologKeyword        Statement | 
					
						
							|  |  |  | hi def link prologClauseHead     Statement | 
					
						
							|  |  |  | hi def link prologClause Normal | 
					
						
							| 
									
										
										
										
											2016-08-30 23:26:57 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-31 22:22:10 +02:00
										 |  |  | hi def link prologKeyword        Keyword | 
					
						
							|  |  |  | hi def link prologClauseHead     Constant | 
					
						
							|  |  |  | hi def link prologClause Normal | 
					
						
							|  |  |  | hi def link prologQuestion       PreProc | 
					
						
							|  |  |  | hi def link prologSpecialCharacter Special | 
					
						
							|  |  |  | hi def link prologNumber         Number | 
					
						
							|  |  |  | hi def link prologAsIs           Normal | 
					
						
							|  |  |  | hi def link prologCommentError   Error | 
					
						
							|  |  |  | hi def link prologAtom           String | 
					
						
							|  |  |  | hi def link prologString         String | 
					
						
							|  |  |  | hi def link prologOperator       Operator | 
					
						
							| 
									
										
										
										
											2016-08-30 23:26:57 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-30 23:26:57 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | let b:current_syntax = "prolog" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " vim: ts=8 |