summaryrefslogtreecommitdiff
path: root/assets/files/SExpressions.sublime-syntax
blob: 31c830a40feaa89ea66464d9e21ac8fa1ad6bc1b (plain) (blame)
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
%YAML 1.2
---
name: S Expressions
file_extensions: ["sexp"]
scope: source.sexpr

contexts:
  main:
    - match: '(;+).*$'
      scope: comment.line.sexpr
      captures:
        1: punctuation.definition.comment.sexpr
    - match: '#;'
      scope: punctuation.definition.comment.sexpr
      push: comment
    - match: '#\|'
      scope: punctuation.definition.comment.sexpr
      push: block_comment

    - match: '"'
      scope: punctuation.definition.string.begin.sexpr
      push: string_unquote
    - match: '\d+\.\d+'
      scope: constant.numeric.float.sexpr
    - match: '\d+'
      scope: constant.numeric.integer.sexpr
    - match: '\w+'
      scope: constant.other.sexpr
    - match: '\('
      scope: punctuation.section.parens.begin.sexpr
      push: main_rparen
    - match: '\)'
      scope: invalid.illegal.stray-paren-end

  string_unquote:
    - meta_scope: string.quoted.double.sexpr
    - match: '""'
      scope: constant.character.escape.sexpr
    - match: '"'
      scope: punctuation.definition.string.end.sexpr
      pop: true

  main_rparen:
    - match: '\)'
      scope: punctuation.section.parens.end.sexpr
      pop: true
    - include: main

  comment:
    - meta_scope: comment.block.sexpr
    - match: '\('
      set: comment_rparen

  comment_lparen:
    - meta_scope: comment.block.sexpr
    - match: '\('
      push: comment_rparen
    - match: '\)'
      scope: invalid.illegal.stray-paren-end

  comment_rparen:
    - meta_scope: comment.block.sexpr
    - match: '\)'
      pop: true
    - include: comment

  block_comment:
    - meta_scope: comment.block.sexpr
    - match: '#\|'
      push: block_comment
    - match: '\|#'
      scope: punctuation.definition.comment.sexpr
      pop: true