JavaView® v2.12

jv.thirdParty.expr
Class Parser

java.lang.Object
  |
  +--jv.thirdParty.expr.Parser

public class Parser
extends java.lang.Object

Parses strings representing mathematical formulas with variables. The following operators, in descending order of precedence, are defined:

^ associates right-to-left; other operators associate left-to-right.

These functions are defined: abs, acos, asin, atan, ceil, cos, exp, floor, log, round, sin, sqrt, tan, sinh, cosh, tanh, coth, asinh, acosh, atanh, acoth.

Each requires one argument enclosed in parentheses. Whitespace outside identifiers is ignored.

The syntax-error messages aren't very informative, unfortunately. IWBNI it indicated where in the input string the parse failed, but that'd be kind of a pain since our scanner is a StreamTokenizer. A hook for that info should've been built into StreamTokenizer.

Examples: