-
Notifications
You must be signed in to change notification settings - Fork 0
/
ocamlyacc.syntax
184 lines (184 loc) · 5.36 KB
/
ocamlyacc.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
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
---
name: OCamlyacc
fileTypes:
- mly
scopeName: source.ocamlyacc
repository:
declaration-matches:
patterns:
- name: meta.token.declaration.ocamlyacc
begin: (%)(token)
beginCaptures:
"1":
name: keyword.other.decorator.token.ocamlyacc
"2":
name: keyword.other.token.ocamlyacc
end: ^\s*($|(^\s*(?=%)))
patterns:
- include: "#symbol-types"
- name: entity.name.type.token.ocamlyacc
match: "[A-Z][A-Za-z0-9_]*"
- include: "#comments"
- name: meta.token.associativity.ocamlyacc
begin: (%)(left|right|nonassoc)
beginCaptures:
"1":
name: keyword.other.decorator.token.associativity.ocamlyacc
"2":
name: keyword.other.token.associativity.ocamlyacc
end: (^\s*$)|(^\s*(?=%))
patterns:
- name: entity.name.type.token.ocamlyacc
match: "[A-Z][A-Za-z0-9_]*"
- name: entity.name.function.non-terminal.reference.ocamlyacc
match: "[a-z][A-Za-z0-9_]*"
- include: "#comments"
- name: meta.start-symbol.ocamlyacc
begin: (%)(start)
beginCaptures:
"1":
name: keyword.other.decorator.start-symbol.ocamlyacc
"2":
name: keyword.other.start-symbol.ocamlyacc
end: (^\s*$)|(^\s*(?=%))
patterns:
- name: entity.name.function.non-terminal.reference.ocamlyacc
match: "[a-z][A-Za-z0-9_]*"
- include: "#comments"
- name: meta.symbol-type.ocamlyacc
begin: (%)(type)
beginCaptures:
"1":
name: keyword.other.decorator.symbol-type.ocamlyacc
"2":
name: keyword.other.symbol-type.ocamlyacc
end: $\s*(?!%)
patterns:
- include: "#symbol-types"
- name: entity.name.type.token.reference.ocamlyacc
match: "[A-Z][A-Za-z0-9_]*"
- name: entity.name.function.non-terminal.reference.ocamlyacc
match: "[a-z][A-Za-z0-9_]*"
- include: "#comments"
references:
patterns:
- name: entity.name.function.non-terminal.reference.ocamlyacc
match: "[a-z][a-zA-Z0-9_]*"
- name: entity.name.type.token.reference.ocamlyacc
match: "[A-Z][a-zA-Z0-9_]*"
precs:
patterns:
- name: meta.precidence.declaration
captures:
"1":
name: keyword.other.decorator.precedence.ocamlyacc
"2":
name: keyword.other.precedence.ocamlyacc
"4":
name: entity.name.function.non-terminal.reference.ocamlyacc
"5":
name: entity.name.type.token.reference.ocamlyacc
match: (%)(prec)\s+(([a-z][a-zA-Z0-9_]*)|(([A-Z][a-zA-Z0-9_]*)))
comments:
patterns:
- name: comment.block.ocamlyacc
begin: /\*
end: \*/
patterns:
- include: "#comments"
- name: comment.block.string.quoted.double.ocamlyacc
begin: (?=[^\\])(")
end: "\""
patterns:
- name: comment.block.string.constant.character.escape.ocamlyacc
match: \\(x[a-fA-F0-9][a-fA-F0-9]|[0-2]\d\d|[bnrt'"\\])
semantic-actions:
patterns:
- name: meta.action.semantic.ocamlyacc
endCaptures:
"1":
name: punctuation.definition.action.semantic.ocamlyacc
begin: "[^\\']({)"
beginCaptures:
"1":
name: punctuation.definition.action.semantic.ocamlyacc
end: (})
patterns:
- include: source.ocaml
rules:
patterns:
- name: meta.non-terminal.ocamlyacc
endCaptures:
"0":
name: punctuation.separator.rule.ocamlyacc
begin: "[a-z][a-zA-Z_]*"
beginCaptures:
"0":
name: entity.name.function.non-terminal.ocamlyacc
end: ;
patterns:
- include: "#rule-patterns"
symbol-types:
patterns:
- name: meta.token.type-declaration.ocamlyacc
endCaptures:
"0":
name: punctuation.definition.type-declaration.end.ocamlyacc
begin: <
beginCaptures:
"0":
name: punctuation.definition.type-declaration.begin.ocamlyacc
end: ">"
patterns:
- include: source.ocaml
rule-patterns:
patterns:
- name: meta.rule-match.ocaml
begin: ((?<!\||:)(\||:)(?!\||:))
beginCaptures:
"0":
name: punctuation.separator.rule.ocamlyacc
end: \s*(?=\||;)
patterns:
- include: "#precs"
- include: "#semantic-actions"
- include: "#references"
- include: "#comments"
uuid: 1B59327E-9B82-4B78-9411-BC02067DBDF9
foldingStartMarker: "%{|%%"
patterns:
- name: meta.header.ocamlyacc
endCaptures:
"1":
name: punctuation.section.header.end.ocamlyacc
begin: (%{)\s*$
beginCaptures:
"1":
name: punctuation.section.header.begin.ocamlyacc
end: ^\s*(%})
patterns:
- include: source.ocaml
- name: meta.declarations.ocamlyacc
begin: (?<=%})\s*$
end: (?:^)(?=%%)
patterns:
- include: "#comments"
- include: "#declaration-matches"
- name: meta.rules.ocamlyacc
endCaptures:
"1":
name: punctuation.section.rules.end.ocamlyacc
begin: (%%)\s*$
beginCaptures:
"1":
name: punctuation.section.rules.begin.ocamlyacc
end: ^\s*(%%)
patterns:
- include: "#comments"
- include: "#rules"
- include: source.ocaml
- include: "#comments"
- name: invalid.illegal.unrecognized-character.ocaml
match: "(\xE2\x80\x99|\xE2\x80\x98|\xE2\x80\x9C|\xE2\x80\x9D)"
foldingStopMarker: "%}|%%"
keyEquivalent: ^~O