Skip to content

Commit

Permalink
fix mcp parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelJuillard committed Sep 24, 2024
1 parent 0de03a4 commit edfb7f7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/DynareParser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -511,14 +511,22 @@ function last_steps(context::Context)
return context
end

function mcp_parse(s)
for op in ["<=", ">=","<", ">"]
k = split(s, op)
length(k) == 2 && return (strip(k[1]), op, strip(k[2]))
end
end


function get_mcps!(mcps::Vector{Tuple{Int,Int,String,String}},
model::Vector{Any})
for (i, eq) in enumerate(model)
tags = get(eq, "tags", "")
if !isempty(tags)
tag = get(eq["tags"], "mcp", "")
if !isempty(tag)
p1, p2, p3 = split(tag, limit = 3)
p1, p2, p3 = mcp_parse(tag)
iv = context.symboltable[p1].orderintype
push!(mcps, (i, iv, p2, p3))
end
Expand Down

0 comments on commit edfb7f7

Please sign in to comment.