Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / CellFormula.cpp
diff options
context:
space:
mode:
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);