drop unecessary dt
This commit is contained in:
parent
877523d531
commit
21ff366d24
1 changed files with 7 additions and 4 deletions
|
|
@ -48,7 +48,7 @@ const_or_unbound = unbound / const
|
||||||
|
|
||||||
lineq = terms _ op _ const_or_unbound
|
lineq = terms _ op _ const_or_unbound
|
||||||
term = coeff? var
|
term = coeff? var
|
||||||
coeff = (dt __ "*" __)? const __ "*" __
|
coeff = ((dt __ "*" __)? const __ "*" __) / (dt __ "*")
|
||||||
terms = (term __ pm __ terms) / term
|
terms = (term __ pm __ terms) / term
|
||||||
|
|
||||||
var = id time?
|
var = id time?
|
||||||
|
|
@ -150,9 +150,12 @@ class STLVisitor(NodeVisitor):
|
||||||
return ast.Var(coeff=c, id=iden, time=time)
|
return ast.Var(coeff=c, id=iden, time=time)
|
||||||
|
|
||||||
def visit_coeff(self, _, children):
|
def visit_coeff(self, _, children):
|
||||||
dt, coeff, *_ = children
|
dt, coeff, *_ = children[0]
|
||||||
dt = dt[0][0] if dt else Number(1)
|
if not isinstance(dt, Symbol):
|
||||||
return dt * coeff
|
dt = dt[0][0] if dt else Number(1)
|
||||||
|
return dt * coeff
|
||||||
|
else:
|
||||||
|
return dt
|
||||||
|
|
||||||
def visit_terms(self, _, children):
|
def visit_terms(self, _, children):
|
||||||
if isinstance(children[0], list):
|
if isinstance(children[0], list):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue