Update to new symantic and draft Modules rendition.
[comptalang.git] / vim / syntax / ledger.vim
index a7a664d32d3e395f14acd664caf13e8aa04479e1..09c1ac11852565deb57d57c75c29ecc157e34767 100644 (file)
@@ -12,34 +12,49 @@ syn clear
 syn sync fromstart
 syn sync linebreaks=1
 
-syn match  ledgerComment              ";.*"
-syn match  ledgerNumberOdd            /[0-9][0-9]*/ contained
-syn match  ledgerNumber               /[0-9][0-9]*/ contained
-syn match  ledgerAccountSeparator     ":"           contained
-syn match  ledgerAccountSeparatorOdd  ":"           contained
-syn match  ledgerAccountParen         /[()]/        contained
-syn match  ledgerAccountParenOdd      /[()]/        contained
-syn match  ledgerAccountBracket       /[[\]]/       contained
-syn match  ledgerAccountBracketOdd    /[[\]]/       contained
+syn match  ledgerNumberOdd              /[0-9][0-9]*/ contained
+syn match  ledgerNumber                 /[0-9][0-9]*/ contained
+syn match  ledgerAccountSep             ":"           contained
+syn match  ledgerAccountSepOdd          ":"           contained
+syn match  ledgerAccountParen           /[()]/        contained
+syn match  ledgerAccountParenOdd        /[()]/        contained
+syn match  ledgerAccountBracket         /[[\]]/       contained
+syn match  ledgerAccountBracketOdd      /[[\]]/       contained
+syn region ledgerDirective              start=/^[A-Z]\s/  end=/^/ contains=ledgerComment
+syn region ledgerInclude                start=/^!include/ end=/^/
 
-syn region ledgerInclude   start=/^!include/ end=/^/
-syn region ledgerDirective start=/^[A-Z]/    end=/^/ contains=ledgerComment
+syn region ledgerChart                  start=/^\([^0-9        !][^    ]\|\d\+[^/-]\|[^        ;!]$\)/ end=/^\(\s*$\|\d\+[/-]\)/me=e-5
+syn match  ledgerChartAccount           "^[^:;         ]\([^;  ]\| [^;         ]\+\)*" contained containedin=ledgerChart contains=ledgerChartAccountSep,ledgerChartNumber
+syn match  ledgerChartComment           ";.*"                             contained containedin=ledgerChart,ledgerChartLine
+syn match  ledgerChartAccountSep        ":"                               contained
+syn match  ledgerChartNumber            /[0-9][0-9]*/                     contained
+syn region ledgerChartLine              start=/^\s\+[^;        ]/ end=/^\(\s[^         ;]\|[^  ]\)/me=e-2 contained containedin=ledgerChart nextgroup=ledgerChartLine
+syn match  ledgerChartTag               /^[^;, :]\+\(:[^:;,]*\)*/                              contained containedin=ledgerChartLine nextgroup=ledgerChartTagValue
+syn match  ledgerChartTagValueSep       ":"                                                    contained containedin=ledgerChartTagValue,ledgerChartTagValueEnd,ledgerChartTag
+syn match  ledgerChartTagValueEnd       /[^;,  :]:[^;:]*\(\s\|;\)/ms=s+1,me=e-1               contained containedin=ledgerChartTag
+syn match  ledgerChartTagValue          /[^;,  :]:[^;:]\+$/ms=s+1                             contained containedin=ledgerChartTag
 
-syn region ledgerTransaction            start=/^\d[^   ]\+/ end=/^\s*$/
-syn match  ledgerTransactionHead        "^[0-9/-]\+\( [0-9:]\+\)\?\(=[0-9/-]\+\( [0-9:]\+\)\?\)\?\(\s\+[!*]\)\?" contained containedin=ledgerTransaction nextgroup=ledgerTransactionDescription
-syn match  ledgerTransactionDate        "[0-9/-]\+\( [0-9:]\+\)\?" contained containedin=ledgerTransactionHead
-syn match  ledgerTransactionDescription "\s[^;]\+"ms=s+1           contained containedin=ledgerTransaction
-syn match  ledgerTransactionComment     ";.*"                      contained containedin=ledgerTransaction,ledgerPosting,ledgerPostingOdd
+syn region ledgerTransaction            start=/^\d\+[/-]/ end=/^\([^   ;]\)/me=e-1
+syn match  ledgerTransactionDate        "^\(\d\+/\)\?\d\d\?/\d\d\?\(_[0-9:]\+\(_\?[A-Z]\+\|[+-]\d\d\d\d\)\?\)\?" contained containedin=ledgerTransaction nextgroup=ledgerTransactionStatus
+syn match  ledgerTransactionStatus      "\(\s\+[!*]\)\?"                                                         contained nextgroup=ledgerTransactionDescription
+syn match  ledgerTransactionDateNum     "\d\+"                                                                   contained containedin=ledgerTransactionDate
+syn match  ledgerTransactionDateSep     "[/+_:-]"                                                                contained containedin=ledgerTransactionDate
+syn match  ledgerTransactionDescription ".*"                                                                     contained
+syn match  ledgerTransactionComment     ";.*"                                                                    contained containedin=ledgerTransaction,ledgerPosting,ledgerPostingOdd,ledgerTransactionDate,ledgerTransactionStatus,ledgerTransactionDescription
 
-syn match  ledgerPostingAmountOdd   "  \(\s*[^; ]\+\)\+"ms=s+0            contained containedin=ledgerPostingOdd  contains=ledgerNumberOdd
-syn match  ledgerPostingAmount      "  \(\s*[^; ]\+\)\+"ms=s+0            contained containedin=ledgerPosting     contains=ledgerNumber
-syn match  ledgerPostingAccountOdd  "^\s\+[^;  ]\([^;  ]\|\s[^;        ]\+\)*" contained containedin=ledgerPostingOdd  nextgroup=ledgerPostingAmountOdd contains=ledgerNumberOdd,ledgerAccountSeparatorOdd,ledgerAccountParenOdd,ledgerAccountBracketOdd
-syn match  ledgerPostingAccount     "^\s\+[^;  ]\([^;  ]\|\s[^;        ]\+\)*" contained containedin=ledgerPosting     nextgroup=ledgerPostingAmount    contains=ledgerNumber,ledgerAccountSeparator,ledgerAccountParen,ledgerAccountBracket
-syn region ledgerPostingOdd         start=/^\s\+[^;    ]/ end=/^/          contained containedin=ledgerTransaction nextgroup=ledgerPosting
-syn region ledgerPosting            start=/^\s\+[^;    ]/ end=/^/          contained containedin=ledgerTransaction nextgroup=ledgerPostingOdd
+syn match  ledgerPostingAmountOdd       "\( \s\|       \)\(\s*[^; ]\+\)\+"ms=s+0                             contained containedin=ledgerPostingOdd  contains=ledgerNumberOdd
+syn match  ledgerPostingAmount          "\( \s\|       \)\(\s*[^; ]\+\)\+"ms=s+0                             contained containedin=ledgerPosting     contains=ledgerNumber
+syn match  ledgerPostingAccountOdd      "^\s\+[^;      ]\([^;  ]\|\s[^;        ]\+\)*"                  contained containedin=ledgerPostingOdd  nextgroup=ledgerPostingAmountOdd contains=ledgerNumberOdd,ledgerAccountSepOdd,ledgerAccountParenOdd,ledgerAccountBracketOdd
+syn match  ledgerPostingAccount         "^\s\+[^;      ]\([^;  ]\| [^;         ]\+\)*"                  contained containedin=ledgerPosting     nextgroup=ledgerPostingAmount    contains=ledgerNumber,ledgerAccountSep,ledgerAccountParen,ledgerAccountBracket
+syn region ledgerPostingOdd             start=/^\s\+[^;        ]/ end=/^\(\s\+[^       ;]\|[^  ]\)/me=e-99 contained containedin=ledgerTransaction nextgroup=ledgerPosting
+syn region ledgerPosting                start=/^\s\+[^;        ]/ end=/^\(\s\+[^       ;]\|[^  ]\)/me=e-99 contained containedin=ledgerTransaction nextgroup=ledgerPostingOdd
 
-syn match  ledgerTag      /[^;, :]\+:[^;,]*/     contained containedin=ledgerTransactionComment nextgroup=ledgerTagValue
-syn match  ledgerTagValue /[^;, :]:[^,;]*/ms=s+2 contained containedin=ledgerTag
+syn match  ledgerTag                    /[^;, :]\+:[^;,]*/            contained containedin=ledgerTransactionComment nextgroup=ledgerTagValue,ledgerTagValueEnd
+syn match  ledgerTagValueSep            /:/                           contained containedin=ledgerTagValue,ledgerTagValueEnd,ledgerTag
+syn match  ledgerTagValue               /[^;, :]:[^:]*,/ms=s+1,me=e-1 contained containedin=ledgerTag
+syn match  ledgerTagValueEnd            /[^;, :]:[^:]*$/ms=s+1        contained containedin=ledgerTag
+
+syn match  ledgerComment                ";.*"
 
 if version >= 508 || !exists("did_ledger_syntax_inits")
        if version < 508
@@ -48,33 +63,45 @@ if version >= 508 || !exists("did_ledger_syntax_inits")
        else
                command! -nargs=+ HiLink hi def link <args>
         endif
-       hi SpecialKey                                                                     gui=bold                      guifg=lightgoldenrod
-       hi Comment                       term=bold      cterm=bold ctermfg=6 ctermbg=0    gui=bold guifg=#4169E1
+       HiLink ledgerChartComment       Comment
+       HiLink ledgerComment            Comment
+       HiLink ledgerTransactionComment Comment
        hi Comment                       term=bold      cterm=bold ctermfg=6 ctermbg=0    gui=bold guifg=#4169E1
-       HiLink ledgerComment Comment
-       hi ledgerInclude                 term=bold      cterm=bold                        gui=bold
-       hi ledgerDirective               term=bold      cterm=bold                        gui=bold
-       hi ledgerAccountSeparatorOdd     term=bold      cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=DarkGoldenrod2 guibg=gray90
-       hi ledgerAccountParenOdd         term=bold      cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=DarkGoldenrod2 guibg=gray90
-       hi ledgerAccountBracketOdd       term=bold      cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=DarkGoldenrod2 guibg=gray90
-       hi ledgerAccountSeparator        term=bold      cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=DarkGoldenrod2 guibg=lightgreen
-       hi ledgerAccountParen            term=bold      cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=DarkGoldenrod2 guibg=lightgreen
        hi ledgerAccountBracket          term=bold      cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=DarkGoldenrod2 guibg=lightgreen
-       hi ledgerNumberOdd               term=bold      cterm=bold ctermfg=4 ctermbg=none gui=bold guifg=blue           guibg=gray90
+       hi ledgerAccountBracketOdd       term=bold      cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=DarkGoldenrod2 guibg=#F4F2E2
+       hi ledgerAccountParen            term=bold      cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=DarkGoldenrod2 guibg=lightgreen
+       hi ledgerAccountParenOdd         term=bold      cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=DarkGoldenrod2 guibg=#F4F2E2
+       hi ledgerAccountSep              term=bold      cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=#C4451D        guibg=lightgreen
+       hi ledgerAccountSepOdd           term=bold      cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=#C4451D        guibg=#F4F2E2
+       hi ledgerChart                   term=underline cterm=bold ctermfg=0 ctermbg=none gui=bold guifg=red            guibg=NONE
+       hi ledgerChartLine                              cterm=bold           ctermbg=none                               guibg=NONE
+       hi ledgerChartAccount            term=underline cterm=bold ctermfg=0 ctermbg=none gui=bold guifg=black          guibg=#F4F2E2
+       hi ledgerChartAccountSep         term=bold      cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=#C4451D        guibg=#F4F2E2
+       hi ledgerChartNumber             term=underline cterm=bold ctermfg=4 ctermbg=none gui=bold guifg=blue           guibg=#F4F2E2
+       hi ledgerDirective               term=bold      cterm=bold                        gui=bold
+       hi ledgerInclude                 term=bold      cterm=bold                        gui=bold
        hi ledgerNumber                  term=bold      cterm=bold ctermfg=4 ctermbg=none gui=bold guifg=blue           guibg=lightgreen
-       hi ledgerPostingOdd                             cterm=bold           ctermbg=none                               guibg=NONE
+       hi ledgerNumberOdd               term=bold      cterm=bold ctermfg=4 ctermbg=none gui=bold guifg=blue           guibg=#F4F2E2
        hi ledgerPosting                                cterm=bold           ctermbg=none                               guibg=NONE
-       hi ledgerPostingAccountOdd       term=underline cterm=bold ctermfg=0 ctermbg=none          guifg=gray30         guibg=gray90
-       hi ledgerPostingAccount          term=underline cterm=bold ctermfg=0 ctermbg=none          guifg=gray30         guibg=lightgreen
-       hi ledgerPostingAmountOdd                       cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=DarkGoldenrod2 guibg=gray90
-       hi ledgerPostingAmount                          cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=DarkGoldenrod2 guibg=lightgreen
+       hi ledgerPostingAccount          term=underline cterm=bold ctermfg=0 ctermbg=none          guifg=black          guibg=lightgreen
+       hi ledgerPostingAccountOdd       term=underline cterm=bold ctermfg=0 ctermbg=none          guifg=black          guibg=#F4F2E2
+       hi ledgerPostingAmount                          cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=#C4451D        guibg=lightgreen
+       hi ledgerPostingAmountOdd                       cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=#C4451D        guibg=#F4F2E2
+       hi ledgerPostingOdd                             cterm=bold           ctermbg=none                               guibg=NONE
        hi ledgerTag                     term=bold      cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=orange
-       hi ledgerTagValue                term=bold      cterm=bold ctermfg=1 ctermbg=none gui=NONE guifg=red
-       hi ledgerTransaction                            cterm=bold           ctermbg=none gui=bold
-       hi ledgerTransactionComment      term=bold      cterm=bold ctermfg=6 ctermbg=none gui=bold guifg=#4169E1
-       hi ledgerTransactionDate                        cterm=bold ctermfg=5 ctermbg=none gui=bold                      guibg=lightgoldenrod
-       hi ledgerTransactionDescription                 cterm=bold ctermfg=5 ctermbg=none gui=bold
-       hi ledgerTransactionHead         term=bold      cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=purple         guibg=lightgoldenrod
+       hi ledgerTagValue                term=bold      cterm=bold ctermfg=1 ctermbg=none gui=NONE guifg=grey30
+       hi ledgerTagValueEnd             term=bold      cterm=bold ctermfg=1 ctermbg=none gui=NONE guifg=grey30
+       hi ledgerTagValueSep             term=bold      cterm=bold ctermfg=0 ctermbg=none gui=bold guifg=#C4451D
+       hi ledgerChartTag                term=bold      cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=orange         guibg=NONE
+       hi ledgerChartTagValue           term=bold      cterm=bold ctermfg=1 ctermbg=none gui=NONE guifg=grey30         guibg=NONE
+       hi ledgerChartTagValueEnd        term=bold      cterm=bold ctermfg=1 ctermbg=none gui=NONE guifg=gray30         guibg=NONE
+       hi ledgerChartTagValueSep        term=bold      cterm=bold ctermfg=0 ctermbg=none gui=bold guifg=#C4451D        guibg=NONE
+       hi ledgerTransaction                            cterm=bold           ctermbg=none gui=bold guifg=red
+       hi ledgerTransactionDate                        cterm=bold ctermfg=5 ctermbg=none gui=bold guifg=#000080        guibg=lightgoldenrod
+       hi ledgerTransactionDateNum                     cterm=bold ctermfg=5 ctermbg=none gui=bold guifg=black          guibg=lightgoldenrod
+       hi ledgerTransactionDateSep                     cterm=bold ctermfg=5 ctermbg=none gui=bold guifg=#C4451D        guibg=lightgoldenrod
+       hi ledgerTransactionDescription                 cterm=bold ctermfg=5 ctermbg=none gui=bold guifg=#C4451D
+       hi ledgerTransactionStatus       term=bold      cterm=bold ctermfg=3 ctermbg=none gui=bold guifg=DarkGoldenrod2
        delcommand HiLink
  endif