-
Notifications
You must be signed in to change notification settings - Fork 11
/
bnf.sublime-syntax
101 lines (89 loc) · 2.2 KB
/
bnf.sublime-syntax
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
%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
file_extensions:
- bnf
scope: source
contexts:
prototype:
- include: comments
main:
- include: production
comments:
- match: \(\*
scope: punctuation.definition.comment
push:
- meta_scope: comment.block
- match: \*\)
pop: true
production:
- include: production-head
- match: ::\=
scope: keyword.operator.assignment
set: production-body
production-head:
- match: \b([-\w]+)\b
scope: entity.name.function
- include: subscripts
production-body:
- match: ;
scope: punctuation.terminator
pop: true
- include: symbol-list
- match: \)
scope: invalid
symbol-list:
- match: \||\+|\*|\?
scope: keyword.operator
- match: \.\.\.?
scope: constant.other
- include: groups
- include: terminals
- include: terminal-classes
- include: nonterminals
nonterminals:
- match: \b([-\w]+)\b
scope: variable
- include: subscripts
terminal-classes:
- match: \b([[:upper:]]+)\b
scope: constant.other
- include: subscripts
terminals:
- match: '"'
scope: punctuation.definition.string.begin
push:
- meta_scope: string.quoted.double
- match: \\"
scope: constant.character.escape
- match: '"'
scope: punctuation.definition.string.end
pop: true
- match: \'
scope: punctuation.definition.string.begin
push:
- meta_scope: string.quoted.single
- match: \\\'
scope: constant.character.escape
- match: \'
scope: punctuation.definition.string.end
pop: true
groups:
- match: \(
scope: punctuation.section.group.begin
push:
- meta_scope: meta.group
- match: \)
scope: punctuation.section.group.end
pop: true
- include: symbol-list
subscripts:
- match: \[
scope: punctuation.section.brackets.begin
push:
- meta_scope: meta.brackets
- match: \]
scope: punctuation.section.brackets.end
pop: true
- match: \b(\w+)\b
scope: variable.parameter