Lexer capable of recognizing all standard mathematical expressions. More...
Additional Inherited Members | |
![]() | |
add (TokenDefinition $tokenDefinition) | |
Add a Token to the list of tokens recognized by the Lexer. More... | |
tokenize ($input) | |
Convert an input string to a list of tokens. More... | |
Lexer capable of recognizing all standard mathematical expressions.
Subclass of the generic Lexer, with TokenDefinition patterns for numbers, elementary functions, arithmetic operations and variables.
/?\d+/
matching integers matching/sqrt/
matching square root function/sinh/
matching hyperbolic sine/cosh/
matching hyperbolic cosine/tanh/
matching hyperbolic tangent/coth/
matching hyperbolic cotangent/sind/
matching sine (argument in degrees)/cosd/
matching cosine (argument in degrees)/tand/
matching tangent (argument in degrees)/cotd/
matching cotangent (argument in degrees)/sin/
matching sine/cos/
matching cosine/tan/
matching tangent/cot/
matching cotangent/arsinh|arcsinh|asinh/
matching inverse hyperbolic sine/arcosh|arccosh|acosh/
matching inverse hyperbolic cosine/artanh|arctanh|atanh/
matching inverse hyperbolic tangent/arcoth|arccoth|acoth/
matching inverse hyperbolic cotangent/arcsin|asin/
matching inverse sine/arccos|acos/
matching inverse cosine/arctan|atan/
matching inverse tangent/arccot|acot/
matching inverse cotangent/exp/
matching exponential function/log10|lg/
matching logarithm (base 10)/log|ln/
matching natural logarithm/abs/
matching absolute value/sgn/
matching signum function/\(/
matching opening parenthesis (both as delimiter and function evaluation)/\)/
matching closing parenthesisis (both as delimiter and function evaluation)/\+/
matching + for addition (or unary +)/\-/
matching - for subtraction (or unary -)/\* /
matching * for multiplication/\//
matching / for division/\^/
matching ^ for exponentiation/pi/
matching constant pi/e/
matching constant e/[a-zA-Z]/
matching variables (note that we only allow single letter identifiers, this improves parsing of implicit multiplication)/\n/
matching newline/\s+/
matching whitespace