-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathixml.ixml
66 lines (60 loc) · 1.9 KB
/
ixml.ixml
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
ixml: S, rule+.
-S: (whitespace; comment)*.
-whitespace: -[Zs]; tab; lf; cr.
-tab: -#9.
-lf: -#a.
-cr: -#d.
comment: -"{", (cchar; comment)*, -"}".
-cchar: ~["{}"].
rule: (mark, S)?, name, S, ["=:"], S, -alts, ".", S.
@mark: ["@^-"].
alts: alt+([";|"], S).
alt: term*(",", S).
-term: factor;
option;
repeat0;
repeat1.
-factor: terminal;
nonterminal;
"(", S, alts, ")", S.
repeat0: factor, "*", S, sep?.
repeat1: factor, "+", S, sep?.
option: factor, "?", S.
sep: factor.
nonterminal: (mark, S)?, name, S.
-terminal: literal;
charset.
literal: quoted;
encoded.
-quoted: (tmark, S)?, -string.
@name: namestart, namefollower*.
-namestart: ["_"; Ll; Lu; Lm; Lt; Lo].
-namefollower: namestart; ["-.·‿⁀"; Nd; Mn].
@tmark: ["^-"].
string: -'"', dstring, -'"', S;
-"'", sstring, -"'", S.
@dstring: dchar+.
@sstring: schar+.
dchar: ~['"'];
'"', -'"'. {all characters, quotes must be doubled}
schar: ~["'"];
"'", -"'". {all characters, quotes must be doubled}
-encoded: (tmark, S)?, -"#", @hex, S.
hex: ["0"-"9"; "a"-"f"; "A"-"F"]+.
-charset: inclusion;
exclusion.
inclusion: (tmark, S)?, set.
exclusion: (tmark, S)?, "~", S, set.
-set: "[", S, member+([";|"], S), "]", S.
-member: literal;
range;
class.
range: from, "-", S, to.
@from: character.
@to: character.
-character: -'"', dchar, -'"', S;
-"'", schar, -"'", S;
"#", hex, S.
class: @code.
code: letter, letter, S.
-letter: ["a"-"z"; "A"-"Z"].