" Vim syntax file " " Language: Logtalk " Maintainer: Paulo Moura " Last Change: February 4, 2012 " quit when a syntax file was already loaded if exists("b:current_syntax") finish endif let s:cpo_save = &cpo set cpo&vim " Logtalk is case sensitive: syn case match " Logtalk variables syn match logtalkVariable "\<\(\u\|_\)\(\w\)*\>" " Logtalk clause functor syn match logtalkOperator ":-" " Logtalk quoted atoms and strings syn region logtalkString start=+"+ skip=+\\"+ end=+"+ syn region logtalkAtom start=+'+ skip=+\\'+ end=+'+ contains=logtalkEscapeSequence syn match logtalkEscapeSequence contained "\\\([\\abfnrtv\"\']\|\(x[a-fA-F0-9]\+\|[0-7]\+\)\\\)" " Logtalk message sending operators syn match logtalkOperator "::" syn match logtalkOperator ":" syn match logtalkOperator "\^\^" " Logtalk external call syn region logtalkExtCall matchgroup=logtalkExtCallTag start="{" matchgroup=logtalkExtCallTag end="}" contains=ALL " Logtalk opening entity directives syn region logtalkOpenEntityDir matchgroup=logtalkOpenEntityDirTag start=":- object(" matchgroup=logtalkOpenEntityDirTag end=")\." contains=logtalkEntity,logtalkVariable,logtalkNumber,logtalkOperator,logtalkString,logtalkAtom,logtalkEntityRel,logtalkLineComment syn region logtalkOpenEntityDir matchgroup=logtalkOpenEntityDirTag start=":- protocol(" matchgroup=logtalkOpenEntityDirTag end=")\." contains=logtalkEntity,logtalkVariable,logtalkNumber,logtalkOperator,logtalkEntityRel,logtalkLineComment syn region logtalkOpenEntityDir matchgroup=logtalkOpenEntityDirTag start=":- category(" matchgroup=logtalkOpenEntityDirTag end=")\." contains=logtalkEntity,logtalkVariable,logtalkNumber,logtalkOperator,logtalkEntityRel,logtalkLineComment " Logtalk closing entity directives syn match logtalkCloseEntityDir ":- end_object\." syn match logtalkCloseEntityDir ":- end_protocol\." syn match logtalkCloseEntityDir ":- end_category\." " Logtalk entity relations syn region logtalkEntityRel matchgroup=logtalkEntityRelTag start="instantiates(" matchgroup=logtalkEntityRelTag end=")" contains=logtalkEntity,logtalkVariable,logtalkNumber,logtalkOperator,logtalkString,logtalkAtom contained syn region logtalkEntityRel matchgroup=logtalkEntityRelTag start="specializes(" matchgroup=logtalkEntityRelTag end=")" contains=logtalkEntity,logtalkVariable,logtalkNumber,logtalkOperator,logtalkString,logtalkAtom contained syn region logtalkEntityRel matchgroup=logtalkEntityRelTag start="extends(" matchgroup=logtalkEntityRelTag end=")" contains=logtalkEntity,logtalkVariable,logtalkNumber,logtalkOperator,logtalkString,logtalkAtom contained syn region logtalkEntityRel matchgroup=logtalkEntityRelTag start="imports(" matchgroup=logtalkEntityRelTag end=")" contains=logtalkEntity,logtalkVariable,logtalkNumber,logtalkOperator,logtalkString,logtalkAtom contained syn region logtalkEntityRel matchgroup=logtalkEntityRelTag start="implements(" matchgroup=logtalkEntityRelTag end=")" contains=logtalkEntity,logtalkVariable,logtalkNumber,logtalkOperator,logtalkString,logtalkAtom contained syn region logtalkEntityRel matchgroup=logtalkEntityRelTag start="complements(" matchgroup=logtalkEntityRelTag end=")" contains=logtalkEntity,logtalkVariable,logtalkNumber,logtalkOperator,logtalkString,logtalkAtom contained " Logtalk directives syn region logtalkDir matchgroup=logtalkDirTag start=":- if(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- elif(" matchgroup=logtalkDirTag end=")\." contains=ALL syn match logtalkDirTag ":- else\." syn match logtalkDirTag ":- endif\." syn region logtalkDir matchgroup=logtalkDirTag start=":- alias(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- calls(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- coinductive(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- encoding(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- initialization(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- info(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- mode(" matchgroup=logtalkDirTag end=")\." contains=logtalkOperator, logtalkAtom syn region logtalkDir matchgroup=logtalkDirTag start=":- dynamic(" matchgroup=logtalkDirTag end=")\." contains=ALL syn match logtalkDirTag ":- dynamic\." syn region logtalkDir matchgroup=logtalkDirTag start=":- discontiguous(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- multifile(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- public(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- protected(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- private(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- meta_predicate(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- meta_non_terminal(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- op(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- set_logtalk_flag(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- synchronized(" matchgroup=logtalkDirTag end=")\." contains=ALL syn match logtalkDirTag ":- synchronized\." syn region logtalkDir matchgroup=logtalkDirTag start=":- uses(" matchgroup=logtalkDirTag end=")\." contains=ALL syn match logtalkDirTag ":- threaded\." " Prolog directives syn region logtalkDir matchgroup=logtalkDirTag start=":- ensure_loaded(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- include(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- set_prolog_flag(" matchgroup=logtalkDirTag end=")\." contains=ALL " Module directives syn region logtalkDir matchgroup=logtalkDirTag start=":- module(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- export(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- reexport(" matchgroup=logtalkDirTag end=")\." contains=ALL syn region logtalkDir matchgroup=logtalkDirTag start=":- use_module(" matchgroup=logtalkDirTag end=")\." contains=ALL " Logtalk built-in predicates syn match logtalkBuiltIn "\<\(abolish\|c\(reate\|urrent\)\)_\(object\|protocol\|category\)\ze(" syn match logtalkBuiltIn "\<\(object\|protocol\|category\)_property\ze(" syn match logtalkBuiltIn "\" syn match logtalkKeyword "\" syn match logtalkKeyword "\" syn match logtalkOperator "->" syn match logtalkKeyword "\" syn match logtalkOperator "@>=" " Term creation and decomposition syn match logtalkKeyword "\" " Arithemtic comparison syn match logtalkOperator "=:=" syn match logtalkOperator "=\\=" syn match logtalkOperator "<" syn match logtalkOperator "=<" syn match logtalkOperator ">" syn match logtalkOperator ">=" " Stream selection and control syn match logtalkKeyword "\<\(curren\|se\)t_\(in\|out\)put\ze(" syn match logtalkKeyword "\" syn match logtalkKeyword "\" syn match logtalkKeyword "\" " Term input/output syn match logtalkKeyword "\" " Atomic term processing syn match logtalkKeyword "\" " Sorting syn match logtalkKeyword "\<\(key\)\?sort\ze(" " Evaluable functors syn match logtalkOperator "+" syn match logtalkOperator "-" syn match logtalkOperator "\*" syn match logtalkOperator "//" syn match logtalkOperator "/" syn match logtalkKeyword "\" syn match logtalkKeyword "\" syn match logtalkKeyword "\" syn match logtalkKeyword "\" syn match logtalkKeyword "\>" syn match logtalkOperator "<<" syn match logtalkOperator "/\\" syn match logtalkOperator "\\/" syn match logtalkOperator "\\" " Logtalk list operator syn match logtalkOperator "|" " Logtalk existential quantifier operator syn match logtalkOperator "\^" " Logtalk numbers syn match logtalkNumber "\<\d\+\>" syn match logtalkNumber "\<\d\+\.\d\+\>" syn match logtalkNumber "\<\d\+[eE][-+]\=\d\+\>" syn match logtalkNumber "\<\d\+\.\d\+[eE][-+]\=\d\+\>" syn match logtalkNumber "\<0'.\|0''\|0'\"\>" syn match logtalkNumber "\<0b[0-1]\+\>" syn match logtalkNumber "\<0o\o\+\>" syn match logtalkNumber "\<0x\x\+\>" " Logtalk end-of-clause syn match logtalkOperator "\." " Logtalk comments syn region logtalkBlockComment start="/\*" end="\*/" fold syn match logtalkLineComment "%.*" syn cluster logtalkComment contains=logtalkBlockComment,logtalkLineComment " Logtalk conditional compilation folding syn region logtalkIfContainer transparent keepend extend start=":- if(" end=":- endif\." containedin=ALLBUT,@logtalkComment contains=NONE syn region logtalkIf transparent fold keepend start=":- if(" end=":- \(else\.\|elif(\)"ms=s-1,me=s-1 contained containedin=logtalkIfContainer nextgroup=logtalkElseIf,logtalkElse contains=TOP syn region logtalkElseIf transparent fold keepend start=":- elif(" end=":- \(else\.\|elif(\)"ms=s-1,me=s-1 contained containedin=logtalkIfContainer nextgroup=logtalkElseIf,logtalkElse contains=TOP syn region logtalkElse transparent fold keepend start=":- else\." end=":- endif\." contained containedin=logtalkIfContainer contains=TOP " Logtalk entity folding syn region logtalkEntity transparent fold keepend start=":- object(" end=":- end_object\." contains=ALL syn region logtalkEntity transparent fold keepend start=":- protocol(" end=":- end_protocol\." contains=ALL syn region logtalkEntity transparent fold keepend start=":- category(" end=":- end_category\." contains=ALL syn sync ccomment logtalkBlockComment maxlines=50 " Define the default highlighting. " Only when an item doesn't have highlighting yet command -nargs=+ HiLink hi def link HiLink logtalkBlockComment Comment HiLink logtalkLineComment Comment HiLink logtalkOpenEntityDir Normal HiLink logtalkOpenEntityDirTag PreProc HiLink logtalkIfContainer PreProc HiLink logtalkIf PreProc HiLink logtalkElseIf PreProc HiLink logtalkElse PreProc HiLink logtalkEntity Normal HiLink logtalkEntityRel Normal HiLink logtalkEntityRelTag PreProc HiLink logtalkCloseEntityDir PreProc HiLink logtalkDir Normal HiLink logtalkDirTag PreProc HiLink logtalkAtom String HiLink logtalkString String HiLink logtalkEscapeSequence SpecialChar HiLink logtalkNumber Number HiLink logtalkKeyword Keyword HiLink logtalkBuiltIn Keyword HiLink logtalkBuiltInMethod Keyword HiLink logtalkOperator Operator HiLink logtalkExtCall Normal HiLink logtalkExtCallTag Operator HiLink logtalkVariable Identifier delcommand HiLink let b:current_syntax = "logtalk" let &cpo = s:cpo_save unlet s:cpo_save