Unverified Commit 63902370 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil Committed by GitHub
Browse files

Merge pull request #59 from LCSB-BioCore/mk-relational-ops

support relational operators in math
parents 4010ae63 8ad91a27
......@@ -23,15 +23,17 @@ This attempts to parse out a decent Julia-esque ([`Math`](@ref) AST from a
pointer to `ASTNode_t`.
function parse_math(ast::VPtr)::Math
if ast_is(ast, :ASTNode_isName) || ast_is(ast, :ASTNode_isConstant)
if ast_is(ast, :ASTNode_isName)
return MathIdent(get_string(ast, :ASTNode_getName))
elseif ast_is(ast, :ASTNode_isConstant)
return MathConst(get_string(ast, :ASTNode_getName))
elseif ast_is(ast, :ASTNode_isInteger)
return MathVal(ccall(sbml(:ASTNode_getInteger), Cint, (VPtr,), ast))
elseif ast_is(ast, :ASTNode_isReal)
return MathVal(ccall(sbml(:ASTNode_getReal), Cdouble, (VPtr,), ast))
elseif ast_is(ast, :ASTNode_isFunction)
return MathApply(get_string(ast, :ASTNode_getName), parse_math_children(ast))
elseif ast_is(ast, :ASTNode_isOperator)
elseif ast_is(ast, :ASTNode_isOperator) || ast_is(ast, :ASTNode_isRelational)
return MathApply(
string(Char(ccall(sbml(:ASTNode_getCharacter), Cchar, (VPtr,), ast))),
......@@ -74,6 +74,14 @@ struct MathIdent <: Math
A constant identified by name (usually something like `pi`, `e` or `true`) in
mathematical expression
struct MathConst <: Math
Function application ("call by name", no tricks allowed) in mathematical expression
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment