Herb-AI / HerbConstraints.jl

Constraints for Herb.jl
https://herb-ai.github.io/
MIT License
0 stars 0 forks source link

Partition test depends on duplicate rules #54

Closed ReubenJ closed 1 month ago

ReubenJ commented 1 month ago

https://github.com/Herb-AI/HerbGrammar.jl/pull/72 unified the functionality of add_rule! and @csgrammar in HerbGrammar.jl. This means duplicate rules are no longer added. The following test now fails because it relies on adding duplicate rules:

https://github.com/Herb-AI/HerbConstraints.jl/blob/5d0ec8afa866030e9d76264fb6afe04f0d061127/test/test_domain_utils.jl#L82-L104

@Whebon, can we remove the duplicate rules, or were they there for a specific reason?

Whebon commented 1 month ago

The duplicate rules are needed, because this test needs multiple rules with the same child types. But this can also be achieved with unique rules:

g = @csgrammar begin
    A = (1)
    A = (2)
    A = (3, A)
    A = (4, A)
    A = (5, A, A)
    A = (6, A, A)
    A = (7, A, B)
    A = (8, A, B)
    B = (9)
    B = (10)
    B = (11, A, B)
    B = (12, A, B)
end