Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Slrn score file (based on slrn 0.9.8.0) |
Bram Moolenaar | 7b0294c | 2004-10-11 10:16:09 +0000 | [diff] [blame] | 3 | " Maintainer: Preben 'Peppe' Guldberg <peppe@wielders.org> |
| 4 | " Last Change: 8 Oct 2004 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 5 | |
| 6 | " For version 5.x: Clear all syntax items |
| 7 | " For version 6.x: Quit when a syntax file was already loaded |
| 8 | if version < 600 |
| 9 | syntax clear |
| 10 | elseif exists("b:current_syntax") |
| 11 | finish |
| 12 | endif |
| 13 | |
| 14 | " characters in newsgroup names |
| 15 | if version < 600 |
| 16 | set isk=@,48-57,.,-,_,+ |
| 17 | else |
| 18 | setlocal isk=@,48-57,.,-,_,+ |
| 19 | endif |
| 20 | |
| 21 | syn match slrnscComment "%.*$" |
| 22 | syn match slrnscSectionCom ".].*"lc=2 |
| 23 | |
| 24 | syn match slrnscGroup contained "\(\k\|\*\)\+" |
| 25 | syn match slrnscNumber contained "\d\+" |
| 26 | syn match slrnscDate contained "\(\d\{1,2}[-/]\)\{2}\d\{4}" |
| 27 | syn match slrnscDelim contained ":" |
| 28 | syn match slrnscComma contained "," |
| 29 | syn match slrnscOper contained "\~" |
| 30 | syn match slrnscEsc contained "\\[ecC<>.]" |
| 31 | syn match slrnscEsc contained "[?^]" |
| 32 | syn match slrnscEsc contained "[^\\]$\s*$"lc=1 |
| 33 | |
| 34 | syn keyword slrnscInclude contained include |
| 35 | syn match slrnscIncludeLine "^\s*Include\s\+\S.*$" |
| 36 | |
| 37 | syn region slrnscSection matchgroup=slrnscSectionStd start="^\s*\[" end='\]' contains=slrnscGroup,slrnscComma,slrnscSectionCom |
| 38 | syn region slrnscSection matchgroup=slrnscSectionNot start="^\s*\[\~" end='\]' contains=slrnscGroup,slrnscCommas,slrnscSectionCom |
| 39 | |
| 40 | syn keyword slrnscItem contained Age Bytes Date Expires From Has-Body Lines Message-Id Newsgroup References Subject Xref |
| 41 | |
| 42 | syn match slrnscScoreItem contained "%.*$" skipempty nextgroup=slrnscScoreItem contains=slrnscComment |
| 43 | syn match slrnscScoreItem contained "^\s*Expires:\s*\(\d\{1,2}[-/]\)\{2}\d\{4}\s*$" skipempty nextgroup=slrnscScoreItem contains=slrnscItem,slrnscDelim,slrnscDate |
| 44 | syn match slrnscScoreItem contained "^\s*\~\=\(Age\|Bytes\|Has-Body\|Lines\):\s*\d\+\s*$" skipempty nextgroup=slrnscScoreItem contains=slrnscOper,slrnscItem,slrnscDelim,slrnscNumber |
| 45 | syn match slrnscScoreItemFill contained ".*$" skipempty nextgroup=slrnscScoreItem contains=slrnscEsc |
| 46 | syn match slrnscScoreItem contained "^\s*\~\=\(Date\|From\|Message-Id\|Newsgroup\|References\|Subject\|Xref\):" nextgroup=slrnscScoreItemFill contains=slrnscOper,slrnscItem,slrnscDelim |
| 47 | syn region slrnscScoreItem contained matchgroup=Special start="^\s*\~\={::\=" end="^\s*}" skipempty nextgroup=slrnscScoreItem contains=slrnscScoreItem |
| 48 | |
| 49 | syn keyword slrnscScore contained Score |
| 50 | syn match slrnscScoreIdent contained "%.*" |
Bram Moolenaar | 7b0294c | 2004-10-11 10:16:09 +0000 | [diff] [blame] | 51 | syn match slrnScoreLine "^\s*Score::\=\s\+=\=[-+]\=\d\+\s*\(%.*\)\=$" skipempty nextgroup=slrnscScoreItem contains=slrnscScore,slrnscDelim,slrnscOper,slrnscNumber,slrnscScoreIdent |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 52 | |
| 53 | " Define the default highlighting. |
| 54 | " For version 5.7 and earlier: only when not done already |
| 55 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 56 | if version >= 508 || !exists("did_slrnsc_syntax_inits") |
| 57 | if version < 508 |
| 58 | let did_slrnsc_syntax_inits = 1 |
| 59 | command -nargs=+ HiLink hi link <args> |
| 60 | else |
| 61 | command -nargs=+ HiLink hi def link <args> |
| 62 | endif |
| 63 | |
| 64 | HiLink slrnscComment Comment |
| 65 | HiLink slrnscSectionCom slrnscComment |
| 66 | HiLink slrnscGroup String |
| 67 | HiLink slrnscNumber Number |
| 68 | HiLink slrnscDate Special |
| 69 | HiLink slrnscDelim Delimiter |
| 70 | HiLink slrnscComma SpecialChar |
| 71 | HiLink slrnscOper SpecialChar |
| 72 | HiLink slrnscEsc String |
| 73 | HiLink slrnscSectionStd Type |
| 74 | HiLink slrnscSectionNot Delimiter |
| 75 | HiLink slrnscItem Statement |
| 76 | HiLink slrnscScore Keyword |
| 77 | HiLink slrnscScoreIdent Identifier |
| 78 | HiLink slrnscInclude Keyword |
| 79 | |
| 80 | delcommand HiLink |
| 81 | endif |
| 82 | |
| 83 | let b:current_syntax = "slrnsc" |
| 84 | |
| 85 | "EOF vim: ts=8 noet tw=200 sw=8 sts=0 |