FormulaParser constructor
Constructs a FormulaParser instance with the given expression and options.
Implementation
FormulaParser(this.expression, [this.options]) {
String tempExp = expression;
options?.forEach((key, value) {
if (availableFunctions.contains(key.toLowerCase()) &&
tempExp.contains(key.toLowerCase())) {
_isReservedWordsUsed = true;
_reservedWordsUsed.add(key);
} else {
// Handle empty string values by wrapping them in quotes
String replacementValue;
if (value == null || value.toString().isEmpty) {
replacementValue = '""';
} else {
replacementValue = value.toString();
}
tempExp = tempExp.replaceAll(key, replacementValue);
}
});
// remove unnecessary spaces
// & make it all uppercase to make the parsing easier
_inputExpression = tempExp.toUpperCase().replaceAll(" ", "");
}