Skip to content

Commit c79eccb

Browse files
committed
feat(reference): Set up Language Reference
1 parent 0a0d489 commit c79eccb

File tree

8 files changed

+3946
-3428
lines changed

8 files changed

+3946
-3428
lines changed

docs_config.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ docs_groups:
4444
- guide/data_types
4545
- guide/pattern_matching
4646
- guide/imports_exports
47-
The Docs:
48-
- intro
4947
Standard Library:
5048
- stdlib/pervasives
5149
- stdlib/array
@@ -73,8 +71,16 @@ docs_groups:
7371
- stdlib/int64
7472
- stdlib/float32
7573
- stdlib/float64
76-
# TODO: Re-enable when docs are more mature
77-
# Language Constructs:
74+
# Language Reference:
75+
# - reference/introduction
76+
# - reference/lexical_structure:
77+
# - reference/lexical_structure/whitespace
78+
# - reference/lexical_structure/comments
79+
# - reference/lexical_structure/keywords
80+
# - reference/lexical_structure/identifiers
81+
# - reference/lexical_structure/literals
82+
# - reference/lexical_structure/operators
83+
# - reference/lexical_structure/delimiters
7884
# - constructs/bindings
7985
# - constructs/numbers
8086
# - constructs/booleans

grammars/EBNF.tmLanguage

Lines changed: 354 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,354 @@
1+
<!-- This is a modified version of the EBNF grammar from https://github.com/ppKrauss/EBNF-W3C.tmbundle used under the MIT license. -->
2+
<?xml version="1.0" encoding="UTF-8"?>
3+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
4+
<plist version="1.0">
5+
<dict>
6+
<key>fileTypes</key>
7+
<array>
8+
<string>ebnf</string>
9+
</array>
10+
<key>foldingStartMarker</key>
11+
<string>\(\*</string>
12+
<key>foldingStopMarker</key>
13+
<string>\*\)</string>
14+
<key>keyEquivalent</key>
15+
<string>^~E</string>
16+
<key>name</key>
17+
<string>EBNF</string>
18+
<key>patterns</key>
19+
<array>
20+
<dict>
21+
<key>include</key>
22+
<string>#comment</string>
23+
</dict>
24+
<dict>
25+
<key>begin</key>
26+
<string>\s*(\b(?:\w|\s|[\-_0-9])+\b)\s*(=)</string>
27+
<key>captures</key>
28+
<dict>
29+
<key>1</key>
30+
<dict>
31+
<key>name</key>
32+
<string>entity.name.function.ebnf</string>
33+
</dict>
34+
<key>2</key>
35+
<dict>
36+
<key>name</key>
37+
<string>keyword.operator.definition.ebnf</string>
38+
</dict>
39+
</dict>
40+
<key>end</key>
41+
<string>;</string>
42+
<key>endCaptures</key>
43+
<dict>
44+
<key>0</key>
45+
<dict>
46+
<key>name</key>
47+
<string>punctuation.terminator.syntax-rule.ebnf</string>
48+
</dict>
49+
</dict>
50+
<key>name</key>
51+
<string>meta.syntax-rule.ebnf</string>
52+
<key>patterns</key>
53+
<array>
54+
<dict>
55+
<key>include</key>
56+
<string>#comment</string>
57+
</dict>
58+
<dict>
59+
<key>include</key>
60+
<string>#subrules</string>
61+
</dict>
62+
</array>
63+
</dict>
64+
</array>
65+
<key>repository</key>
66+
<dict>
67+
<key>comment</key>
68+
<dict>
69+
<key>begin</key>
70+
<string>\(\*(?!\))</string>
71+
<key>end</key>
72+
<string>\*\)</string>
73+
<key>name</key>
74+
<string>comment.block.ebnf</string>
75+
</dict>
76+
<key>double-quote-string</key>
77+
<dict>
78+
<key>begin</key>
79+
<string>"</string>
80+
<key>end</key>
81+
<string>"</string>
82+
<key>name</key>
83+
<string>string.quoted.double.ebnf</string>
84+
</dict>
85+
<key>group</key>
86+
<dict>
87+
<key>begin</key>
88+
<string>\(</string>
89+
<key>beginCaptures</key>
90+
<dict>
91+
<key>0</key>
92+
<dict>
93+
<key>name</key>
94+
<string>keyword.other.group.begin.ebnf</string>
95+
</dict>
96+
</dict>
97+
<key>end</key>
98+
<string>\)</string>
99+
<key>endCaptures</key>
100+
<dict>
101+
<key>0</key>
102+
<dict>
103+
<key>name</key>
104+
<string>keyword.other.group.end.ebnf</string>
105+
</dict>
106+
</dict>
107+
<key>patterns</key>
108+
<array>
109+
<dict>
110+
<key>include</key>
111+
<string>#subrules</string>
112+
</dict>
113+
</array>
114+
</dict>
115+
<key>invalid</key>
116+
<dict>
117+
<key>match</key>
118+
<string>\(\s*[*:/]\s*\)</string>
119+
<key>name</key>
120+
<string>invalid.illegal.ebnf</string>
121+
</dict>
122+
<key>non-terminal</key>
123+
<dict>
124+
<key>match</key>
125+
<string>\w[\w\-_0-9]*\w</string>
126+
<key>name</key>
127+
<string>variable.other.non-terminal.ebnf</string>
128+
</dict>
129+
<key>token</key>
130+
<dict>
131+
<key>match</key>
132+
<string>[A-Z][A-Z\-_0-9]*</string>
133+
<key>name</key>
134+
<string>support.constant.token.ebnf</string>
135+
</dict>
136+
<key>operator</key>
137+
<dict>
138+
<key>patterns</key>
139+
<array>
140+
<dict>
141+
<key>include</key>
142+
<string>#operator-alternative</string>
143+
</dict>
144+
<dict>
145+
<key>include</key>
146+
<string>#operator-concatenation</string>
147+
</dict>
148+
<dict>
149+
<key>include</key>
150+
<string>#operator-exception</string>
151+
</dict>
152+
</array>
153+
</dict>
154+
<key>operator-alternative</key>
155+
<dict>
156+
<key>match</key>
157+
<string>\|</string>
158+
<key>name</key>
159+
<string>keyword.operator.alternative.ebnf</string>
160+
</dict>
161+
<key>operator-concatenation</key>
162+
<dict>
163+
<key>match</key>
164+
<string>,</string>
165+
<key>name</key>
166+
<string>keyword.operator.concatenation.ebnf</string>
167+
</dict>
168+
<key>operator-exception</key>
169+
<dict>
170+
<key>match</key>
171+
<string>-</string>
172+
<key>name</key>
173+
<string>keyword.operator.exception.ebnf</string>
174+
</dict>
175+
<key>optional</key>
176+
<dict>
177+
<key>begin</key>
178+
<string>\[</string>
179+
<key>beginCaptures</key>
180+
<dict>
181+
<key>0</key>
182+
<dict>
183+
<key>name</key>
184+
<string>keyword.other.optional.begin.ebnf</string>
185+
</dict>
186+
</dict>
187+
<key>end</key>
188+
<string>\]</string>
189+
<key>endCaptures</key>
190+
<dict>
191+
<key>0</key>
192+
<dict>
193+
<key>name</key>
194+
<string>keyword.other.optional.end.ebnf</string>
195+
</dict>
196+
</dict>
197+
<key>patterns</key>
198+
<array>
199+
<dict>
200+
<key>include</key>
201+
<string>#subrules</string>
202+
</dict>
203+
</array>
204+
</dict>
205+
<key>repetition</key>
206+
<dict>
207+
<key>patterns</key>
208+
<array>
209+
<dict>
210+
<key>match</key>
211+
<string>(\?|\*|\+)</string>
212+
<key>name</key>
213+
<string>keyword.other.repetition.ebnf</string>
214+
</dict>
215+
<dict>
216+
<key>begin</key>
217+
<string>{</string>
218+
<key>beginCaptures</key>
219+
<dict>
220+
<key>0</key>
221+
<dict>
222+
<key>name</key>
223+
<string>keyword.other.repetition.begin.ebnf</string>
224+
</dict>
225+
</dict>
226+
<key>end</key>
227+
<string>}</string>
228+
<key>endCaptures</key>
229+
<dict>
230+
<key>0</key>
231+
<dict>
232+
<key>name</key>
233+
<string>keyword.other.repetition.end.ebnf</string>
234+
</dict>
235+
</dict>
236+
<key>patterns</key>
237+
<array>
238+
<dict>
239+
<key>include</key>
240+
<string>#subrules</string>
241+
</dict>
242+
</array>
243+
</dict>
244+
</array>
245+
</dict>
246+
<key>repetition-numbered</key>
247+
<dict>
248+
<key>captures</key>
249+
<dict>
250+
<key>1</key>
251+
<dict>
252+
<key>name</key>
253+
<string>constant.numeric.integer.ebnf</string>
254+
</dict>
255+
<key>2</key>
256+
<dict>
257+
<key>name</key>
258+
<string>keyword.operator.repetition.ebnf</string>
259+
</dict>
260+
</dict>
261+
<key>match</key>
262+
<string>(\d+)\s*(\*)</string>
263+
</dict>
264+
<key>single-quote-string</key>
265+
<dict>
266+
<key>begin</key>
267+
<string>'</string>
268+
<key>end</key>
269+
<string>'</string>
270+
<key>name</key>
271+
<string>string.quoted.single.ebnf</string>
272+
</dict>
273+
<key>special-sequence</key>
274+
<dict>
275+
<key>begin</key>
276+
<string>\?</string>
277+
<key>beginCaptures</key>
278+
<dict>
279+
<key>0</key>
280+
<dict>
281+
<key>name</key>
282+
<string>keyword.other.special-sequence.begin.ebnf</string>
283+
</dict>
284+
</dict>
285+
<key>end</key>
286+
<string>\?</string>
287+
<key>endCaptures</key>
288+
<dict>
289+
<key>0</key>
290+
<dict>
291+
<key>name</key>
292+
<string>keyword.other.special-sequence.end.ebnf</string>
293+
</dict>
294+
</dict>
295+
<key>name</key>
296+
<string>entity.other.attribute-name.ebnf</string>
297+
</dict>
298+
<key>subrules</key>
299+
<dict>
300+
<key>patterns</key>
301+
<array>
302+
<dict>
303+
<key>include</key>
304+
<string>#invalid</string>
305+
</dict>
306+
<dict>
307+
<key>include</key>
308+
<string>#optional</string>
309+
</dict>
310+
<dict>
311+
<key>include</key>
312+
<string>#repetition</string>
313+
</dict>
314+
<dict>
315+
<key>include</key>
316+
<string>#group</string>
317+
</dict>
318+
<dict>
319+
<key>include</key>
320+
<string>#repetition-numbered</string>
321+
</dict>
322+
<dict>
323+
<key>include</key>
324+
<string>#token</string>
325+
</dict>
326+
<dict>
327+
<key>include</key>
328+
<string>#non-terminal</string>
329+
</dict>
330+
<dict>
331+
<key>include</key>
332+
<string>#operator</string>
333+
</dict>
334+
<dict>
335+
<key>include</key>
336+
<string>#single-quote-string</string>
337+
</dict>
338+
<dict>
339+
<key>include</key>
340+
<string>#double-quote-string</string>
341+
</dict>
342+
<dict>
343+
<key>include</key>
344+
<string>#special-sequence</string>
345+
</dict>
346+
</array>
347+
</dict>
348+
</dict>
349+
<key>scopeName</key>
350+
<string>source.ebnf</string>
351+
<key>uuid</key>
352+
<string>D9954069-097B-4361-818D-EF4986D442E7</string>
353+
</dict>
354+
</plist>

0 commit comments

Comments
 (0)