Merge branch 'hack/autopaste'
[vim-kana.git] / runtime / syntax / po.vim
blob3bb39b1733e0320d603f8ee71fde7474cf3fc044
1 " Vim syntax file
2 " Language:     po (gettext)
3 " Maintainer:   Dwayne Bailey <dwayne@translate.org.za>
4 " Last Change:  2004 Nov 13
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
14 syn sync minlines=10
16 " Identifiers
17 syn match  poStatementMsgidplural "^msgid_plural" contained
18 syn match  poPluralCaseN "[0-9]" contained
19 syn match  poStatementMsgstr "^msgstr\(\[[0-9]\]\)" contains=poPluralCaseN
21 " Simple HTML and XML highlighting
22 syn match  poHtml "<[^<>]\+>" contains=poHtmlTranslatables
23 syn match  poHtmlNot +"<[^<]\+>"+ms=s+1,me=e-1
24 syn region poHtmlTranslatables start=+alt=\\"+ms=e-1 end=+\\"+ contained
26 " Translation blocks
27 syn region     poMsgID  matchgroup=poStatementMsgid start=+^msgid "+rs=e-1 matchgroup=poStringID end=+^msgstr\(\|\[[\]0\[]\]\) "+me=s-1 contains=poStringID,poStatementMsgidplural,poStatementMsgid
28 syn region     poMsgSTR matchgroup=poStatementMsgstr start=+^msgstr\(\|\[[\]0\[]\]\) "+rs=e-1 matchgroup=poStringSTR end=+\n\n+me=s-1 contains=poStringSTR,poStatementMsgstr
29 syn region poStringID   start=+"+ skip=+\\\\\|\\"+ end=+"+ contained 
30                             \ contains=poSpecial,poFormat,poCommentKDE,poPluralKDE,poKDEdesktopFile,poHtml,poAccelerator,poHtmlNot,poVariable
31 syn region poStringSTR  start=+"+ skip=+\\\\\|\\"+ end=+"+ contained 
32                             \ contains=poSpecial,poFormat,poHeaderItem,poCommentKDEError,poHeaderUndefined,poPluralKDEError,poMsguniqError,poKDEdesktopFile,poHtml,poAccelerator,poHtmlNot,poVariable
34 " Header and Copyright
35 syn match     poHeaderItem "\(Project-Id-Version\|Report-Msgid-Bugs-To\|POT-Creation-Date\|PO-Revision-Date\|Last-Translator\|Language-Team\|MIME-Version\|Content-Type\|Content-Transfer-Encoding\|Plural-Forms\|X-Generator\): " contained
36 syn match     poHeaderUndefined "\(PACKAGE VERSION\|YEAR-MO-DA HO:MI+ZONE\|FULL NAME <EMAIL@ADDRESS>\|LANGUAGE <LL@li.org>\|text/plain; charset=CHARSET\|ENCODING\)" contained
37 syn match     poCopyrightUnset "SOME DESCRIPTIVE TITLE\|FIRST AUTHOR <EMAIL@ADDRESS>, YEAR\|Copyright (C) YEAR Free Software Foundation, Inc\|YEAR THE PACKAGE\'S COPYRIGHT HOLDER\|PACKAGE" contained
39 " Translation comment block including: translator comment, automatic coments, flags and locations
40 syn match     poComment "^#.*$"
41 syn keyword   poFlagFuzzy fuzzy contained
42 syn match     poCommentTranslator "^# .*$" contains=poCopyrightUnset
43 syn match     poCommentAutomatic "^#\..*$" 
44 syn match     poCommentSources  "^#:.*$"
45 syn match     poCommentFlags "^#,.*$" contains=poFlagFuzzy
47 " Translations (also includes header fields as they appear in a translation msgstr)
48 syn region poCommentKDE   start=+"_: +ms=s+1 end="\\n" end="\"\n^msgstr"me=s-1 contained
49 syn region poCommentKDEError  start=+"\(\|\s\+\)_:+ms=s+1 end="\\n" end=+"\n\n+me=s-1 contained
50 syn match  poPluralKDE   +"_n: +ms=s+1 contained
51 syn region poPluralKDEError   start=+"\(\|\s\+\)_n:+ms=s+1 end="\"\n\n"me=s-1 contained
52 syn match  poSpecial    contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
53 syn match  poFormat     "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([diuoxXfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
54 syn match  poFormat     "%%" contained
56 " msguniq and msgcat conflicts
57 syn region poMsguniqError matchgroup=poMsguniqErrorMarkers  start="#-#-#-#-#"  end='#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)-\("\n"\|\)#\("\n"\|\)\\n' contained
59 " Obsolete messages
60 syn match poObsolete "^#\~.*$" 
62 " KDE Name= handling
63 syn match poKDEdesktopFile "\"\(Name\|Comment\|GenericName\|Description\|Keywords\|About\)="ms=s+1,me=e-1
65 " Accelerator keys - this messes up if the preceding or following char is a multibyte unicode char
66 syn match poAccelerator  contained "[^&_~][&_~]\(\a\|\d\)[^:]"ms=s+1,me=e-1 
68 " Variables simple
69 syn match poVariable contained "%\d"
71 " Define the default highlighting.
72 " For version 5.7 and earlier: only when not done already
73 " For version 5.8 and later: only when an item doesn't have highlighting yet
74 if version >= 508 || !exists("did_po_syn_inits")
75   if version < 508
76     let did_po_syn_inits = 1
77     command -nargs=+ HiLink hi link <args>
78   else
79     command -nargs=+ HiLink hi def link <args>
80   endif
82   HiLink poCommentSources    PreProc
83   HiLink poComment           Comment
84   HiLink poCommentAutomatic  Comment
85   HiLink poCommentTranslator Comment
86   HiLink poCommentFlags      Special
87   HiLink poCopyrightUnset    Todo
88   HiLink poFlagFuzzy         Todo
89   HiLink poObsolete         Comment
91   HiLink poStatementMsgid   Statement
92   HiLink poStatementMsgstr  Statement
93   HiLink poStatementMsgidplural  Statement
94   HiLink poPluralCaseN      Constant
96   HiLink poStringID         String
97   HiLink poStringSTR        String
98   HiLink poCommentKDE       Comment
99   HiLink poCommentKDEError  Error
100   HiLink poPluralKDE        Comment
101   HiLink poPluralKDEError   Error
102   HiLink poHeaderItem       Identifier
103   HiLink poHeaderUndefined  Todo
104   HiLink poKDEdesktopFile   Identifier
106   HiLink poHtml              Identifier
107   HiLink poHtmlNot           String
108   HiLink poHtmlTranslatables String
110   HiLink poFormat           poSpecial
111   HiLink poSpecial          Special
112   HiLink poAccelerator       Special
113   HiLink poVariable          Special
115   HiLink poMsguniqError        Special
116   HiLink poMsguniqErrorMarkers Comment
118   delcommand HiLink
119 endif
121 let b:current_syntax = "po"
123 " vim:set ts=8 sts=2 sw=2 noet: