Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Insertion not done when occurring in separator of repetition #10

Open
GuntherRademacher opened this issue May 27, 2024 · 3 comments
Open

Comments

@GuntherRademacher
Copy link

GuntherRademacher commented May 27, 2024

GuntherRademacher/markup-blitz#10 mentions several alternate formulations of a rule that includes an insertion as part of the separator of a repetition.

I happened to try those on jwiXML.xhtml, and found that for none of those variants the insertion is actually done. In contrast to that, the b-list shown in GuntherRademacher/markup-blitz#9, where the insertion is in a separate rule, works as expected.

Just thought you might want to know. Thanks for providing the webpage, by the way.

@johnlumley
Copy link
Owner

johnlumley commented May 29, 2024 via email

@johnlumley
Copy link
Owner

Funny that

S: "a"++(-",",+#20).

gives <S>a a a</S> from a,a,a

But in your example #10 I get a result:

<input>
   <A a-list="x"/>
   <A a-list="xyz"/>
   <B b-list="x"/>
   <B b-list="xyz"/>
</input>

Removing the attribute mark on b-list, and changing the insertion to a printable string doesn't get the insertion appearing.
Will have to look a little more closely, but it's puzzling.

More intriguingly:

A: -'A', rs, b-list,stop.
B = -'B', rs, b-list,stop.
{@a-list = name ++ rs.}
@b-list = name ++ (rs, +#20).

gives

<input>
   <A b-list="f g h"/>
   <B b-list="x y z"/>
</input>

but uncommenting the @a-list rule yields:

<input>
   <A b-list="fgh"/>
   <B b-list="xyz"/>
</input>

even though the @a-list rule is not referenced! Food for thought (after finishing my Balisage paper!)

@johnlumley
Copy link
Owner

I've found the error - the compiling of the rules into canonical form builds name ++ rs into a nonterminal name-plus-sep which is also the non-terminal referred to by name ++ (rs, +#20) (and of course it finds name-plus-sep already exists so uses that). Swapping the order of the @a-list and @b-list rules restores the inserted spaces. Now I know the cause I can work on a fix.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants