Add assertions to prevent users from imposing constraints with invalid program trees:
g = @csgrammar begin
Real = 1
Real = :x
Real = -Real
Real = Real + Real
Real = Real * Real
Real = Real / Real
end
constraint1 = Forbidden(RuleNode(1, [RuleNode(2), RuleNode(2)]))
addconstraint!(grammar, constraint1) #should raise an AssertionException: rule 1 must have 0 children
constraint2 = Forbidden(RuleNode(4, [RuleNode(5), RuleNode(2)]))
addconstraint!(grammar, constraint2) #should raise an AssertionException: rule 5 must have 2 children
Add assertions to prevent users from imposing constraints with invalid program trees:
Also add assertions for
DomainRuleNode
s