UNPKG

1.06 kBJavaScriptView Raw
1/*
2Language: Leaf
3Author: Hale Chan <halechan@qq.com>
4Description: Based on the Leaf reference from https://vapor.github.io/documentation/guide/leaf.html.
5*/
6
7function leaf(hljs) {
8 return {
9 name: 'Leaf',
10 contains: [
11 {
12 className: 'function',
13 begin: '#+' + '[A-Za-z_0-9]*' + '\\(',
14 end: / \{/,
15 returnBegin: true,
16 excludeEnd: true,
17 contains: [
18 {
19 className: 'keyword',
20 begin: '#+'
21 },
22 {
23 className: 'title',
24 begin: '[A-Za-z_][A-Za-z_0-9]*'
25 },
26 {
27 className: 'params',
28 begin: '\\(',
29 end: '\\)',
30 endsParent: true,
31 contains: [
32 {
33 className: 'string',
34 begin: '"',
35 end: '"'
36 },
37 {
38 className: 'variable',
39 begin: '[A-Za-z_][A-Za-z_0-9]*'
40 }
41 ]
42 }
43 ]
44 }
45 ]
46 };
47}
48
49module.exports = leaf;