feat(syntax_highlighting): add the catala_pl.vim file

This commit is contained in:
EmileRolley 2021-06-01 10:53:49 +02:00
parent 909f04b8af
commit ed73be5abf
5 changed files with 67 additions and 6 deletions

View File

@ -20,4 +20,4 @@ zakres Test_A7_U1_P1_PPb:
definicja sprzedaz.inne_prawa_majatkowe wynosi prawda
asercja sprzedaz.podatek = 1 PLN
```
```

View File

@ -20,4 +20,4 @@ zakres Test_A7_U1_P2_PPb:
definicja sprzedaz.inne_prawa_majatkowe wynosi prawda
asercja sprzedaz.podatek = 1 PLN
```
```

View File

@ -34,7 +34,7 @@ syn match Number contained "\<\([0-9]\+\(,[0.9]*\|\)\)\>"
syn keyword Boolean contained true false
syn match Operator contained "\(->\|+\.\|+@\|+\^\|+\$\|+\|-\.\|-@\|-\^\|-\$\|-\|\*\.\|\*@\|\*\^\|\*\$\|\*\|/\.\|/@\|/\^\|/\$\|/\|\!\|>\.\|>=\.\|<=\.\|<\.\|>@\|>=@\|<=@\|<@\|>\$\|>=\$\|<=\$\|<\$\|>\^\|>=\^\|<=\^\|<\^\|>\|>=\|<=\|<\|=\|not\|or\|xor\|and\|\$\|%\|an\|year\|day\)"
syn match punctuation contained "\(--\|\;\|\.\|\,\|\:\|(\|)\|\[\|\]\|{\|}\)"
syn keyword Structure contained integer boolean date duration money text decimal number sum
syn keyword Type contained integer boolean date duration money text decimal number sum
syn region ctxt contained
\ matchgroup=Keyword start="\<context"
@ -56,7 +56,7 @@ syntax sync match codeSync grouphere code "```catala"
hi link sc_id_def Identifier
hi link sc_id Function
hi link cc_id Type
hi link cc_id Structure
hi link punctuation Ignore
let b:current_syntax = "catala_en"

View File

@ -34,7 +34,7 @@ syn keyword Boolean contained vrai faux
" (EmileRolley) NOTE: maybe special characters such as '€' should be encoded differently.
syn match Operator contained "\(->\|+\.\|+@\|+\^\|+€\|+\|-\.\|-@\|-\^\|-€\|-\|\*\.\|\*@\|\*\^\|\*€\|\*\|/\.\|/@\|/\^\|/€\|/\|\!\|>\.\|>=\.\|<=\.\|<\.\|>@\|>=@\|<=@\|<@\|>€\|>=€\|<=€\|<€\|>\^\|>=\^\|<=\^\|<\^\|>\|>=\|<=\|<\|=\|non\|ou\s\+bien\|ou\|et\|€\|%\|an\|mois\|jour\)"
syn match punctuation contained "\(--\|\;\|\.\|\,\|\:\|(\|)\|\[\|\]\|{\|}\)"
syn keyword Structure contained entier booléen date durée argent texte décimal décret loi nombre somme
syn keyword Type contained entier booléen date durée argent texte décimal décret loi nombre somme
syn region ctxt contained
\ matchgroup=Keyword start="\<contexte"
@ -56,7 +56,7 @@ syntax sync match codeSync grouphere code "```catala"
hi link sc_id_def Identifier
hi link sc_id Function
hi link cc_id Type
hi link cc_id Structure
hi link punctuation Ignore
let b:current_syntax = "catala_fr"

View File

@ -0,0 +1,61 @@
" In order to enable the syntax highlighting:
"
" 1. Copy or link the current file into $VIMCONFIG/syntax
"
" 2. Enable file type detection by adding to $VIMCONFIG/filetype.vim:
"
" augroup filetypedetect
" au! BufRead,BufNewFile *.catala_en setfiletype catala_en
" augroup END
"
" More informations could be found at:
"
" https://elias.rhi.hi.is/vim/syntax.html#:syn-files
"
if exists("b:current_syntax")
finish
endif
syn match PreProc "^\s*#.*$"
syn match Include "^\s*>\s*Include:.*$"
syn match Define "^\s*>\s*\(Begin\|End\)\s\+metadata\s*$"
syn match sc_id_def contained "\<\([a-zéèàâùîôêœç][a-zéèàâùîôêœçA-ZÉÈÀÂÙÎÔÊŒÇ0-9_\']*\)\>"
syn match cc_id contained "\<\([A-ZÉÈÀÂÙÎÔÊŒÇ][a-zéèàâùîôêœçA-ZÉÈÀÂÙÎÔÊŒÇ0-9_\']*\)\>"
syn match Keyword contained "\<\(zakres\|zalezy\s\+od\|deklaracja\|kolekcja\|typu\|opcjonalny\|struktura\|enumeracja\|kontekst\|zasada\|pod\s\+warunkuem\|czas\|konsekwencja\|spelnione\|wynosi\|asercja\|definicja\|etykieta\|wyjątek\)\>"
syn match Statement contained "\<\(pasuje\|ze\s\+wzorem\|staloprzecinkowa\|przez\|malejacy\|rosnacy\|rozna\|wraz z\|mamy\|w\|takich ze\|istnieje\|dla\|wszystkie\|z\|jezeli\|wtedy\|inaczej\|poczatkowy\)\>"
syn keyword Conditional contained if then else
syn match Comment contained "#.*$"
syn match Number contained "|[0-9]\+-[0-9]\+-[0-9]\+|"
syn match Number contained "\<\([0-9]\+\(,[0.9]*\|\)\)\>"
syn keyword Boolean contained prawda falsz
syn match Operator contained "\(->\|+\.\|+@\|+\^\|+\$\|+\|-\.\|-@\|-\^\|-\$\|-\|\*\.\|\*@\|\*\^\|\*\$\|\*\|/\.\|/@\|/\^\|/\$\|/\|\!\|>\.\|>=\.\|<=\.\|<\.\|>@\|>=@\|<=@\|<@\|>\$\|>=\$\|<=\$\|<\$\|>\^\|>=\^\|<=\^\|<\^\|>\|>=\|<=\|<\|=\|nie\|lub\|xor\|i\|\$\|%\|rok\|miesiac\|dzien\)"
syn match punctuation contained "\(--\|\;\|\.\|\,\|\:\|(\|)\|\[\|\]\|{\|}\)"
syn keyword Type contained calkowita zerojedynkowy czas trwania pieniądze warunek tekst dziesiętny suma
syn region ctxt contained
\ matchgroup=Keyword start="\<kontekst"
\ matchgroup=sc_id_def end="\s\+\([a-zéèàâùîôêœç][a-zéèàâùîôêœçA-ZÉÈÀÂÙÎÔÊŒÇ0-9_\']*\)\>"
syn region cc_id_dot_sc_id contained contains=punctuation
\ matchgroup=cc_id start="\<\([A-ZÉÈÀÂÙÎÔÊŒÇ][a-zéèàâùîôêœçA-ZÉÈÀÂÙÎÔÊŒÇ0-9_\']*\)\."rs=e-1
\ matchgroup=sc_id_def end="\([a-zéèàâùîôêœç][a-zéèàâùîôêœçA-ZÉÈÀÂÙÎÔÊŒÇ0-9_\']*\)\>"
syn region sc_id_def_dot_sc_id contained contains=punctuation
\ matchgroup=sc_id_def start="\<\([a-zéèàâùîôêœç][a-zéèàâùîôêœçA-ZÉÈÀÂÙÎÔÊŒÇ0-9_\']*\)\."rs=e-1
\ matchgroup=sc_id end="\([a-zéèàâùîôêœç][a-zéèàâùîôêœçA-ZÉÈÀÂÙÎÔÊŒÇ0-9_\']*\)\>"
syn region code transparent matchgroup=Ignore start="```catala" matchgroup=Ignore end="```"
\ contains=ALLBUT, PreProc, Include, Define
" Synchronizes the position where redrawing start at the start of a code block.
syntax sync match codeSync grouphere code "```catala"
hi link sc_id_def Identifier
hi link sc_id Function
hi link cc_id Structure
hi link punctuation Ignore
let b:current_syntax = "catala_pl"