oranda 0.6.5

🎁 generate beautiful landing pages for your projects
Documentation
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
# MIT License
#
#Copyright (c) 2021 Jason Williams
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all
#copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
#SOFTWARE.

name: TOML

file_extensions:
  - toml
  - tml
  - Cargo.lock
  - Gopkg.lock
  - Pipfile
  - pdm.lock
  - poetry.lock

scope: source.toml

variables:
  ws: '[ \t]*'
  wsnl: '([ \t\n])*'

  # Used to detect the possible start of a key.
  peek_key_start: '(?=[A-Za-z0-9_''"-])'
  dot_peek_key: '{{ws}}(\.){{ws}}{{peek_key_start}}'

  # integer = [ "-" / "+" ] int
  # int = DIGIT / digit1-9 1*( DIGIT / "_" DIGIT )
  integer: '([\+\-]?) (?: [0-9] | [1-9] (?: [0-9] | _ [0-9] )+ )'

  HEXDIG: '[0-9A-Fa-f]'
  hex_int: '0x{{HEXDIG}}(?:{{HEXDIG}}|_{{HEXDIG}})*'
  oct_int: '0o[0-7](?:[0-7]|_[0-7])*'
  bin_int: '0b[0-1](?:[0-1]|_[0-1])*'

  # zero-prefixable-int = DIGIT *( DIGIT / underscore DIGIT )
  zero_prefixable_int: '[0-9] (?: [0-9] | _ [0-9] )*'
  # frac = decimal-point zero-prefixable-int
  frac: '\. {{zero_prefixable_int}}'
  # exp = "e" float-exp-part
  # float-exp-part = [ minus / plus ] zero-prefixable-int
  exp: '[eE] [\+\-]? {{zero_prefixable_int}}'

  # date-time      = offset-date-time / local-date-time / local-date / local-time
  date_time: '{{offset_date_time}} | {{local_date_time}} | {{local_date}} | {{local_time}}'
  # date-fullyear  = 4DIGIT
  date_fullyear: '[0-9]{4}'
  # date-month     = 2DIGIT  ; 01-12
  date_month: '[0-1][0-9]'
  # date-mday      = 2DIGIT  ; 01-28, 01-29, 01-30, 01-31 based on month/year
  date_mday: '[0-3][0-9]'
  # time-hour      = 2DIGIT  ; 00-23
  time_hour: '[0-2][0-9]'
  # time-minute    = 2DIGIT  ; 00-59
  time_minute: '[0-5][0-9]'
  # time-second    = 2DIGIT  ; 00-58, 00-59, 00-60 based on leap second rules
  time_second: '[0-6][0-9]'
  # time-secfrac   = "." 1*DIGIT
  time_secfrac: '\.[0-9]+'
  # time-numoffset = ( "+" / "-" ) time-hour ":" time-minute
  time_numoffset: '[+-] {{time_hour}} : {{time_minute}}'
  # time-offset    = "Z" / time-numoffset
  time_offset: '(?: [zZ] | {{time_numoffset}} )'
  # partial-time   = time-hour ":" time-minute ":" time-second [time-secfrac]
  partial_time: '{{time_hour}} : {{time_minute}} : {{time_second}} (?: {{time_secfrac}} )?'
  # full-date      = date-fullyear "-" date-month "-" date-mday
  full_date: '{{date_fullyear}} - {{date_month}} - {{date_mday}}'
  # full-time      = partial-time time-offset
  full_time: '{{partial_time}} {{time_offset}}'
  # offset-date-time = full-date T|%20 full-time
  offset_date_time: '{{full_date}} [tT ] {{full_time}}'
  # local-date-time = full-date T|%20 partial-time
  local_date_time: '{{full_date}} [tT ] {{partial_time}}'
  # local-date = full-date
  local_date: '{{full_date}}'
  # local-time = partial-time
  local_time: '{{partial_time}}'

contexts:
  main:
    - match: '^{{ws}}'
      # Ignore leading whitespace for all expressions.
    - include: comments
    - include: tables
    - include: keyval
    - include: illegal

  illegal:
    - match: (.*)
      # Invalid things -> everything unmatched
      captures:
        1: invalid.illegal.toml

  comments:
    - match: '{{ws}}((#).*)'
      captures:
        1: comment.line.number-sign.toml
        2: punctuation.definition.comment.toml

  data-types:
    - include: inline-table
    - include: array
    - include: string
    - include: date-time
    - include: float
    - include: integer
    - include: boolean
    - match: '{{ws}}$'
      # Don't show an incomplete line as invalid to avoid frequent red
      # highlighting while typing.
      pop: true
    - match: '\w+|.'
      scope: invalid.illegal.value.toml
      pop: true

  boolean:
    - match: (true|false)
      captures:
        1: constant.language.toml
      pop: true

  integer:
    - match: |-
        (?x)
          (?<!\w)
            {{hex_int}}
            |{{oct_int}}
            |{{bin_int}}
            |{{integer}}
          (?!\w)
      captures:
        0: constant.numeric.integer.toml
        1: keyword.operator.arithmetic.toml
      pop: true

  float:
    # float = float-int-part ( exp / frac [ exp ] )
    # float =/ special-float
    # special-float = [ minus / plus ] ( inf / nan )
    # float-int-part = dec-int
    - match: |-
        (?x)
          (?<!\w)
            {{integer}}
            (?: {{frac}} | (?: {{frac}} {{exp}} ) | {{exp}} )
          (?!\w)
      captures:
        0: constant.numeric.float.toml
        1: keyword.operator.arithmetic.toml
      pop: true
    - match: '(?<!\w)([+-])?(inf|nan)(?!\w)'
      captures:
        0: constant.numeric.float.toml
        1: keyword.operator.arithmetic.toml
      pop: true

  date-time:
    - match: '(?x) {{date_time}}'
      scope: constant.other.datetime.toml
      pop: true

  string:
    - match: "'''"
      # multi-line literal string (no escape sequences)
      scope: punctuation.definition.string.begin.toml
      set:
        - meta_scope: string.quoted.triple.literal.block.toml
        - match: "'''"
          scope: punctuation.definition.string.end.toml
          pop: true
    - match: '"""'
      # multi-line basic string
      scope: punctuation.definition.string.begin.toml
      set:
        - meta_scope: string.quoted.triple.basic.block.toml
        - match: '"""'
          scope: punctuation.definition.string.end.toml
          pop: true
        - include: string-escape
    - include: basic-string
    - include: literal-string

  basic-string:
    - match: '"'
      scope: punctuation.definition.string.begin.toml
      set:
        - meta_scope: string.quoted.double.basic.toml
        - include: string-escape
        - match: '"'
          scope: punctuation.definition.string.end.toml
          pop: true
        - match: '\n'
          scope: invalid.illegal.string.non-terminated.toml
          pop: true

  string-escape:
    - match: '\\(?:[btnfr"\\]|u\h{4}|U\h{8})'
      scope: constant.character.escape.toml
    - match: '\\.'
      scope: invalid.illegal.string.escape.toml

  literal-string:
    - match: '('')[^'']*('')'
      # There is ambiguity in what is allowed in a literal string.
      # See: https://github.com/toml-lang/toml/issues/473
      scope: string.quoted.single.literal.toml
      captures:
        1: punctuation.definition.string.begin.toml
        2: punctuation.definition.string.end.toml
      pop: true

  array:
    - match: '\['
      scope: punctuation.definition.array.begin.toml
      set: [maybe-empty-array, maybe-array-comments]

  maybe-empty-array:
    - match: ']'
      scope: punctuation.definition.array.end.toml
      pop: true
    - match: ''
      set: [array-sep, data-types]

  array-sep:
    - match: '{{wsnl}}'
    - include: comments
    - match: ']'
      scope: punctuation.definition.array.end.toml
      pop: true
    - match: ','
      scope: punctuation.separator.array.toml
      set:
        - match: '{{wsnl}}'
        - include: comments
        - match: ']'
          scope: punctuation.definition.array.end.toml
          pop: true
        - match: '(?=[^\n])'
          set: [array-sep, data-types]
    - match: '\w+|.'
      scope: invalid.illegal.array.toml

  maybe-array-comments:
    - match: '{{wsnl}}'
    - include: comments
    - match: '(?=[^\n])'
      pop: true

  inline-table:
    - match: '\{'
      scope: punctuation.definition.inline-table.begin.toml
      set:
        - match: '{{ws}}'
        - match: '\}'
          # Empty table.
          scope: punctuation.definition.inline-table.end.toml
          pop: true
        - match: ''
          set: [inline-keyval-sep, key]

  inline-keyval-sep:
    - match: '{{ws}}(=){{ws}}'
      captures:
        1: punctuation.definition.key-value.toml
      set: [inline-table-keyvals, data-types]
    - match: '(?=\w+|.)'
      scope: invalid.illegal.inline-sep.toml
      pop: true

  inline-table-keyvals:
    - match: '{{ws}}'
    - match: '\}'
      scope: punctuation.definition.inline-table.end.toml
      pop: true
    - match: ','
      scope: punctuation.separator.inline-table.toml
      set:
        - match: '{{ws}}'
        - match: ''
          set: [inline-keyval-sep, key]
    - match: '(?=\w+|.)'
      scope: invalid.illegal.inline-key.toml
      pop: true

  keyval:
    - match: '{{peek_key_start}}'
      push: [keyval-sep, key]

  keyval-sep:
    - match: '{{ws}}(=){{ws}}'
      captures:
        # This could arguably be keyword.operator.assignment.toml, but since
        # Monokai uses the same color for non-C sources with entity.name.tag,
        # it doesn't have the appropriate visual distinction.
        1: punctuation.definition.key-value.toml
      set: [maybe-comment-eol, data-types]
    - match: '{{ws}}$'
      # Don't show an incomplete line as invalid to avoid flickering.
      pop: true
    - match: '.+$'
      scope: invalid.illegal.keyval.toml
      pop: true

  key:
    - meta_scope: meta.tag.key.toml
    - match: '{{peek_key_start}}'
      push: [maybe-dot-key, key-simple]
    - match: '(?={{ws}}=)'
      pop: true
    - match: '{{ws}}$'
      # Early exit to avoid errors while typing.
      pop: true
    - match: '.'
      scope: invalid.illegal.key.toml
      pop: true

  key-simple:
    - match: '[A-Za-z0-9_-]+'
      scope: entity.name.tag.toml
      pop: true
    - include: key-quoted
    - match: '\S+'
      scope: invalid.illegal.key.toml
      pop: true

  key-quoted:
    - include: basic-string
    - include: literal-string

  maybe-dot-key:
    - match: '{{dot_peek_key}}'
      captures:
        1: punctuation.separator.key.toml
      push: key-simple
    - match: '(?={{ws}}(?:=|$))'
      pop: true
    - match: '.'
      scope: invalid.illegal.key.toml
      pop: true

  maybe-comment-eol:
    - include: comments
    - match: '$'
      pop: true
    - match: '.+'
      # This also highlights trailing whitespece.  Although that is valid
      # TOML, it doesn't seem bad to me.  If that's annoying, change this
      # to '[^ \n]+'.
      scope: invalid.illegal.trailing.toml
      pop: true

  tables:
    - match: '\[?\[{{ws}}\]\]?'
      scope: invalid.illegal.table.toml

    - match: '(\[\[){{ws}}'
      # Array table.  Same as std-table with double-brackets.
      captures:
        1: punctuation.definition.table.array.begin.toml
      push: [maybe-comment-eol, table-array-name]

    - match: '(\[){{ws}}'
      # std-table = ws "[" ws key (ws "." ws key)* ws "]" ws comment?
      captures:
        1: punctuation.definition.table.begin.toml
      push: [maybe-comment-eol, table-name]

  table-name:
    - meta_content_scope: meta.tag.table.toml
    - match: '{{ws}}(\])'
      captures:
        1: punctuation.definition.table.end.toml
      pop: true
    - include: table-name-inc

  table-array-name:
    - meta_content_scope: meta.tag.table.array.toml
    - match: '{{ws}}(\]\])'
      captures:
        1: punctuation.definition.table.array.end.toml
      pop: true
    - include: table-name-inc

  table-name-inc:
    - match: '{{peek_key_start}}'
      push: [maybe-dot-table-name, table-name-simple]
    - match: '[^\]]+\]?'
      scope: invalid.illegal.table.toml
      pop: true

  table-name-simple:
    - match: '[A-Za-z0-9_-]+'
      scope: entity.name.table.toml
      pop: true
    - include: key-quoted
    - match: '.'
      scope: invalid.illegal.table.toml
      pop: true

  maybe-dot-table-name:
    - match: '{{dot_peek_key}}'
      captures:
        1: punctuation.separator.table.toml
      push: table-name-simple
    - match: '(?={{ws}}(?:\]|$))'
      pop: true
    - match: '.'
      scope: invalid.illegal.table.toml
      pop: true