Skip to content

Commit

Permalink
Add typecheck for right hande side of rules + check equality with ==
Browse files Browse the repository at this point in the history
  • Loading branch information
THinnerichs committed May 14, 2024
1 parent adf447e commit 1f1c084
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/grammar_base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ function add_rule!(g::AbstractGrammar, e::Expr)
# Only add a rule if it does not exist yet. Check for existance
# with strict equality so that true and 1 are not considered
# equal. that means we can't use `in` or `∈` for equality checking.
if !any(r === rule for rule g.rules)
if !any(r === rule || typeof(r)==Expr && r == rule for rule g.rules)
push!(g.rules, r)
push!(g.iseval, iseval(rule))
push!(g.types, s)
Expand Down

0 comments on commit 1f1c084

Please sign in to comment.