Commit 8ad91a27 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil
Browse files

separate out mathematical constants

...to allow distinguishing stuff like Euler's number from variable name `e`
parent a12020cd
......@@ -23,8 +23,10 @@ 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)
......
......@@ -74,6 +74,14 @@ struct MathIdent <: Math
id::String
end
"""
A constant identified by name (usually something like `pi`, `e` or `true`) in
mathematical expression
"""
struct MathConst <: Math
id::String
end
"""
Function application ("call by name", no tricks allowed) in mathematical expression
"""
......
Supports Markdown
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