Skip to content

New syntax for separating gabc and nabc voices#1672

Draft
davidweichiang wants to merge 1 commit intogregorio-project:developfrom
davidweichiang:nabc_cut
Draft

New syntax for separating gabc and nabc voices#1672
davidweichiang wants to merge 1 commit intogregorio-project:developfrom
davidweichiang:nabc_cut

Conversation

@davidweichiang
Copy link
Contributor

Closes #1667.

  • & advances to the next voice, but doesn't cycle back to the first voice.
  • | is for cycling back to the first voice, but for backwards compatibility also can be used in place of &.

Currently, nabc-lines: is still required.

- & advances to the next voice, but doesn't cycle back to the first voice.
- | is for cycling back to the first voice, but for backwards compatibility also can be used in place of &.
@davidweichiang
Copy link
Contributor Author

This works as far as I know, but I just left it as a draft in case there was discussion about what the syntax should look like.

@rpspringuel
Copy link
Contributor

What would removing the nabc-lines header requirement involve?

@davidweichiang
Copy link
Contributor Author

My recollection is that the nabc voices are stored in an array, so the nabc-lines: is needed in order to malloc the array. Removing the nabc-lines: header would require adding code to realloc the array whenever a new voice is seen.

Tangentially, this is also related to a question that came up on the mailing list (https://groups.google.com/g/gregorio-users/c/IwslfmnTPDk); currently \gabcsnippet does not allow nabc because it doesn't offer a way to pass the nabc-lines: header.

@rpspringuel
Copy link
Contributor

So which would be easier, in your opinion, removing the nabc-lines header or creating a way to pass headers to \gabcsnippet?

@davidweichiang
Copy link
Contributor Author

I think they're both doable but the latter would be easier (and orthogonal to this PR).

I actually kind of like the nabc-lines header, since it's a global property of a score.

@davidweichiang
Copy link
Contributor Author

This for me went on the back burner when @lbssousa said that "this proposal is not needed anymore." If it is still needed, then let's iron out the syntax. I'm looking at this PR and do not understand why I chose this syntax. I would think it would be better, and still backwards compatible, to make | mean "if at last voice, cycle back to first voice, else advance to next voice" and make & mean "if at last voice, cycle back to first voice, else error."

@lbssousa
Copy link
Contributor

This for me went on the back burner when @lbssousa said that "this proposal is not needed anymore."

In fact, I've said "this proposal was not needed anymore" for syntax highlighting purposes (since a LSP server for Gregorio could be smart enough to identify the GABC/NABC alternations by semantics), but it would still be useful for other purposes (getting rid of nabc-lines header[*], better treatment of error cases like the one pointed in #1726, etc.).

I would think it would be better, and still backwards compatible, to make | mean "if at last voice, cycle back to first voice, else advance to next voice" and make & mean "if at last voice, cycle back to first voice, else error."

I agree (this syntax would resemble the one adopted in MusixTeX: | for intra-instrument staff alternating, and & for instrument alternating), and would suggest a deprecation warning about that "if at last voice, cycle back to first voice" for | delimiter, leading to a breaking change in Gregorio 7.0.0.

[*] One suggestion is implementing a "multi-stage parsing" of GABC files. In the first stage, the parser would calculate the maximum number of NABC voices within a snippet in the score (which would be easier to do with this new proposed syntax), and set nabc-lines to this value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Propose new delimiter to split NABC sections

3 participants