Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Lout |
| 3 | " Maintainer: Christian V. J. Brüssow <cvjb@cvjb.de> |
| 4 | " Last Change: Son 22 Jun 2003 20:43:26 CEST |
| 5 | " Filenames: *.lout,*.lt |
| 6 | " URL: http://www.cvjb.de/comp/vim/lout.vim |
Bram Moolenaar | 5c73622 | 2010-01-06 20:54:52 +0100 | [diff] [blame] | 7 | " $Id: lout.vim,v 1.1 2004/06/13 17:52:18 vimboss Exp $ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 8 | " |
| 9 | " Lout: Basser Lout document formatting system. |
| 10 | |
| 11 | " For version 5.x: Clear all syntax items |
| 12 | " For version 6.x: Quit when a syntax file was already loaded |
| 13 | if version < 600 |
| 14 | syntax clear |
| 15 | elseif exists("b:current_syntax") |
| 16 | finish |
| 17 | endif |
| 18 | |
| 19 | " Lout is case sensitive |
| 20 | syn case match |
| 21 | |
| 22 | " Synchronization, I know it is a huge number, but normal texts can be |
| 23 | " _very_ long ;-) |
| 24 | syn sync lines=1000 |
| 25 | |
| 26 | " Characters allowed in keywords |
| 27 | " I don't know if 128-255 are allowed in ANS-FORHT |
| 28 | if version >= 600 |
| 29 | setlocal iskeyword=@,48-57,.,@-@,_,192-255 |
| 30 | else |
| 31 | set iskeyword=@,48-57,.,@-@,_,192-255 |
| 32 | endif |
| 33 | |
| 34 | " Some special keywords |
| 35 | syn keyword loutTodo contained TODO lout Lout LOUT |
| 36 | syn keyword loutDefine def macro |
| 37 | |
| 38 | " Some big structures |
| 39 | syn keyword loutKeyword @Begin @End @Figure @Tab |
| 40 | syn keyword loutKeyword @Book @Doc @Document @Report |
| 41 | syn keyword loutKeyword @Introduction @Abstract @Appendix |
| 42 | syn keyword loutKeyword @Chapter @Section @BeginSections @EndSections |
| 43 | |
| 44 | " All kind of Lout keywords |
| 45 | syn match loutFunction '\<@[^ \t{}]\+\>' |
| 46 | |
| 47 | " Braces -- Don`t edit these lines! |
| 48 | syn match loutMBraces '[{}]' |
| 49 | syn match loutIBraces '[{}]' |
| 50 | syn match loutBBrace '[{}]' |
| 51 | syn match loutBIBraces '[{}]' |
| 52 | syn match loutHeads '[{}]' |
| 53 | |
| 54 | " Unmatched braces. |
| 55 | syn match loutBraceError '}' |
| 56 | |
| 57 | " End of multi-line definitions, like @Document, @Report and @Book. |
| 58 | syn match loutEOmlDef '^//$' |
| 59 | |
| 60 | " Grouping of parameters and objects. |
| 61 | syn region loutObject transparent matchgroup=Delimiter start='{' matchgroup=Delimiter end='}' contains=ALLBUT,loutBraceError |
| 62 | |
| 63 | " The NULL object has a special meaning |
| 64 | syn keyword loutNULL {} |
| 65 | |
| 66 | " Comments |
| 67 | syn region loutComment start='\#' end='$' contains=loutTodo |
| 68 | |
| 69 | " Double quotes |
| 70 | syn region loutSpecial start=+"+ skip=+\\\\\|\\"+ end=+"+ |
| 71 | |
| 72 | " ISO-LATIN-1 characters created with @Char, or Adobe symbols |
| 73 | " created with @Sym |
| 74 | syn match loutSymbols '@\(\(Char\)\|\(Sym\)\)\s\+[A-Za-z]\+' |
| 75 | |
| 76 | " Include files |
| 77 | syn match loutInclude '@IncludeGraphic\s\+\k\+' |
| 78 | syn region loutInclude start='@\(\(SysInclude\)\|\(IncludeGraphic\)\|\(Include\)\)\s*{' end='}' |
| 79 | |
| 80 | " Tags |
| 81 | syn match loutTag '@\(\(Tag\)\|\(PageMark\)\|\(PageOf\)\|\(NumberOf\)\)\s\+\k\+' |
| 82 | syn region loutTag start='@Tag\s*{' end='}' |
| 83 | |
| 84 | " Equations |
| 85 | syn match loutMath '@Eq\s\+\k\+' |
| 86 | syn region loutMath matchgroup=loutMBraces start='@Eq\s*{' matchgroup=loutMBraces end='}' contains=ALLBUT,loutBraceError |
| 87 | " |
| 88 | " Fonts |
| 89 | syn match loutItalic '@I\s\+\k\+' |
| 90 | syn region loutItalic matchgroup=loutIBraces start='@I\s*{' matchgroup=loutIBraces end='}' contains=ALLBUT,loutBraceError |
| 91 | syn match loutBold '@B\s\+\k\+' |
| 92 | syn region loutBold matchgroup=loutBBraces start='@B\s*{' matchgroup=loutBBraces end='}' contains=ALLBUT,loutBraceError |
| 93 | syn match loutBoldItalic '@BI\s\+\k\+' |
| 94 | syn region loutBoldItalic matchgroup=loutBIBraces start='@BI\s*{' matchgroup=loutBIBraces end='}' contains=ALLBUT,loutBraceError |
| 95 | syn region loutHeadings matchgroup=loutHeads start='@\(\(Title\)\|\(Caption\)\)\s*{' matchgroup=loutHeads end='}' contains=ALLBUT,loutBraceError |
| 96 | |
| 97 | " Define the default highlighting. |
| 98 | " For version 5.7 and earlier: only when not done already |
| 99 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 100 | if version >= 508 || !exists("did_lout_syn_inits") |
| 101 | if version < 508 |
| 102 | let did_lout_syn_inits = 1 |
| 103 | command -nargs=+ HiLink hi link <args> |
| 104 | else |
| 105 | command -nargs=+ HiLink hi def link <args> |
| 106 | endif |
| 107 | |
| 108 | " The default methods for highlighting. Can be overrriden later. |
| 109 | HiLink loutTodo Todo |
| 110 | HiLink loutDefine Define |
| 111 | HiLink loutEOmlDef Define |
| 112 | HiLink loutFunction Function |
| 113 | HiLink loutBraceError Error |
| 114 | HiLink loutNULL Special |
| 115 | HiLink loutComment Comment |
| 116 | HiLink loutSpecial Special |
| 117 | HiLink loutSymbols Character |
| 118 | HiLink loutInclude Include |
| 119 | HiLink loutKeyword Keyword |
| 120 | HiLink loutTag Tag |
| 121 | HiLink loutMath Number |
| 122 | |
| 123 | " HiLink Not really needed here, but I think it is more consistent. |
| 124 | HiLink loutMBraces loutMath |
| 125 | hi loutItalic term=italic cterm=italic gui=italic |
| 126 | HiLink loutIBraces loutItalic |
| 127 | hi loutBold term=bold cterm=bold gui=bold |
| 128 | HiLink loutBBraces loutBold |
| 129 | hi loutBoldItalic term=bold,italic cterm=bold,italic gui=bold,italic |
| 130 | HiLink loutBIBraces loutBoldItalic |
| 131 | hi loutHeadings term=bold cterm=bold guifg=indianred |
| 132 | HiLink loutHeads loutHeadings |
| 133 | |
| 134 | delcommand HiLink |
| 135 | endif |
| 136 | |
| 137 | let b:current_syntax = "lout" |
| 138 | |
| 139 | " vim:ts=8:sw=4:nocindent:smartindent: |