-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtree-sitter-markdown.ebnf
334 lines (240 loc) · 6.66 KB
/
tree-sitter-markdown.ebnf
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
//
// From tree-sitter-markdown/src/grammar.json
//
//
// EBNF to generate railroad diagram at
// (IPV6) https://www.bottlecaps.de/rr/ui
// (IPV4) https://rr.red-dove.com/ui
//
document ::=
( _blk_nod | _bnk_lbk )* _eof
_blk_nod ::=
_thm_brk
| _pgh
| _lnk_ref_def
| _stx
| _atx
| _ind_cod
| _fen_cod
| _htm_blk_scr
| _htm_blk_cmt
| _htm_blk_prc
| _htm_blk_dcl
| _htm_blk_cda
| _htm_blk_div
| _htm_blk_cmp
| _bqt
| _tig_lst
| _los_lst
| _tbl
_thm_brk ::=
_thm_brk_hed _thm_brk_end_mkr
_thm_brk_hed ::=
_thm_brk_bgn
_pgh ::=
_pgh_hed _pgh_end_mkr
_pgh_hed ::=
_pgh_bgn_mkr ( _inl_nod | _inl_lbk )*
_lnk_ref_def ::=
_lnk_ref_def_hed _lnk_ref_def_end_mkr
_lnk_ref_def_hed ::=
_pgh_bgn_mkr _lnk_ref_def_bgn ( _txt | _bsl_esc )* _lnk_end _lnk_ref_def_cln _lnk_dst _lnk_tit?
_stx ::=
_stx_hed _stx_end_mkr
_stx_bgn ::=
_stx_bgn_1
| _stx_bgn_2
_stx_hed ::=
_pgh_hed _pgh_end_mkr _stx_bgn
_atx ::=
_atx_hed _atx_end_mkr
_atx_bgn ::=
_atx_bgn_1
| _atx_bgn_2
| _atx_bgn_3
| _atx_bgn_4
| _atx_bgn_5
| _atx_bgn_6
_atx_hed ::=
_atx_bgn _inl_nod* _atx_end?
_ind_cod ::=
_ind_cod_bgn_pfx _ind_cod_hed _ind_cod_end_mkr
_ind_cod_hed ::=
_ind_cod_bgn_mkr ( _vtr_spc | _txt | _blk_lbk )*
_fen_cod ::=
_fen_cod_hed _fen_cod_end_mkr
_fen_cod_hed ::=
_fen_cod_bgn _fen_cod_inf? ( _blk_lbk _fen_cod_ctn? )? ( _blk_lbk _fen_cod_end )?
_fen_cod_inf ::=
_fen_cod_inf_bgn_mkr ( _inl_txt )* _fen_cod_inf_end_mkr
_fen_cod_ctn ::=
_fen_cod_ctn_bgn_mkr ( _vtr_spc | _txt | _blk_lbk )*
_htm_blk_scr ::=
_htm_blk_scr_hed _htm_blk_scr_end_mkr
_htm_blk_scr_hed ::=
_htm_blk_scr_bgn_mkr ( _vtr_spc | _txt | _blk_lbk )* _htm_blk_scr_end?
_htm_blk_cmt ::=
_htm_blk_cmt_hed _htm_blk_cmt_end_mkr
_htm_blk_cmt_hed ::=
_htm_blk_cmt_bgn_mkr ( _vtr_spc | _txt | _blk_lbk )* _htm_blk_cmt_end?
_htm_blk_prc ::=
_htm_blk_prc_hed _htm_blk_prc_end_mkr
_htm_blk_prc_hed ::=
_htm_blk_prc_bgn_mkr ( _vtr_spc | _txt | _blk_lbk )* _htm_blk_prc_end?
_htm_blk_dcl ::=
_htm_blk_dcl_hed _htm_blk_dcl_end_mkr
_htm_blk_dcl_hed ::=
_htm_blk_dcl_bgn_mkr ( _vtr_spc | _txt | _blk_lbk )* _htm_blk_dcl_end?
_htm_blk_cda ::=
_htm_blk_cda_hed _htm_blk_cda_end_mkr
_htm_blk_cda_hed ::=
_htm_blk_cda_bgn_mkr ( _vtr_spc | _txt | _blk_lbk )* _htm_blk_cda_end?
_htm_blk_div ::=
_htm_blk_div_hed _htm_blk_div_end_mkr
_htm_blk_div_hed ::=
_htm_blk_div_bgn_mkr ( _vtr_spc | _txt | _blk_lbk )*
_htm_blk_cmp ::=
_htm_blk_cmp_hed _htm_blk_cmp_end_mkr
_htm_blk_cmp_hed ::=
_htm_blk_cmp_bgn_mkr ( _vtr_spc | _txt | _blk_lbk )*
_bqt ::=
_bqt_hed _bqt_end_mkr
_bqt_hed ::=
_bqt_bgn ( _blk_nod | _bnk_lbk )*
_tig_lst ::=
_tig_lst_hed _lst_end_mkr
_tig_lst_hed ::=
_lst_bgn_mkr _tig_lst_itm*
_los_lst ::=
_los_lst_hed _lst_end_mkr
_los_lst_hed ::=
_lst_bgn_mkr _tig_lst_itm* ( _bnk_lbk | _los_lst_itm ) ( _tig_lst_itm | _los_lst_itm | _bnk_lbk )*
_tig_lst_itm ::=
( _tig_lst_itm_hed | _tig_chk_box_lst_itm_hed ) _lst_itm_cnt_end_mkr _lst_itm_end_mkr
_tig_lst_itm_hed ::=
_lst_itm_bgn _lst_itm_cnt_bgn_mkr _chk_box_lik_stx? _blk_nod*
_tig_chk_box_lst_itm_hed ::=
_lst_itm_bgn _lst_itm_cnt_bgn_mkr _chk_box_pgh _blk_nod*
_los_lst_itm ::=
( _los_lst_itm_hed | _los_chk_box_lst_itm_hed ) _lst_itm_cnt_end_mkr _lst_itm_end_mkr
_los_lst_itm_hed ::=
_lst_itm_bgn _lst_itm_cnt_bgn_mkr _chk_box_lik_stx? _blk_nod* _bnk_lbk ( _bnk_lbk | _blk_nod )*
_los_chk_box_lst_itm_hed ::=
_lst_itm_bgn _lst_itm_cnt_bgn_mkr _chk_box_pgh _blk_nod* _bnk_lbk ( _bnk_lbk | _blk_nod )*
_chk_box_pgh ::=
_pgh_bgn_mkr _chk_box_pgh_ctn _pgh_end_mkr
_chk_box_pgh_ctn ::=
_lst_chk_box ( _inl_nod | _inl_lbk )*
_chk_box_lik_stx ::=
_chk_box_lik_stx_hed _stx_end_mkr
_chk_box_lik_stx_hed ::=
_pgh_bgn_mkr _chk_box_lik_stx_ctn _pgh_end_mkr _stx_bgn
_chk_box_lik_stx_ctn ::=
_lst_chk_box ( _inl_nod | _inl_lbk )*
_tbl ::=
_tbl_hed_row _tbl_dlm_row _tbl_dat_row*
_tbl_hed_row ::=
_tbl_hed_row_hed _tbl_row_end_mkr
_tbl_hed_row_hed ::=
_tbl_hed_row_bgn_mkr _tbl_col_sep? _tbl_dat_cel ( _tbl_col_sep _tbl_dat_cel )* _tbl_col_sep?
_tbl_dlm_row ::=
_tbl_dlm_row_hed _tbl_row_end_mkr
_tbl_dlm_row_hed ::=
_tbl_dlm_row_bgn_mkr _tbl_col_sep? _tbl_col_aln ( _tbl_col_sep _tbl_col_aln )* _tbl_col_sep?
_tbl_dat_row ::=
_tbl_dat_row_hed _tbl_row_end_mkr
_tbl_dat_row_hed ::=
_tbl_dat_row_bgn_mkr _tbl_col_sep? _tbl_dat_cel ( _tbl_col_sep _tbl_dat_cel )* _tbl_col_sep?
_tbl_dat_cel ::=
_inl_nod+
_inl_nod ::=
_inl_txt
| _emp
| _stg
| _del
| _lnk
| _img
| _ext_www_aut_lnk
| _ext_url_aut_lnk
| _ext_eml_aut_lnk
| _uri_aut_lnk
| _eml_aut_lnk
| _cod_spn
| _htm_opn_tag
| _htm_slf_cls_tag
| _htm_cls_tag
| _htm_cmt
| _htm_prc
| _htm_dcl
| _htm_cda
_inl_txt ::=
_txt
| _bsl_esc
| _chr_ref
_inl_lbk ::=
_sft_lbk
| _hrd_lbk
_emp ::=
_emp_bgn ( _inl_nod | _inl_lbk )* _emp_end
_stg ::=
_stg_bgn ( _inl_nod | _inl_lbk )* _stg_end
_del ::=
_del_bgn ( _inl_nod | _inl_lbk )* _del_end
_lnk ::=
_lnk_bgn ( _inl_nod | _inl_lbk )* _lnk_tal
_img ::=
_img_bgn ( _inl_nod | _inl_lbk )* _lnk_tal
_lnk_tal ::=
_lnk_end ( _lnk_tal_inl | _lnk_tal_ful | _lnk_tal_clp )?
_lnk_tal_inl ::=
_lnk_inl_bgn ( _lnk_dst _lnk_tit? )? _lnk_inl_end
_lnk_tal_ful ::=
_lnk_ref_bgn ( _txt | _bsl_esc )+ _lnk_ref_end
_lnk_tal_clp ::=
_lnk_ref_bgn _lnk_ref_end
_lnk_dst ::=
_lnk_dst_bgn _inl_txt* _lnk_dst_end
| _lnk_dst_bgn_mkr _inl_txt* _lnk_dst_end_mkr
_lnk_tit ::=
_lnk_tit_bgn _inl_txt* _lnk_tit_end
_ext_www_aut_lnk ::=
_ext_www_aut_lnk_hed _ext_aut_lnk_end_mkr
_ext_www_aut_lnk_hed ::=
_ext_www_aut_lnk_bgn_mkr ( _txt | _bsl_esc )*
_ext_url_aut_lnk ::=
_ext_url_aut_lnk_hed _ext_aut_lnk_end_mkr
_ext_url_aut_lnk_hed ::=
_ext_url_aut_lnk_bgn_mkr ( _txt | _bsl_esc )*
_ext_eml_aut_lnk ::=
_ext_eml_aut_lnk_hed _ext_aut_lnk_end_mkr
_ext_eml_aut_lnk_hed ::=
_ext_eml_aut_lnk_bgn_mkr ( _txt | _bsl_esc )*
_uri_aut_lnk ::=
_uri_aut_lnk_bgn ( _txt | _bsl_esc )* _aut_lnk_end
_eml_aut_lnk ::=
_eml_aut_lnk_bgn ( _txt | _bsl_esc )* _aut_lnk_end
_cod_spn ::=
_cod_spn_bgn ( _txt | _bsl_esc )* _cod_spn_end
_htm_opn_tag ::=
_htm_opn_tag_hed _htm_tag_end
_htm_slf_cls_tag ::=
_htm_opn_tag_hed _htm_slf_tag_end
_htm_opn_tag_hed ::=
_htm_opn_tag_bgn _wrd _htm_atr*
_htm_cls_tag ::=
_htm_cls_tag_bgn _wrd _htm_tag_end
_htm_cmt ::=
_htm_cmt_bgn ( _txt | _bsl_esc )* _htm_cmt_end
_htm_prc ::=
_htm_prc_bgn ( _txt | _bsl_esc )* _htm_prc_end
_htm_dcl ::=
_htm_dcl_bgn _wrd ( _txt | _bsl_esc )* _htm_tag_end
_htm_cda ::=
_htm_cda_bgn ( _txt | _bsl_esc )* _htm_cda_end
_htm_atr ::=
_wrd ( _htm_atr_eql _htm_atr_val )?
_htm_atr_val ::=
_htm_atr_val_bgn ( _txt | _bsl_esc )* _htm_atr_val_end
| _htm_atr_val_bgn_mkr ( _txt | _bsl_esc )* _htm_atr_val_end_mkr
_txt ::=
_txt_frg+