Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / CellFormula.cpp
diff options
context:
space:
mode:
Commitdfe7f167c060a92aa92f5c9ae649065706494405 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-06-14 08:03:39 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-06-14 08:03:39 +0300
Files642b9337309308965c5e7eb4df28aca245ed8d5f /src/Models/CellFormula.cpp
FMI-OOP-P2_Tables-dfe7f167c060a92aa92f5c9ae649065706494405.tar
FMI-OOP-P2_Tables-dfe7f167c060a92aa92f5c9ae649065706494405.tar.gz
FMI-OOP-P2_Tables-dfe7f167c060a92aa92f5c9ae649065706494405.zip
Parent4568c66ae7cd3a18cf3443e6c29b8154af60c708 (diff)
Autocommit at 14.06.2022 @ 08:03
1 files changed, 18 insertions, 0 deletions
-rw-r--r--src/Models/CellFormula.cpp18
diff --git a/src/Models/CellFormula.cpp b/src/Models/CellFormula.cpp
index 92bb701..4e7449c 100644
--- a/src/Models/CellFormula.cpp
+++ b/src/Models/CellFormula.cpp
@@ -69,6 +69,24 @@ String CellFormula::getValueForPrint() const {
}
}
+// Rough implementation of the grammar
+//
+// S -> WDS | WD.DS | WRDRDS | WOS | W
+// O -> + | - | * | / | ^
+// D -> D0 | D1 | ... | D9 | 0 | 1 | ... | 9
+// W -> W | epsilon
+//
+// over the string
+
+void W(const char*& str) {
+ while (*str == ' ') str++;
+}
+
+void D(const char*& str, List<char>& buffer) {
+ while (*str >= '0' && *str <= '9')
+ buffer.add(*(str++));
+}
+
void CellFormula::parseAndSetValue(const char* str) {
rawFormula = String(str);