Skip to content

Commit

Permalink
Fix parse_rule! issue with exported grammars
Browse files Browse the repository at this point in the history
  • Loading branch information
THinnerichs committed Oct 26, 2023
1 parent 27f0618 commit fba6d01
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/cfg/cfg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ end
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(eval(ex.args[2])) : #|(a:c) case
ex.args[2:end] #a|b|c case
for t in terms
parse_rule!(v, t)
end
else
push!(v, ex)
end
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
for t in terms
parse_rule!(v, t)
end
else
push!(v, ex)
end
end

0 comments on commit fba6d01

Please sign in to comment.