Skip to content

Commit

Permalink
Fixed parse_rule! so unit tests pass again
Browse files Browse the repository at this point in the history
  • Loading branch information
THinnerichs committed Nov 30, 2023
1 parent fba6d01 commit f08bc73
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/cfg/cfg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,13 @@ parse_rule!(v::Vector{Any}, r) = push!(v, r)

function parse_rule!(v::Vector{Any}, ex::Expr)
if ex.head == :call && ex.args[1] == :|
terms = length(ex.args) == 2 ?
collect(ex.args[2].args[2]:ex.args[2].args[3]) : #|(a:c) case
ex.args[2:end] #a|b|c case
if length(ex.args) == 2 && ex.args[2].args[1] == :(:)
terms = collect(ex.args[2].args[2]:ex.args[2].args[3]) #|(a:c) case
elseif length(ex.args) == 2 && ex.args[2].args[1] != :(:)
terms = eval(ex.args[2]) # :([1,2,3]) case
else
terms = ex.args[2:end] #a|b|c case
end
for t in terms
parse_rule!(v, t)
end
Expand Down

0 comments on commit f08bc73

Please sign in to comment.