Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LCSB-BioCore
SBML.jl
Commits
8ad91a27
Commit
8ad91a27
authored
Jun 14, 2021
by
Miroslav Kratochvil
Browse files
separate out mathematical constants
...to allow distinguishing stuff like Euler's number from variable name `e`
parent
a12020cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/math.jl
View file @
8ad91a27
...
...
@@ -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
)
...
...
src/structs.jl
View file @
8ad91a27
...
...
@@ -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
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment