summaryrefslogtreecommitdiffstats
path: root/syntax/tptp.vim
blob: 414789a6c50200899d1ba4e28f883f9e4b637143 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
if !has_key(g:polyglot_is_disabled, 'tptp')
  finish
endif

" Vim syntax file
" Language:		TPTP
" Filename extensions:	*.p (collides with Pascal/Progress),
" Maintainer:		Simon Cruanes (heavily inspired from progress.vim file)
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
	syntax clear
"elseif exists("b:current_syntax")
"	finish
endif

if version >= 600
  setlocal iskeyword=@,48-57,_,-,!,#,$,%
else
  set iskeyword=@,48-57,_,-,!,#,$,%
endif

" tabs = evil
set expandtab

syn case match

syn keyword     tptpRole        axiom hypothesis definition assumption lemma theorem corollary conjecture negated_conjecture plain fi_domain fi_functors fi_predicates type unknown
syn keyword     tptpLogic       fof tff thf cnf include

syn match       tptpBuiltin     "$o\>"
syn match       tptpBuiltin     "$i\>"
syn match       tptpBuiltin     "$true\>"
syn match       tptpBuiltin     "$false\>"

syn match       tptpBuiltin     "$int\>"
syn match       tptpBuiltin     "$rat\>"
syn match       tptpBuiltin     "$real\>"
syn match       tptpBuiltin     "$tType\>"
syn match       tptpBuiltin     "$_\>"

syn match       tptpBuiltin     "$floor"
syn match       tptpBuiltin     "$ceiling"
syn match       tptpBuiltin     "$truncate"
syn match       tptpBuiltin     "$round"
syn match       tptpBuiltin     "$prec"
syn match       tptpBuiltin     "$succ"
syn match       tptpBuiltin     "$sum"
syn match       tptpBuiltin     "$difference"
syn match       tptpBuiltin     "$uminus"
syn match       tptpBuiltin     "$product"
syn match       tptpBuiltin     "$quotient"
syn match       tptpBuiltin     "$quotient_e"
syn match       tptpBuiltin     "$quotient_t"
syn match       tptpBuiltin     "$quotient_f"
syn match       tptpBuiltin     "$remainder_e"
syn match       tptpBuiltin     "$remainder_t"
syn match       tptpBuiltin     "$remainder_f"
syn match       tptpBuiltin     "$is_int"
syn match       tptpBuiltin     "$is_rat"
syn match       tptpBuiltin     "$to_int"
syn match       tptpBuiltin     "$to_rat"
syn match       tptpBuiltin     "$less"
syn match       tptpBuiltin     "$lesseq"
syn match       tptpBuiltin     "$greater"
syn match       tptpBuiltin     "$greatereq"

" generic dollar
syn match       tptpDollar      "\<\$\w+\>"
syn match       tptpDollarDollar "\<\$\$\w+\>"

syn match       tptpQuote       "'[^']*'"
syn match       tptpDoubleQuote "\"[^"]*\""

syn match       tptpConnective  ":"
syn match       tptpConnective  "|"
syn match       tptpConnective  "&"
syn match       tptpConnective  "="
syn match       tptpConnective  "=>"
syn match       tptpConnective  "<="
syn match       tptpConnective  "<=>"
syn match       tptpConnective  "<\~>"
syn match       tptpConnective  "!"
syn match       tptpConnective  "?"
syn match       tptpConnective  "!>"
syn match       tptpConnective  "!="
syn match       tptpConnective  "\~"
syn match       tptpConnective  "\."
syn match       tptpConnective  "\*"
syn match       tptpConnective  ">"

syn match       tptpVar         "\<\u\w*\>"

syn match       tptpNum         "\<-\?[0-9]\+\>"
syn match       tptpNum         "\<-\?[0-9]\+/[0-9]\+\>"

" errors

"syn match       tptpBraceError  "\]"
"syn match       tptpParenError  ")"

" delimiters

syn region      tptpParen       matchgroup=tptpDelim start="("  end=")" contains=ALLBUT,tptpParenError keepend contained
syn region      tptpParen       matchgroup=tptpDelim start="\[" end="\]" contains=ALLBUT,tptpBraceError keepend contained

syn keyword	tptpTodo	contained TODO BUG FIX FIXME NOTE

syn region      tptpComment	start=+/\*+ end=+\*/+ contains=tptpTodo
syn match       tptpComment     +%.*+ contains=tptpTodo

" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_tptp_syntax_inits")
  if version < 508
    let did_tptp_syntax_inits = 1
    command -nargs=+ HiLink hi link <args>
  else
    command -nargs=+ HiLink hi def link <args>
  endif

  HiLink tptpTodo               Todo

  HiLink tptpComment		Comment
  HiLink tptpComment		Comment

  HiLink tptpRole               Keyword
  HiLink tptpLogic              Keyword
  HiLink tptpConnective         Keyword
  HiLink tptpDelim              Delimiter

  HiLink tptpBuiltin            Special

  HiLink tptpDollar             String
  HiLink tptpDollarDollar       String
  HiLink tptpQuote              String
  HiLink tptpDoubleQuote        String

  HiLink tptpVar                Constant

  HiLink tptpNum                Number

  HiLink tptpBraceError         Error
  HiLink tptpParenError         Error

  delcommand HiLink
end

let b:current_syntax = "tptp"

" vim: ts=8 sw=8