From dfe7f167c060a92aa92f5c9ae649065706494405 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 14 Jun 2022 08:03:39 +0300 Subject: Autocommit at 14.06.2022 @ 08:03 --- src/Models/CellFormula.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/Models/CellFormula.cpp') 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& buffer) { + while (*str >= '0' && *str <= '9') + buffer.add(*(str++)); +} + void CellFormula::parseAndSetValue(const char* str) { rawFormula = String(str); -- cgit v1.3.1-23-gd82d