diff options
| author | Scott Gasch <[email protected]> | 2022-04-26 17:57:07 -0700 |
|---|---|---|
| committer | Scott Gasch <[email protected]> | 2022-04-26 17:57:07 -0700 |
| commit | facc01812f49cc05a615562fca7742208baa22d0 (patch) | |
| tree | 2463fab8ad76bd3f5dd77b1eb6f04e6b263a1a1c /music | |
| parent | cb9bce0850083584481a628f03e35687374df894 (diff) | |
Teach chord parser about Minor7
Diffstat (limited to 'music')
| -rw-r--r-- | music/chords.g4 | 6 | ||||
| -rwxr-xr-x | music/chords.py | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/music/chords.g4 b/music/chords.g4 index 9083e75..1824617 100644 --- a/music/chords.g4 +++ b/music/chords.g4 @@ -17,7 +17,8 @@ grammar chords; parse - : rootNote majMinSusPowerExpr* addNotesExpr* extensionExpr* overBassNoteExpr* + : rootNote majMinSusPowerExpr* addNotesExpr* overBassNoteExpr* + | rootNote majMinSusPowerExpr* addNotesExpr extensionExpr* overBassNoteExpr ; rootNote @@ -53,6 +54,7 @@ addNotesExpr : ADD* SIX | ADD* SEVEN | MAJ_SEVEN + | MIN_SEVEN | ADD* NINE | ADD* ELEVEN ; @@ -127,6 +129,8 @@ ELEVEN: '11'; MAJ_SEVEN: MAJOR '7'; +MIN_SEVEN: MINOR '7'; + INTERVAL: (MAJOR|MINOR)* ('b'|'#')* DIGITS ; DIGITS: [1-9]+ ; diff --git a/music/chords.py b/music/chords.py index 838ad17..dc22205 100755 --- a/music/chords.py +++ b/music/chords.py @@ -399,6 +399,9 @@ class ChordParser(chordsListener): self.addedNotes.append('min7') if ctx.MAJ_SEVEN(): self.addedNotes.append('maj7') + if ctx.MIN_SEVEN(): + self.addedNotes.append('min7') + self.chordType = ChordParser.MINOR if ctx.NINE(): self.addedNotes.append('maj9') if ctx.ELEVEN(): |
