1" Vim syntax file
2" Language:	gp (version 2.4)
3" Maintainer:	Karim Belabas <Karim.Belabas@math.u-bordeaux.fr>
4" Last change:	2007 Oct 1
5" URL:		http://pari.math.u-bordeaux.fr
6
7if version < 600
8  syntax clear
9elseif exists("b:current_syntax")
10  finish
11endif
12
13" control statements
14syntax keyword gpStatement	break return next
15syntax keyword gpConditional	if
16syntax keyword gpRepeat		until while for fordiv forprime forstep forvec
17" storage class
18syntax keyword gpScope		my local global
19" defaults
20syntax keyword gpInterfaceKey	colors compatible datadir debug debugfiles
21syntax keyword gpInterfaceKey	debugmem echo factor_add_primes format help
22syntax keyword gpInterfaceKey	histsize lines log logfile new_galois_format
23syntax keyword gpInterfaceKey	output parisize path prettyprinter primelimit
24syntax keyword gpInterfaceKey	prompt prompt_cont psfile realprecision secure
25syntax keyword gpInterfaceKey	seriesprecision simplify strictmatch TeXstyle timer
26
27syntax match   gpInterface	"^\s*\\[a-z].*"
28syntax keyword gpInterface	default
29syntax keyword gpInput		read input
30
31" functions
32syntax match gpFunRegion "^\s*[a-zA-Z][_a-zA-Z0-9]*(.*)\s*=\s*[^ \t=]"me=e-1 contains=gpFunction,gpArgs
33syntax match gpFunRegion "^\s*[a-zA-Z][_a-zA-Z0-9]*(.*)\s*=\s*$" contains=gpFunction,gpArgs
34syntax match gpArgs contained "[a-zA-Z][_a-zA-Z0-9]*"
35syntax match gpFunction contained "^\s*[a-zA-Z][_a-zA-Z0-9]*("me=e-1
36
37" String and Character constants
38" Highlight special (backslash'ed) characters differently
39syntax match  gpSpecial contained "\\[ent\\]"
40syntax region gpString  start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=gpSpecial
41
42"comments
43syntax region gpComment	start="/\*"  end="\*/" contains=gpTodo
44syntax match  gpComment "\\\\.*" contains=gpTodo
45syntax keyword gpTodo contained	TODO
46syntax sync ccomment gpComment minlines=10
47
48"catch errors caused by wrong parenthesis
49syntax region gpParen		transparent start='(' end=')' contains=ALLBUT,gpParenError,gpTodo,gpFunction,gpArgs,gpSpecial
50syntax match gpParenError	")"
51syntax match gpInParen contained "[{}]"
52
53if version >= 508 || !exists("did_gp_syn_inits")
54  if version < 508
55    let did_gp_syn_inits = 1
56    command -nargs=+ HiLink hi link <args>
57  else
58    command -nargs=+ HiLink hi def link <args>
59  endif
60
61  HiLink gpConditional		Conditional
62  HiLink gpRepeat		Repeat
63  HiLink gpError		Error
64  HiLink gpParenError		gpError
65  HiLink gpInParen		gpError
66  HiLink gpStatement		Statement
67  HiLink gpString		String
68  HiLink gpComment		Comment
69  HiLink gpInterface		Type
70  HiLink gpInput		Type
71  HiLink gpInterfaceKey		Statement
72  HiLink gpFunction		Function
73  HiLink gpScope		Type
74  " contained ones
75  HiLink gpSpecial		Special
76  HiLink gpTodo			Todo
77  HiLink gpArgs			Type
78  delcommand HiLink
79endif
80
81let b:current_syntax = "gp"
82" vim: ts=8
83