-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
chord.pest
58 lines (35 loc) · 1.13 KB
/
chord.pest
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
letter = { 'A' .. 'G' }
accidental = { "#" | "♯" | "b" | "♭" }
note = { letter ~ accidental? ~ accidental? }
digit = { ASCII_DIGIT }
note_with_octave = { note ~ digit? }
minor = { "-" | "m" }
augmented = { "+" }
diminished = { "o" | "dim" }
half_diminished = { "ø" }
maj7_modifier = { "maj7" }
dominant_modifier = { "7" | "9" | "11" | "13" }
sus_modifier = { "sus2" | "sus4" }
add_modifier = { "add2" | "add4" | "add6" | "6" }
five_modifier = { "b5" | "♭5" | "#5" | "♯5" }
nine_modifier = { "add9" | "b9" | "♭9" | "#9" | "♯9" }
eleven_modifier = { "add11" | "b11" | "♭11" | "#11" | "♯11" }
thirteen_modifier = { "add13" | "b13" | "♭13" | "#13" | "♯13" }
modifier = { sus_modifier | add_modifier | five_modifier | nine_modifier | eleven_modifier | thirteen_modifier }
slash = { "/" }
at = { "@" }
hat = { "^" }
bang = { "!" }
WHITESPACE = _{ " " }
chord = {
SOI ~
note ~
(maj7_modifier | minor | augmented | diminished | half_diminished)? ~
(maj7_modifier | dominant_modifier)? ~
("("* ~ modifier ~ ")"*)* ~
(slash ~ note)? ~
(at ~ digit)? ~
(hat ~ digit)? ~
(bang)? ~
EOI
}