7
|
1 " Vim syntax file
|
|
2 " Language: Relax NG compact syntax
|
|
3 " Maintainer: Nikolai Weibull <source@pcppopper.org>
|
|
4 " URL: http://www.pcppopper.org/vim/syntax/pcp/rnc/
|
|
5 " Latest Revision: 2004-05-22
|
|
6 " arch-tag: 061ee0a2-9efa-4e2a-b1a9-14cf5172d645
|
|
7
|
|
8 if version < 600
|
|
9 syntax clear
|
|
10 elseif exists("b:current_syntax")
|
|
11 finish
|
|
12 endif
|
|
13
|
|
14 " Set iskeyword since we need `-' (and potentially others) in keywords.
|
|
15 " For version 5.x: Set it globally
|
|
16 " For version 6.x: Set it locally
|
|
17 if version >= 600
|
|
18 command -nargs=1 SetIsk setlocal iskeyword=<args>
|
|
19 else
|
|
20 command -nargs=1 SetIsk set iskeyword=<args>
|
|
21 endif
|
|
22 SetIsk @,48-57,_,-,.
|
|
23 delcommand SetIsk
|
|
24
|
|
25 " Todo
|
|
26 syn keyword rncTodo contained TODO FIXME XXX NOTE
|
|
27
|
|
28 " Comments
|
|
29 syn region rncComment matchgroup=rncComment start='^\s*#' end='$' contains=rncTodo
|
|
30
|
|
31 " Operators
|
|
32 syn match rncOperator '[-|,&+?*~]'
|
|
33 syn match rncOperator '\%(|&\)\=='
|
|
34 syn match rncOperator '>>'
|
|
35
|
|
36 " Namespaces
|
|
37 syn match rncNamespace '\<\k\+:'
|
|
38
|
|
39 " Quoted Identifier
|
|
40 syn match rncQuoted '\\\k\+\>'
|
|
41
|
|
42 " Special Characters
|
|
43 syn match rncSpecial '\\x{\x\+}'
|
|
44
|
|
45 " Annotations
|
|
46 syn region Annotation transparent start='\[' end='\]' contains=ALLBUT,rncComment,rncTodo
|
|
47
|
|
48 " Literals
|
|
49 syn region rncLiteral matchgroup=rncLiteral oneline start=+"+ end=+"+ contains=rncSpecial
|
|
50 syn region rncLiteral matchgroup=rncLiteral oneline start=+'+ end=+'+
|
|
51 syn region rncLiteral matchgroup=rncLiteral start=+"""+ end=+"""+ contains=rncSpecial
|
|
52 syn region rncLiteral matchgroup=rncLiteral start=+'''+ end=+'''+
|
|
53
|
|
54 " Delimiters
|
|
55 syn match rncDelimiter '[{},()]'
|
|
56
|
|
57 " Keywords
|
|
58 syn keyword rncKeyword datatypes default div empty external grammar
|
|
59 syn keyword rncKeyword include inherit list mixed name namespace
|
|
60 syn keyword rncKeyword notAllowed parent start string text token
|
|
61
|
|
62 " Identifiers
|
|
63 syn match rncIdentifier '\k\+\_s*\%(=\|&=\||=\)\@=' nextgroup=rncOperator
|
|
64 syn keyword rncKeyword nextgroup=rncIdName skipwhite skipempty element attribute
|
|
65 syn match rncIdentifier contained '\k\+'
|
|
66
|
|
67 " Define the default highlighting.
|
|
68 " For version 5.7 and earlier: only when not done already
|
|
69 " For version 5.8 and later: only when an item doesn't have highlighting yet
|
|
70 if version >= 508 || !exists("did_rnc_syn_inits")
|
|
71 if version < 508
|
|
72 let did_rnc_syn_inits = 1
|
|
73 command -nargs=+ HiLink hi link <args>
|
|
74 else
|
|
75 command -nargs=+ HiLink hi def link <args>
|
|
76 endif
|
|
77
|
|
78 HiLink rncTodo Todo
|
|
79 HiLink rncComment Comment
|
|
80 HiLink rncOperator Operator
|
|
81 HiLink rncNamespace Identifier
|
|
82 HiLink rncQuoted Special
|
|
83 HiLink rncSpecial SpecialChar
|
|
84 HiLink rncLiteral String
|
|
85 HiLink rncDelimiter Delimiter
|
|
86 HiLink rncKeyword Keyword
|
|
87 HiLink rncIdentifier Identifier
|
|
88
|
|
89 delcommand HiLink
|
|
90 endif
|
|
91
|
|
92 let b:current_syntax = "rnc"
|
|
93
|
|
94 " vim: set sts=2 sw=2:
|