Skip to content

Commit

Permalink
Merge pull request #74 from Herb-AI/fix_add_rule_duplicates
Browse files Browse the repository at this point in the history
Add typecheck for right hande side of rules + check equality with ==
  • Loading branch information
ReubenJ authored May 14, 2024
2 parents 02da80e + 1f1c084 commit aca61f9
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

2 comments on commit aca61f9

@ReubenJ
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/106786

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.0 -m "<description of version>" aca61f94202e8973232d0f0496906fbb2038fa40
git push origin v0.3.0

Please sign in to comment.