Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
Karim Belabas | c6d533b | 2023-08-22 20:25:06 +0200 | [diff] [blame] | 2 | " Language: gp (version 2.15) |
Bram Moolenaar | 18144c8 | 2006-04-12 21:52:12 +0000 | [diff] [blame] | 3 | " Maintainer: Karim Belabas <Karim.Belabas@math.u-bordeaux.fr> |
Karim Belabas | c6d533b | 2023-08-22 20:25:06 +0200 | [diff] [blame] | 4 | " Last change: 2023 Aug 22 |
Bram Moolenaar | 18144c8 | 2006-04-12 21:52:12 +0000 | [diff] [blame] | 5 | " URL: http://pari.math.u-bordeaux.fr |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 6 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 7 | " quit when a syntax file was already loaded |
| 8 | if exists("b:current_syntax") |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 9 | finish |
| 10 | endif |
| 11 | |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 12 | let s:cpo_save = &cpo |
| 13 | set cpo&vim |
| 14 | |
Bram Moolenaar | 18144c8 | 2006-04-12 21:52:12 +0000 | [diff] [blame] | 15 | " control statements |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 16 | syntax keyword gpStatement break return next |
Karim Belabas | c6d533b | 2023-08-22 20:25:06 +0200 | [diff] [blame] | 17 | syntax keyword gpConditional if iferr |
| 18 | syntax keyword gpRepeat until while for forcomposite fordiv |
| 19 | syntax keyword gpRepeat fordivfactored foreach forell forfactored |
| 20 | syntax keyword gpRepeat forpart forperm forprime forprimestep forqfvec |
| 21 | syntax keyword gpRepeat forsquarefree forstep forsubgroup forsubset |
| 22 | syntax keyword gpRepeat forvec |
| 23 | syntax keyword gpRepeat parfor parforeach parforprime parforprimestep |
| 24 | syntax keyword gpRepeat parforvec |
Bram Moolenaar | 18144c8 | 2006-04-12 21:52:12 +0000 | [diff] [blame] | 25 | " storage class |
Karim Belabas | c6d533b | 2023-08-22 20:25:06 +0200 | [diff] [blame] | 26 | syntax keyword gpScope my local global export exportall |
Bram Moolenaar | 18144c8 | 2006-04-12 21:52:12 +0000 | [diff] [blame] | 27 | " defaults |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 28 | syntax keyword gpInterfaceKey breakloop colors compatible |
Karim Belabas | c6d533b | 2023-08-22 20:25:06 +0200 | [diff] [blame] | 29 | syntax keyword gpInterfaceKey datadir debug debugfiles debugmem |
| 30 | syntax keyword gpInterfaceKey echo factor_add_primes factor_proven format |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 31 | syntax keyword gpInterfaceKey graphcolormap graphcolors |
Karim Belabas | c6d533b | 2023-08-22 20:25:06 +0200 | [diff] [blame] | 32 | syntax keyword gpInterfaceKey help histfile histsize |
| 33 | syntax keyword gpInterfaceKey lines linewrap log logfile nbthreads |
| 34 | syntax keyword gpInterfaceKey new_galois_format output parisize parisizemax |
| 35 | syntax keyword gpInterfaceKey path plothsizes prettyprinter primelimit prompt |
| 36 | syntax keyword gpInterfaceKey prompt_cont psfile readline realbitprecision |
| 37 | syntax keyword gpInterfaceKey realprecision recover secure seriesprecision |
| 38 | syntax keyword gpInterfaceKey simplify sopath strictmatch TeXstyle |
| 39 | syntax keyword gpInterfaceKey threadsize threadsizemax timer |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 40 | |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 41 | syntax match gpInterface "^\s*\\[a-z].*" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 42 | syntax keyword gpInterface default |
| 43 | syntax keyword gpInput read input |
| 44 | |
| 45 | " functions |
| 46 | syntax match gpFunRegion "^\s*[a-zA-Z][_a-zA-Z0-9]*(.*)\s*=\s*[^ \t=]"me=e-1 contains=gpFunction,gpArgs |
| 47 | syntax match gpFunRegion "^\s*[a-zA-Z][_a-zA-Z0-9]*(.*)\s*=\s*$" contains=gpFunction,gpArgs |
| 48 | syntax match gpArgs contained "[a-zA-Z][_a-zA-Z0-9]*" |
| 49 | syntax match gpFunction contained "^\s*[a-zA-Z][_a-zA-Z0-9]*("me=e-1 |
| 50 | |
| 51 | " String and Character constants |
| 52 | " Highlight special (backslash'ed) characters differently |
| 53 | syntax match gpSpecial contained "\\[ent\\]" |
| 54 | syntax region gpString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=gpSpecial |
| 55 | |
| 56 | "comments |
| 57 | syntax region gpComment start="/\*" end="\*/" contains=gpTodo |
| 58 | syntax match gpComment "\\\\.*" contains=gpTodo |
| 59 | syntax keyword gpTodo contained TODO |
| 60 | syntax sync ccomment gpComment minlines=10 |
| 61 | |
| 62 | "catch errors caused by wrong parenthesis |
| 63 | syntax region gpParen transparent start='(' end=')' contains=ALLBUT,gpParenError,gpTodo,gpFunction,gpArgs,gpSpecial |
| 64 | syntax match gpParenError ")" |
| 65 | syntax match gpInParen contained "[{}]" |
| 66 | |
Karim Belabas | c6d533b | 2023-08-22 20:25:06 +0200 | [diff] [blame] | 67 | hi def link gpConditional Conditional |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 68 | hi def link gpRepeat Repeat |
| 69 | hi def link gpError Error |
Karim Belabas | c6d533b | 2023-08-22 20:25:06 +0200 | [diff] [blame] | 70 | hi def link gpParenError gpError |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 71 | hi def link gpInParen gpError |
| 72 | hi def link gpStatement Statement |
| 73 | hi def link gpString String |
| 74 | hi def link gpComment Comment |
| 75 | hi def link gpInterface Type |
| 76 | hi def link gpInput Type |
Karim Belabas | c6d533b | 2023-08-22 20:25:06 +0200 | [diff] [blame] | 77 | hi def link gpInterfaceKey Statement |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 78 | hi def link gpFunction Function |
| 79 | hi def link gpScope Type |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 80 | " contained ones |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 81 | hi def link gpSpecial Special |
Karim Belabas | c6d533b | 2023-08-22 20:25:06 +0200 | [diff] [blame] | 82 | hi def link gpTodo Todo |
| 83 | hi def link gpArgs Type |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 84 | |
| 85 | let b:current_syntax = "gp" |
Bram Moolenaar | 6be7f87 | 2012-01-20 21:08:56 +0100 | [diff] [blame] | 86 | let &cpo = s:cpo_save |
| 87 | unlet s:cpo_save |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 88 | " vim: ts=8 |