martijnversluis / ChordSheetJS

A JavaScript library for parsing and formatting chords and chord sheets
https://github.com/users/martijnversluis/projects/4
GNU General Public License v2.0
318 stars 50 forks source link

Lyric started by [A-G] and without Chord Over throw exception [Chords Over Words Parser] #821

Closed acneidert closed 1 year ago

acneidert commented 1 year ago

This part throw exception because lyric start with "A" and don't have chords over. Throws not only in initial verse, but in middle too

title: Let it be
key: C

And when the broken-hearted people
 Am      F      F6
Living in the world agree
 C         G      F Em/F F6 C
There will be an answer, let it be
davehell commented 1 year ago

The same problem is for the lines started by [1-7] in Chords Over Words Parser. Iยดm using version 7.16.0.

1. line of the first paragraph
   And when the broken-hearted people
   Am      F      F6
   Living in the world agree

The error message is:

PeggySyntaxError: Expected "#", "-", "/", ":", "I", "II", "III", "IV", "V", "VI", "VII", "\n", "\r", "b", "i", "ii", "iii", "iv", "v", "vi", "vii", "|", [1-7], [A-G,a-g], [a-z,A-Z,0-9,(,),#,+], [a-z,A-Z,0-9,\-,_], or end of input but "." found.
martijnversluis commented 1 year ago

Hey @davehell. Thanks for reaching out. I'm currently working on a refactor where I also stumbled upon this issue. I'll link them so you're kept in the loop ๐Ÿ‘

https://github.com/bettermusic/ChordSheetJS/pull/308

mholta commented 1 year ago

Thank you for this fantastic library @martijnversluis!๐Ÿ”ฅ Are there any way to contribute in solving this issue?

martijnversluis commented 1 year ago

Hey @mholta. Thanks for reaching out.

There are ways! The issue is in the PegJS grammar for chords over words. I tries to distinguish lyrics from chords, but when a word is also a valid chord parsing goes south.

So if you have some PegJS experience, or if you know somebody who does, that could be a great help in solving the issue!

martijnversluis commented 1 year ago

This issue has been solved! ๐ŸŽ‰ If you update to 8.2.0 these chord sheets are correctly parsed ๐Ÿ‘