jsbml icon indicating copy to clipboard operation
jsbml copied to clipboard

Unary operator precedence ignored by ASTNode parser.

Open danv61 opened this issue 3 years ago • 6 comments

Given this expression (konm * (h ^ - 1.0) / koffm), parsing it with the ASTNode parser will result in an error for the unary operator. The following equivalent expression will parse correctly: (konm * (h ^ (0.0 - 1.0)) / koffm)

danv61 avatar Jun 15 '22 20:06 danv61

When i try this, it works as intended:

formulaToL3String(parseL3Formula(' (konm * (h ^ - 1.0) / koffm)'))

yields: konm * h^-1 / koffm

Can you let me know what functions you used?

<?xml version="1.0" encoding="UTF-8"?>
<math xmlns="http://www.w3.org/1998/Math/MathML">
  <apply>
    <divide/>
    <apply>
      <times/>
      <ci> konm </ci>
      <apply>
        <power/>
        <ci> h </ci>
        <apply>
          <minus/>
          <cn> 1 </cn>
        </apply>
      </apply>
    </apply>
    <ci> koffm </ci>
  </apply>
</math>

fbergmann avatar Jun 17 '22 07:06 fbergmann

I am using ASTNode math = ASTNode.parseFormula(expr);

This is the exception I'm getting:

org.sbml.jsbml.text.parser.ParseException: org.sbml.jsbml.text.parser.ParseException: Encountered " "-" "- "" at line 1, column 15. Was expecting one of: <INTEGER> ... <NUMBER> ... <EXPNUMBER> ... "(" ... "{" ... <STRING> ... <STRING> ... <STRING> ... "{" ...

at org.sbml.jsbml.ASTNode.parseFormula(ASTNode.java:1112)

I am using jsbml 1.6.1?


From: Frank Bergmann @.***> Sent: Friday, June 17, 2022 3:17 AM To: sbmlteam/libsbml Cc: Vasilescu,Dan; Author Subject: Re: [sbmlteam/libsbml] Unary operator precedence ignored by ASTNode parser. (Issue sbmlteam/jsbml#249)

*** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***

When i try this, it works as intended:

formulaToL3String(parseL3Formula(' (konm * (h ^ - 1.0) / koffm)'))

yields: konm * h^-1 / koffm

Can you let me know what functions you used?

konm h 1 koffm

Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https://github.com/sbmlteam/jsbml/issues/249*issuecomment-1158570492__;Iw!!Cn_UX_p3!npF_pJpqxhOpt3-W-zsJ7XO5IbEYDR23HoYWRDrQ-mLCpdtFdzMbEsUOiWGQ0IlTexRn6IOp_UG2ek8IkUa8dz8Ddw$, or unsubscribehttps://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AG52W2IV6QA6UK4ICLM7I3LVPQQ7LANCNFSM5Y4TMBQQ__;!!Cn_UX_p3!npF_pJpqxhOpt3-W-zsJ7XO5IbEYDR23HoYWRDrQ-mLCpdtFdzMbEsUOiWGQ0IlTexRn6IOp_UG2ek8IkUa_P7nGAg$. You are receiving this because you authored the thread.Message ID: @.***>

danv61 avatar Jun 20 '22 18:06 danv61

Hello Dan, this makes it apparent, that this is an issue with the jsbml project, so there is not much i can help with here. I'll try and transfer the issue to the other project and hope that @draeger or @niko-rodrigue will be able to look at this soon.

fbergmann avatar Jun 21 '22 07:06 fbergmann

Are you sure this was completed? It's been moved to the jsbml project, and I don't see a duplicate in the issues list.

luciansmith avatar Jun 24 '22 18:06 luciansmith

Sorry assumed if it had been moved it could be closed here

skeating avatar Jun 25 '22 10:06 skeating

I had the same error with jsbml-1.6.1-with-dependencies.jar. Is this still not fixed?

tyzerrr avatar Dec 03 '23 04:12 tyzerrr