Mate class
Mate is main class of library.
It has already created, Lexer
and Expression
.
And two functions, calculate and isInvalidExp.
calculate is the main function that takes string expression,
parses it (converts to tokens) by Lexer
, and then by using Expression
,
calculates final result.
calculate function automatically checks given string expression's validness.
if it's invalid, then function will return null
, otherwise as normal a double number value.
Properties
- debugMode → bool
-
Decides running mode of mate.
As default it's
false
, (adapted to release mode).final - expression → Expression
-
Early created main expression.
Used to store parts(tokens) and then calculate final result.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- lexer → Lexer
-
Early created main lexer instance of mate.
Used to convert(parse) string expression to tokens list.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
calculate(
String exp) → double? -
Takes user-input string expression, parses it by using
Lexer
, and then calculates final result withExpression
. -
isInvalidExp(
String exp) → bool - Looks and returns if provided expression is invalid or not. (for our library)
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited