Teach chord parser about Minor7
authorScott Gasch <[email protected]>
Wed, 27 Apr 2022 00:57:07 +0000 (17:57 -0700)
committerScott Gasch <[email protected]>
Wed, 27 Apr 2022 00:57:07 +0000 (17:57 -0700)
music/chords.g4
music/chords.py

index 9083e7530a6ff1d5bc9b4c1f2a3c200b7f35af39..182461760d11f9e836740f2d5ec55a1567ce0a23 100644 (file)
@@ -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]+ ;
index 838ad17c567bfce81e35923915984dbc02e53ed3..dc2220545ad5b0f0836e91010b2b697694950760 100755 (executable)
@@ -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():