0

Using the library https://mathparser.org/mxparser-tutorial/playing-with-expression-tokens/

Assume I have the follow functions:

val origEl = Expression("revenue - cogs")
origEl.copyOfInitialTokens // this returns an array of `Token`

What is the tokenIdType here that would indicate we have a user defined argument

Thanks

echen
  • 2,002
  • 1
  • 24
  • 38

1 Answers1

1

Take a look here:

Generally - in your example you did not define any argument. Parser will find names that are not recognized. It will give you a hint that it look like argument. Take a look on Token.looksLike field.

To define user argument follow the tutorial:

To get the list of missing user defined arguments take a look on Expression.getMissingUserDefinedArguments(), Expression.getMissingUserDefinedUnits(), Expression.getMissingUserDefinedFunctions()

To understand the tokenTypId and tokenId study each mXparser class searching for TYPE_ID value and _ID value, for instance:

Best regards

Leroy Kegan
  • 1,156
  • 10
  • 9
  • Thank you Leroy this is exactly what I am looking for, especially the how to interpret the tokenTypId – echen Feb 25 '21 at 00:12