@@ -7,11 +7,11 @@ using namespace dsr;
77POIndex::POIndex () {}
88POIndex::POIndex (int16_t precedenceIndex, int16_t operationIndex) : precedenceIndex(precedenceIndex), operationIndex(operationIndex) {}
99
10- Operation::Operation (int16_t symbolIndex, std::function <String(ReadableString, ReadableString)> action)
10+ Operation::Operation (int16_t symbolIndex, StorableCallback <String(ReadableString, ReadableString)> action)
1111: symbolIndex(symbolIndex), action(action) {
1212}
1313
14- static int16_t addOperation (ExpressionSyntax &targetSyntax, int16_t symbolIndex, std::function <String(ReadableString, ReadableString)> action) {
14+ static int16_t addOperation (ExpressionSyntax &targetSyntax, int16_t symbolIndex, StorableCallback <String(ReadableString, ReadableString)> action) {
1515 int16_t precedenceIndex = targetSyntax.precedences .length () - 1 ;
1616 int16_t operationIndex = targetSyntax.precedences .last ().operations .length ();
1717 // TODO: Only allow assigning a symbol once per prefix, infix and postfix.
@@ -286,7 +286,7 @@ static bool validRightmostToken(int16_t symbolIndex, const ExpressionSyntax &syn
286286
287287// info is a list of additional information starting with info[0] at tokens[startTokenIndex]
288288// infoStart is the startTokenIndex of the root evaluation call
289- static String expression_evaluate_helper (const List<TokenInfo> &info, int64_t infoStart, int64_t currentDepth, const List<String> &tokens, int64_t startTokenIndex, int64_t endTokenIndex, const ExpressionSyntax &syntax, std::function <String(ReadableString)> identifierEvaluation) {
289+ static String expression_evaluate_helper (const List<TokenInfo> &info, int64_t infoStart, int64_t currentDepth, const List<String> &tokens, int64_t startTokenIndex, int64_t endTokenIndex, const ExpressionSyntax &syntax, StorableCallback <String(ReadableString)> identifierEvaluation) {
290290 // printText(U"Evaluate: ", debugTokens(info, infoStart, tokens, startTokenIndex, endTokenIndex), U"\n");
291291 if (startTokenIndex == endTokenIndex) {
292292 ReadableString first = expression_getToken (tokens, startTokenIndex, U" " );
@@ -382,7 +382,7 @@ static String expression_evaluate_helper(const List<TokenInfo> &info, int64_t in
382382 return U" <ERROR:Invalid expression>" ;
383383}
384384
385- String expression_evaluate (const List<String> &tokens, int64_t startTokenIndex, int64_t endTokenIndex, const ExpressionSyntax &syntax, std::function <String(ReadableString)> identifierEvaluation) {
385+ String expression_evaluate (const List<String> &tokens, int64_t startTokenIndex, int64_t endTokenIndex, const ExpressionSyntax &syntax, StorableCallback <String(ReadableString)> identifierEvaluation) {
386386 // Scan the whole expression once in the beginning and write useful information into a separate list.
387387 // This allow handling tokens as plain lists of strings while still being able to number what they are.
388388 int32_t depth = 0 ;
@@ -404,11 +404,11 @@ String expression_evaluate(const List<String> &tokens, int64_t startTokenIndex,
404404 return expression_evaluate_helper (info, startTokenIndex, 0 , tokens, startTokenIndex, endTokenIndex, syntax, identifierEvaluation);
405405}
406406
407- String expression_evaluate (const List<String> &tokens, int64_t startTokenIndex, int64_t endTokenIndex, std::function <String(ReadableString)> identifierEvaluation) {
407+ String expression_evaluate (const List<String> &tokens, int64_t startTokenIndex, int64_t endTokenIndex, StorableCallback <String(ReadableString)> identifierEvaluation) {
408408 return expression_evaluate (tokens, startTokenIndex, endTokenIndex, defaultSyntax, identifierEvaluation);
409409}
410410
411- String expression_evaluate (const List<String> &tokens, std::function <String(ReadableString)> identifierEvaluation) {
411+ String expression_evaluate (const List<String> &tokens, StorableCallback <String(ReadableString)> identifierEvaluation) {
412412 return expression_evaluate (tokens, 0 , tokens.length () - 1 , defaultSyntax, identifierEvaluation);
413413}
414414
@@ -533,7 +533,7 @@ static void expectResult(int64_t &errorCount, const List<String> &result, const
533533}
534534
535535void expression_runRegressionTests () {
536- std::function <String (ReadableString)> context = [](ReadableString identifier) -> String {
536+ StorableCallback <String (ReadableString)> context = [](ReadableString identifier) -> String {
537537 if (string_caseInsensitiveMatch (identifier, U" x" )) {
538538 return U" 5" ;
539539 } else if (string_caseInsensitiveMatch (identifier, U" doorCount" )) {
0 commit comments