I took a look at general code organization within Alda, and made some changes in the importer to better follow convention:
Even ridiculously simple comments should be added for important public methods. e.x. for ParseFile or ScanFile. This is for organization, but also to auto-generate docs. I've added comments to ImportMusicXML.
The public method should be at the bottom of the file. I've adjusted ImportMusicXML to the bottom.
Multiplexed methods like importer handlers, scanner parseOctaveSet / parseString, etc. should be methods on the struct itself. So like scanner.parseString instead of parseString(... s *scanner). I didn't change this one within the MusicXML importer because it's just way too complex to put the handlers in the same file.
Btw the diff on this PR is nasty, but I only moved code blocks around and added 2 lines of comments. No code changes, don't be scared 😄
I took a look at general code organization within Alda, and made some changes in the importer to better follow convention:
ParseFile
orScanFile
. This is for organization, but also to auto-generate docs. I've added comments toImportMusicXML
.ImportMusicXML
to the bottom.parseOctaveSet
/parseString
, etc. should be methods on the struct itself. So likescanner.parseString
instead ofparseString(... s *scanner)
. I didn't change this one within the MusicXML importer because it's just way too complex to put the handlers in the same file.Btw the diff on this PR is nasty, but I only moved code blocks around and added 2 lines of comments. No code changes, don't be scared 😄