Ian Jauslin
summaryrefslogtreecommitdiff
blob: bf94c0db5576c7d72b0183e4a966667f24013281 (plain)
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
" Vim syntax file
" Language:     meankondo
" Maintainer:   Ian Jauslin <ian.jauslin@roma1.infn.it>
" Last Change:  2022-06-06
" URL:          http://ian.jauslin.org/software/meankondo
"

if exists("b:current_syntax")
  finish
endif

" Comments
syn match Comment '#.*'

" Regions
syn region FieldsRegion        matchgroup=configHeader start='#!fields'                 end='&' transparent contains=Comment,Separator,FieldHeader,FieldInField,Equal
syn region VariablesRegion    matchgroup=configHeader start='#!preprocessor_variables' end='&' transparent contains=@Globals,VariableHeader
syn region IdTableRegion      matchgroup=configHeader start='#!id_table'               end='&' transparent contains=@Globals,RegionHeader
syn region SymbolsRegion      matchgroup=configHeader start='#!symbols'                end='&' transparent contains=@Globals,VariableHeader
syn region PolynomialRegion   matchgroup=configHeader start='#!input_polynomial'       end='&' transparent
syn region PolynomialRegion   matchgroup=configHeader start='#!postprocess_operation'       end='&' transparent
syn region PolynomialRegion   matchgroup=configHeader start='#!postprocess_flow_equation'       end='&' transparent
syn region PolynomialRegion   matchgroup=configHeader start='#!numerical_postprocess_operation'       end='&' transparent
syn region PropagatorRegion   matchgroup=configHeader start='#!propagator'             end='&' transparent contains=Comment,Number,NumberBase,Separator,FieldInProp,Equal,NumberInProp
syn region IdentitiesRegion   matchgroup=configHeader start='#!identities'             end='&' transparent
syn region GroupsRegion       matchgroup=configHeader start='#!groups'                 end='&' transparent contains=Comment,Separator,FieldHeader,FieldInField,Equal,GroupParenthesis
syn region LabelsRegion       matchgroup=configHeader start='#!labels'                 end='&' transparent contains=String,RegionHeader,Separator,Comment,Equal
syn region FlowEquationRegion matchgroup=configHeader start='#!flow_equation'          end='&' transparent
syn region InitCdRegion       matchgroup=configHeader start='#!initial_condition'      end='&' transparent contains=Comment,Separator,RegionHeader,Equal,NumberInInit,InitHeader
syn region DerivVarsRegion    matchgroup=configHeader start='#!variables'              end='&' transparent  contains=Comment,Separator,FieldHeader,FieldInField,Equal,VarAll

" Generic syntax
syn match Field '\[f[-0-9]\+\]'
syn match Factor '\[l[-0-9]\+\]'
syn match Factor '\[d*% *[-0-9]\+\]' contains=Deriv
syn match ConstantF '\[d*C *[0-9]\+\]' contains=Deriv
syn match ConstantD '\[/C *[0-9]\+ *\^ *[0-9]\+\]'
syn match Deriv 'd' contained
syn match Variables '\$[^>]*'
syn match Number '<[-/0-9]*>'
syn match Number '([-/0-9]*)'
syn match NumberBase 's{[-/0-9]*}'
syn match NumberBase '(s{[-/0-9]*})'
syn match Operator '[*+]'
syn match Operator '%exp'
syn match Operator '%log_1'
syn match Separator ','
syn match Equal '[:=]'

syn cluster Globals contains=Comment,Field,Factor,Constant,Variables,Number,NumberBase,Operator,Separator,Equal

" Fields
syn keyword FieldHeader i contained
syn keyword FieldHeader x contained
syn keyword FieldHeader h contained
syn keyword FieldHeader f contained
syn keyword FieldHeader a contained
syn match FieldInField '[-0-9]\+' contained

" Variables
syn match VariableHeader '^[^=,]*='he=e-1 contained contains=Equal

" Groups
syn match GroupParenthesis '[()]' contained

" Propagator
syn match FieldInProp '[0-9]\+ *[;:]'he=e-1 contained contains=Equal,NumberInProp
syn match NumberInProp ': *[-/()0-9s{}]*'hs=s+1 contained

" IdTable
syn match RegionHeader '[0-9]\+:'he=e-1 contained contains=Equal

" Labels
syn match String '"[^"]*"'hs=s+1,he=e-1 contained

" Initial condition
syn match InitHeader '[0-9]\+:'he=e-1 contained contains=Equal,NumberInInit
syn match NumberInInit ': *[-.e0-9]*'hs=s+1 contained

" Variables
syn keyword VarAll all contained


" Colors
hi Comment         ctermfg=cyan
hi configHeader    ctermfg=red
hi Field           ctermfg=Lightblue
hi Factor          ctermfg=Lightblue
hi ConstantF       ctermfg=Lightblue
hi ConstantD       ctermfg=Lightgreen
hi Deriv           ctermfg=red
hi Header          ctermfg=Lightgreen
hi Variables       ctermfg=yellow
hi Number          ctermfg=green
hi NumberBase      ctermfg=green
hi Separator       ctermfg=red
hi Equal           ctermfg=Lightred
hi Operator        ctermfg=magenta
hi String          ctermfg=magenta
hi NumberInInit    ctermfg=magenta

hi def link FieldInField     Field
hi def link VariableHeader   Variables
hi def link FieldInProp      Field
hi def link FieldHeader      Header
hi def link NumberInProp     Number
hi def link SeparatorInProp  Separator
hi def link RegionHeader     Header
hi def link InitHeader       Header
hi def link GroupParenthesis Separator
hi def link VarAll           Field