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

ChordProParser : Can't parse sheet with Hash/pound sharp sign # chords!! #250

Closed Glidias closed 3 years ago

Glidias commented 3 years ago
var chordsheetjs = require("chordsheetjs").default;

const chordSheet = `
{title: Let it be}
{subtitle: ChordSheetJS example version}
{Chorus}

Let it [A#m]be, let it [C/G]be, let it [F]be, let it [C]be
[C]Whisper words of [G]wisdom, let it [F]be [C/E] [Dm] [C]`.substring(1);

const parser = new chordsheetjs.ChordProParser();
const song = parser.parse(chordSheet);
console.log(song);

Instead of Am, i use A#m, bummer...

You can try on Runkit. Seems the peg grammar parser fails.

https://npm.runkit.com/chordsheetjs

peg$SyntaxError: Expected "\\", "]", or [^|[\]\\{}%#\r\n] but "#" found
 at peg$buildStructuredError (C:\Glenn\_dev\Git\gingkstep\node_modules\chordsheetjs\lib\parser\chord_pro_peg_parser.js:454:12)
 at Object.peg$parse [as parse] (C:\Glenn\_dev\Git\gingkstep\node_modules\chordsheetjs\lib\parser\chord_pro_peg_parser.js:1780:11)
martijnversluis commented 3 years ago

Hey @Glidias ! Thanks for reporting this issue 👍

I just published version 4.1.0 which fixes this bug.