meankondo/editors/vim/syntax/meankondo.vim

112 lines
4.8 KiB
VimL
Raw Normal View History

" 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