diff --git a/src/components/internals.jl b/src/components/internals.jl index ef913ac3..dee0f474 100644 --- a/src/components/internals.jl +++ b/src/components/internals.jl @@ -226,7 +226,7 @@ function parse_parameters(ps::ParseState, args::Vector{EXPR}, args1::Vector{EXPR push!(trivia, EXPR(:errortoken, EXPR[EXPR(:COMMA, 0, 0)], nothing)) end if kindof(ps.ws) == SemiColonWS - parse_parameters(ps, args1; usekw=usekw) + parse_parameters(ps, args1, EXPR[], 1; usekw=usekw) end prevpos = isfirst ? loop_check(ps, prevpos) : position(ps) isfirst = true diff --git a/src/conversion.jl b/src/conversion.jl index 1bd5e4e7..37a673e0 100644 --- a/src/conversion.jl +++ b/src/conversion.jl @@ -195,20 +195,6 @@ function Expr(x::EXPR) Expr(:string, Expr.(x.args[2:end])...) elseif x.args === nothing Expr(Symbol(lowercase(String(x.head)))) - elseif x.head === :parameters - if length(x.args) > 1 && any(a -> a.head === :parameters, x.args) - ordered_args = EXPR[] - for arg in x.args - if arg.head === :parameters - pushfirst!(ordered_args, arg) - else - push!(ordered_args, arg) - end - end - Expr(:parameters, Expr.(ordered_args)...) - else - Expr(:parameters, Expr.(x.args)...) - end elseif x.head === :errortoken Expr(:error) else diff --git a/src/iterate.jl b/src/iterate.jl index b5d3e515..b93a4f4c 100644 --- a/src/iterate.jl +++ b/src/iterate.jl @@ -73,7 +73,15 @@ function _getindex(x::EXPR, i) elseif headof(x) === :outer ta(x, i) elseif headof(x) === :parameters - if length(x.args) > 1 && headof(x.args[2]) === :parameters + if length(x.args) > 1 && headof(x.args[1]) === :parameters + if i == length(x) + x.args[1] + elseif iseven(i) + x.trivia[div(i, 2)] + else + x.args[div(i + 1, 2) + 1] + end + elseif length(x.args) > 1 && headof(x.args[2]) === :parameters if i == length(x) x.args[2] elseif i == 1