This PR makes the behavior of @csgrammar and add_rule! more similar (hopefully identical) by using add_rule! when constructing the grammar using the @csgrammar macro.
Mainly, I've added the test above to show the unexpected behavior of @csgrammar and updated expr2csgrammar.
Currently, duplicate rules are ignored when using
add_rule!
:https://github.com/Herb-AI/HerbGrammar.jl/blob/e3bc05c99b5678bdd79af054b0c990777cc839d9/test/test_csg.jl#L53-L59
However, they are not when using
@csgrammar
. This new test fails with the current implementation.https://github.com/Herb-AI/HerbGrammar.jl/blob/e3bc05c99b5678bdd79af054b0c990777cc839d9/test/test_csg.jl#L31-L34
This PR makes the behavior of
@csgrammar
andadd_rule!
more similar (hopefully identical) by usingadd_rule!
when constructing the grammar using the@csgrammar
macro.Mainly, I've added the test above to show the unexpected behavior of
@csgrammar
and updatedexpr2csgrammar
.