-
Notifications
You must be signed in to change notification settings - Fork 3
/
tree-sitter-elisp.ebnf
110 lines (87 loc) · 2.01 KB
/
tree-sitter-elisp.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
//
// From tree-sitter-elisp/src/grammar.json
//
//
// EBNF to generate railroad diagram at
// (IPV6) https://www.bottlecaps.de/rr/ui
// (IPV4) https://rr.red-dove.com/ui
//
source_file ::=
_sexp*
_sexp ::=
special_form
| function_definition
| macro_definition
| list
| vector
| hash_table
| bytecode
| string_text_properties
| _atom
| quote
| unquote_splice
| unquote
special_form ::=
'(' ( 'and' | 'catch' | 'cond' | 'condition-case' | 'defconst' | 'defvar' | 'function' | 'if' | 'interactive' | 'lambda' | 'let' | 'let*' | 'or' | 'prog1' | 'prog2' | 'progn' | 'quote' | 'save-current-buffer' | 'save-excursion' | 'save-restriction' | 'setq' | 'setq-default' | 'unwind-protect' | 'while' ) _sexp* ')'
function_definition ::=
'(' ( 'defun' | 'defsubst' ) symbol _sexp? string? _sexp* ')'
macro_definition ::=
'(' 'defmacro' symbol _sexp? string? _sexp* ')'
_atom ::=
float
| integer
| char
| string
| byte_compiled_file_name
| symbol
float ::=
[+-]?[0-9]*'.'[0-9]+
| [+-]?[0-9]+[eE][0-9]+
| [+-]?[0-9]*'.'[0-9]+[eE][0-9]+
| '-'?'1.0'[eE]'\'+'INF'
| '-'?'0.0'[eE]'\'+'NaN'
integer ::=
[+-]?[0-9]+'.'?
| '#'([box]|[0-9][0-9]?'r')[0-9a-zA-Z]
char ::=
'\'?('\.'|'.')
| '\'?'\N\{'[^}]+'\}'
| '\'?'\u'[0-9a-fA-F]'{4}'
| '\'?'\U'[0-9a-fA-F]'{8}'
| '\'?'\x'[0-9a-fA-F]+
| '\'?'\'[0-7]'{1,3}'
| '\'?('\'(([CMSHsA]'-')|'\^'))+('\;'|'.')
| '\'?'\M-\'[0-9]'{1,3}'
string ::=
( '"' ( [^"\] | '\\' ('.'|'#x0A') )* '"' )
byte_compiled_file_name ::=
'#$'
symbol ::=
'nil'
| 't'
| 'defun'
| 'defsubst'
| 'defmacro'
| '\'('`'|"'"|",")
| ([^?#x23 #x0A #x09#x0A#x0B#x0C#x0D#x0C()#x5B#x5D'`,\";]|"\.")([^#x23 #x0A #x09#x0A#x0B#x0C#x0D#x0C()#x5B#x5D'`,\";]|"\.")*
| '##'
quote ::=
( "#'" | "'" | '`' ) _sexp
unquote_splice ::=
',@' _sexp
unquote ::=
',' _sexp
dot ::=
'.'
list ::=
'(' ( _sexp* ) ')'
vector ::=
'[' _sexp* ']'
bytecode ::=
'#[' _sexp* ']'
string_text_properties ::=
'#(' string _sexp* ')'
hash_table ::=
'#s(hash-table' _sexp* ')'
comment ::=
';.'*