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