14999
|
1 " Vim syntax file
|
|
2 " Language: RAML (RESTful API Modeling Language)
|
|
3 " Maintainer: Eric Hopkins <eric.on.tech@gmail.com>
|
|
4 " URL: https://github.com/in3d/vim-raml
|
|
5 " License: Same as Vim
|
|
6 " Last Change: 2018-11-03
|
|
7
|
|
8 if exists("b:current_syntax")
|
|
9 finish
|
|
10 endif
|
|
11
|
|
12 let s:cpo_save = &cpo
|
|
13 set cpo&vim
|
|
14
|
|
15 syn keyword ramlTodo contained TODO FIXME XXX NOTE
|
|
16
|
|
17 syn region ramlComment display oneline start='\%(^\|\s\)#' end='$'
|
|
18 \ contains=ramlTodo,@Spell
|
|
19
|
|
20 syn region ramlVersion display oneline start='#%RAML' end='$'
|
|
21
|
|
22 syn match ramlNodeProperty '!\%(![^\\^% ]\+\|[^!][^:/ ]*\)'
|
|
23
|
|
24 syn match ramlAnchor '&.\+'
|
|
25
|
|
26 syn match ramlAlias '\*.\+'
|
|
27
|
|
28 syn match ramlDelimiter '[-,:]'
|
|
29 syn match ramlBlock '[\[\]{}>|]'
|
|
30 syn match ramlOperator '[?+-]'
|
|
31 syn match ramlKey '\h\+\(?\)\?\ze\s*:'
|
|
32 syn match ramlKey '\w\+\(\s\+\w\+\)*\(?\)\?\ze\s*:'
|
|
33 syn match routeKey '\/\w\+\(\s\+\w\+\)*\ze\s*:'
|
|
34 syn match routeKey 'application\/\w\+\ze\s*:'
|
|
35 syn match routeParamKey '\/{\w\+}*\ze\s*:'
|
|
36
|
|
37 syn region ramlString matchgroup=ramlStringDelimiter
|
|
38 \ start=+\s"+ skip=+\\"+ end=+"+
|
|
39 \ contains=ramlEscape
|
|
40 syn region ramlString matchgroup=ramlStringDelimiter
|
|
41 \ start=+\s'+ skip=+''+ end=+'+
|
|
42 \ contains=ramlStringEscape
|
|
43 syn region ramlParameter matchgroup=ramlParameterDelimiter
|
|
44 \ start=+<<+ skip=+''+ end=+>>+
|
|
45 syn match ramlEscape contained display +\\[\\"abefnrtv^0_ NLP]+
|
|
46 syn match ramlEscape contained display '\\x\x\{2}'
|
|
47 syn match ramlEscape contained display '\\u\x\{4}'
|
|
48 syn match ramlEscape contained display '\\U\x\{8}'
|
|
49 syn match ramlEscape display '\\\%(\r\n\|[\r\n]\)'
|
|
50 syn match ramlStringEscape contained +''+
|
|
51
|
|
52 syn match ramlNumber display
|
|
53 \ '\<[+-]\=\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\='
|
|
54 syn match ramlNumber display '0\o\+'
|
|
55 syn match ramlNumber display '0x\x\+'
|
|
56 syn match ramlNumber display '([+-]\=[iI]nf)'
|
|
57 syn match ramlNumber display '(NaN)'
|
|
58
|
|
59 syn match ramlConstant '\<[~yn]\>'
|
|
60 syn keyword ramlConstant true True TRUE false False FALSE
|
|
61 syn keyword ramlConstant yes Yes on ON no No off OFF
|
|
62 syn keyword ramlConstant null Null NULL nil Nil NIL
|
|
63
|
|
64 syn keyword httpVerbs get post put delete head patch options
|
|
65 syn keyword ramlTypes string number integer date boolean file
|
|
66
|
|
67 syn match ramlTimestamp '\d\d\d\d-\%(1[0-2]\|\d\)-\%(3[0-2]\|2\d\|1\d\|\d\)\%( \%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\d\d [+-]\%([01]\d\|2[0-3]\):[0-5]\d\|t\%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\d\d[+-]\%([01]\d\|2[0-3]\):[0-5]\d\|T\%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\dZ\)\='
|
|
68
|
|
69 syn region ramlDocumentHeader start='---' end='$' contains=ramlDirective
|
|
70 syn match ramlDocumentEnd '\.\.\.'
|
|
71
|
|
72 syn match ramlDirective contained '%[^:]\+:.\+'
|
|
73
|
|
74 hi def link ramlVersion String
|
|
75 hi def link routeInterpolation String
|
|
76 hi def link ramlInterpolation Constant
|
|
77 hi def link ramlTodo Todo
|
|
78 hi def link ramlComment Comment
|
|
79 hi def link ramlDocumentHeader PreProc
|
|
80 hi def link ramlDocumentEnd PreProc
|
|
81 hi def link ramlDirective Keyword
|
|
82 hi def link ramlNodeProperty Type
|
|
83 hi def link ramlAnchor Type
|
|
84 hi def link ramlAlias Type
|
|
85 hi def link ramlBlock Operator
|
|
86 hi def link ramlOperator Operator
|
|
87 hi def link routeParamKey SpecialChar
|
|
88 hi def link ramlKey Identifier
|
|
89 hi def link routeKey SpecialChar
|
|
90 hi def link ramlParameterDelimiter Type
|
|
91 hi def link ramlParameter Type
|
|
92 hi def link ramlString String
|
|
93 hi def link ramlStringDelimiter ramlString
|
|
94 hi def link ramlEscape SpecialChar
|
|
95 hi def link ramlStringEscape SpecialChar
|
|
96 hi def link ramlNumber Number
|
|
97 hi def link ramlConstant Constant
|
|
98 hi def link ramlTimestamp Number
|
|
99 hi def link httpVerbs Statement
|
|
100 hi def link ramlTypes Type
|
|
101 hi def link ramlDelimiter Delimiter
|
|
102
|
|
103 let b:current_syntax = "raml"
|
|
104
|
|
105 let &cpo = s:cpo_save
|
|
106 unlet s:cpo_save
|