-
Notifications
You must be signed in to change notification settings - Fork 2
/
csparser.ebnf
85 lines (54 loc) · 1.28 KB
/
csparser.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
CS
::= Expr* EOF
Expr
::= comments? ( items ( statement (statement)* )? ) Separator?
statement ::= Operator items
items ::= item ("," item)*
item ::= (URI | literal ) selector?
selector ::= "." nstring
Separator
::= ';'
literal
::= '"' astring '"'
URI
::= "[" scheme? hostport? (segment)* fragment? query? headers "]"
header
::= literal ":" literal
headers
::= header*
host
::= nstring
port
::= digit (digit)*
hostport
::= (userpass "@")? host (":" port)?
userpass
::= user ":"
user ::= nstring
pass ::= astring
segment
::= path_delim pstring path_delim?
query
::= '?' astring
fragment
::= '#' astring
comments ::= "//" astring (astring)*
whitespace
::= S^WS
/* ws: definition */
<?TOKENS?>
scheme
::= ("https" | "http" | "file") '://'
Operator
::= '|' | '=|' | ">>" | '>' | '!' | "!=" | "==" | "=&" | "=" | "~=" | ":" | ":>" | "?>"
nstring ::= alpha (alpha | schar | digit)*
pstring ::= pall (pall)*
pall ::= Operator | alpha | digit | schar
astring ::= all (all | S )*
all ::= Operator | alpha | digit | schar | path_delim
schar ::= "_" | "." | "<" | ">" | "</" | "'" | "," | ";" | "&" | "{" | "}" | "-"
path_delim ::= '/'
digit ::= [0-9]
alpha ::= [a-z] | [A-Z]
S ::= ( #x0020 | #x0009 | #x000D | #x000A )+
EOF ::= $