From: Scott Gasch Date: Wed, 27 Apr 2022 00:57:07 +0000 (-0700) Subject: Teach chord parser about Minor7 X-Git-Url: https://wannabe.guru.org/gitweb/?a=commitdiff_plain;h=facc01812f49cc05a615562fca7742208baa22d0;p=python_utils.git Teach chord parser about Minor7 --- 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():