syntax extension to apply arbitrary scalar function
This commit is contained in:
parent
5abcf7ed7e
commit
92019f1268
2 changed files with 2 additions and 0 deletions
|
|
@ -51,6 +51,7 @@ calc_grammar = """
|
|||
| "sqrt" -> sqrt
|
||||
| "abs" -> abs
|
||||
| "rxn_rate" -> rxn_rate
|
||||
| "$" NAME -> udf
|
||||
|
||||
?derivative: "ddx" -> ddx
|
||||
| "d2dx" -> d2dx
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ class ExpToCode(Transformer):
|
|||
sqrt = lambda self : "sqrt"
|
||||
abs = lambda self : "dabs"
|
||||
rxn_rate = lambda self : "rxn_rate"
|
||||
udf = lambda self, a : a.value
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue