-
Notifications
You must be signed in to change notification settings - Fork 2
/
tree-sitter-jsdoc.ebnf
66 lines (48 loc) · 1.47 KB
/
tree-sitter-jsdoc.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
//
// From tree-sitter-jsdoc/src/grammar.json
//
//
// EBNF to generate railroad diagram at
// (IPV6) https://www.bottlecaps.de/rr/ui
// (IPV4) https://rr.red-dove.com/ui
//
document ::=
_begin description? tag* _end
description ::=
_text ( _text | inline_tag | _inline_tag_false_positive )*
tag ::=
tag_name_with_argument ( '{' type '}' )? _expression? description?
| tag_name_with_type ( '{' type '}' )? description?
| tag_name description?
inline_tag ::=
'{' tag_name description '}'
_inline_tag_false_positive ::=
'\{'[^@}]+'\}'?
tag_name_with_argument ::=
( '@access' | '@alias' | '@api' | '@augments' | '@borrows' | '@callback' | '@constructor' | '@event' | '@exports' | '@external' | '@extends' | '@fires' | '@function' | '@mixes' | '@name' | '@namespace' | '@param' | '@property' | '@prop' | '@satisfies' | '@typedef' )
tag_name_with_type ::=
( '@return' | '@returns' | '@throw' | '@throws' | '@type' )
tag_name ::=
'@'[a-zA-Z_]+
_expression ::=
identifier
| optional_identifier
| member_expression
| path_expression
| qualified_expression
qualified_expression ::=
identifier ':' _expression
path_expression ::=
identifier '/' identifier
member_expression ::=
_expression ( '.' | '#' | '~' ) ( identifier | qualified_expression )
optional_identifier ::=
'[' identifier ']'
identifier ::=
[a-zA-Z_$][a-zA-Z_$0-9]*
_text ::=
[^*{}@ #x09#x0A#x0B#x0C#x0D][^*{}#x0A]*([^*/{}#x0A][^*{}#x0A]*'\'*+)*
_begin ::=
( '/' '*'* )
_end ::=
'/'