aboutsummaryrefslogtreecommitdiff
path: root/grammars/api-notation.cson
blob: 8a2b4de24253aaea8eeb11fc5ee13b6893d005c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
'scopeName': 'source.api-notation'
'name': 'API Notation'
'fileTypes': [
  'api'
]
'patterns': [
  {
    'begin': '^([a-zA-Z0-9_.]+)'
    'end': '\n'
    'name': 'constant.language'
    'patterns': [
      {
        'include': '#dataTypes'
      }
      {
        'include': '#comment'
      }
    ]
  }
  {
    'begin': '[ \t]*',
    'end': '\n'
    'patterns': [
      {
        'include': '#apiMember'
      }
      {
        'include': '#parameterList'
      }
      {
        'include': '#dataTypes'
      }
      {
        'include': '#operators'
      }
      {
        'include': '#parameters'
      }
      {
        'include': '#comment'
      }
    ]
  }
  {
    'begin': '^.',
    'end': '\n'
    'patterns': [
      {
        'include': '#comment'
      }
    ]
  },
]
'repository':
  'dataTypes': {
    'begin': '\\<'
    'end': '\\>'
    'name': 'keyword.operator'
    'patterns': [
      {
        'include': '#dataType'
      }
      {
        'include': '#separators'
      }
    ]
  }
  'parameterList': {
    'begin': '\\('
    'end': '\\)'
    'name': 'keyword.operator'
    'patterns': [
      {
        'include': '#parameters'
      }
      {
        'include': '#optionalParameters'
      }
      {
        'include': '#dataTypes'
      }
      {
        'include': '#separators'
      }
    ]
  }
  'dataType': {
    'match': '[a-zA-Z0-9_.]+'
    'name': 'support.function'
  }
  'parameters': {
    'match': '[a-zA-Z0-9_.]+'
    'name': 'string.other'
  }
  'optionalParameters': {
    'begin': '\\['
    'end': '\\]'
    'patterns': [
      {
        'include': '#optionalParameter'
      }
    ]
  }
  'optionalParameter': {
    'match': '[a-zA-Z0-9_.]+'
    'name': 'meta.separator'
  }
  'separators': {
    'match': '\\||,'
    'name': 'comment.line'
  }
  'apiMember': {
    'match': '((?:<\\+)|(?:<\\~)|(?:<\\-)|(?:\\+>)|(?:\\~>)|(?:\\->)|\\-|\\+|(?:::)|#)([a-zA-z0-9_]+)'
    'captures':
      '1':
        'name': 'keyword.control'
      '2':
        'name': 'variable.language'
  }
  'comment': {
    'match': '[ \t]*//[ \t]*.*',
    'name': 'comment.line'
  }
  'operators': {
    'match': '(?:\\->)|(?:\\=>)'
    'name': 'keyword.control'
  }