advanced library
Support for lexing, parsing and computing mathematical expressions. Using custom extensions to the lexer/parser/computer.
Classes
- ClosingBracket
- Token types for closing brackets.
- Comma
- Token types for commas.
- Computable
- An abstract class making sure an object can be computed in a Result.
- Constant
- A constant, a number that doesn't change.
- ConstantToken
- A token for constants.
- ConstantTokenType
- The token type for constants.
- EImaginaryValue
- The imaginary value representing e.
- Expression
- An computable expression made out of a left hand, an operator and a right hand.
- FunctionToken
- A token for functions.
- FunctionTokenType
- The token type for functions.
- IImaginaryValue
- The imaginary value representing an imaginary number.
- ImaginaryValue
- A value that cannot exactly be converted to a double (like 1/3.)
- MathFunction
- A mathematical function, taking one or more parameters (a function taking 0 arguments is a constant).
- Modifier
- A modifier is a token put in front of a number, it is an operator with only one parameter.
- ModifierToken
- A token for modifiers.
- ModifierTokenType
- The token type for modifiers.
- NoToken
- A placeholder token for when there are no tokens.
- NoTokenType
- A placeholder token type for when there are no tokens.
- NumberToken
- A token for numbers.
- NumberTokenType
- The token type for numbers.
- OpeningBracket
- Token types for opening brackets.
- Operator
- An operator, a character put between two values to define an operation.
- OperatorToken
- A token for operators.
- OperatorTokenType
- The token type for operators.
- PiValue
- The imaginary value π.
- RationalImaginaryValue
- The imaginary value representing a fraction.
- SimpleBanListValidator
- A helper class used to have a list of banned token types before and after it among other things.
- SimpleTokenType
- Helper class to create simple tokens which cannot be computed
-
Token<
T extends TokenType> - A token, a chain of characters representing a value to manage.
- TokenType
- A type of token, it is used to know exactly when to create the token.
Enums
- Precedence
- An enumeration of the precedence given to operators.
Mixins
- SimpleTokenCreator
- A helper mixing to create simple tokens which cannot be computed
Constants
- acos → const _ArcCosinus
- Takes the arc cosine of a number when written as "acos".
- acs → const _ArcCosinus
- Takes the arc cosine of a number when written as "acs".
- arccos → const _ArcCosinus
- Takes the arc cosine of a number when written as "arccos".
- arcsin → const _ArcSinus
- Takes the arc sine of a number when written as "arcsin".
- arctan → const _ArcTangent
- Takes the arc tangent of a number when written as "arctan".
- asin → const _ArcSinus
- Takes the arc sine of a number when written as "asin".
- asn → const _ArcSinus
- Takes the arc sine of a number when written as "asn".
- atan → const _ArcTangent
- Takes the arc tangent of a number when written as "atan".
- cos → const _Cosinus
- Takes the cosine of a number.
- cubeRoot → const _CubeRoot
- Takes the cube root of a number when written as "cbrt".
- cubeRootAlt → const _CubeRoot
- Takes the cube root of a number when written as "∛".
- division → const _DivisionOperator
- An operator for division when written as "/".
- divisionAlt → const _DivisionOperator
- An operator for division when written as "÷".
- exp → const _Exponential
- Takes the exponential of a number.
- factorial → const _FactorialModifier
- A modifier for factorials
- lb → const _BinaryLogarithm
- Takes the binary logarithm of a number when written as "lb".
- ln → const _NaturalLogarithm
- Takes the natural logarithm of a number.
- log → const _DecimalLogarithm
- Takes the decimal logarithm of a number.
- log2 → const _BinaryLogarithm
- Takes the binary logarithm of a number when written as "log2".
- max → const _Max
- Takes the largest of two numbers.
- min → const _Min
- Takes the smallest of two numbers.
- minus → const _MinusOperator
- An operator for subtraction when written as "-".
- minusAlt → const _MinusOperator
- An operator for subtraction when written as "−".
- multiplication → const _MultiplicationOperator
- An operator for multiplication when written as "*".
- multiplicationAlt → const _MultiplicationOperator
- An operator for multiplication when written as "×".
- percentage → const _PercentageModifier
- A modifier for percentages
- plus → const _PlusOperator
- An operator for addition.
- sin → const _Sinus
- Takes the sine of a number.
- sqrt → const _Sqrt
- Takes the square root of a number when written as "sqrt.
- sqrtAlt → const _Sqrt
- Takes the square root of a number when written as "√".
- tan → const _Tangent
- Takes the tangent of a number.
Properties
- altPi → Constant
-
The constant π when written as "π".
final
- e → Constant
-
The constant e when written as "e".
final
- eAlt → Constant
-
The constant e when written as "𝑒".
final
- i → Constant
-
The constant i when written as "i".
final
- pi → Constant
-
The constant π when written as "pi".
final
- power → _PowerOperator
-
An operator for power.
final
Functions
-
degreesToRadians(
Result input) → double -
Converts the
inputinto radians. -
rpnToComputable(
List< Token< tokens, {ComputeContext context = const DefaultComputeContext()}) → ComputableTokenType> > - Collapses the RPN into a tree of computable expressions.
-
separateTokens(
String input, {ComputeContext context = const DefaultComputeContext()}) → List< Token< TokenType> > - Does a lexical analysis by splitting the input into tokens.
-
toRPN(
List< Token< tokens, {ComputeContext context = const DefaultComputeContext()}) → List<TokenType> >Token< TokenType> > - An implementation of the Shunting-yard algorithm to turn the expression into reverse polish notation.