Initial commit: HTab spreadsheet engine and GemUI X11 frontend
This commit is contained in:
commit
395f458fee
55 files changed
+12682
No files matched your search
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
|
||||
#include "engine/address.hpp"
|
||||
#include "engine/value.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace htab {
|
||||
|
||||
enum class TokenKind {
|
||||
Number,
|
||||
String,
|
||||
Bool,
|
||||
Error,
|
||||
CellRef,
|
||||
Ident,
|
||||
Colon,
|
||||
Comma,
|
||||
Plus,
|
||||
Minus,
|
||||
Star,
|
||||
Slash,
|
||||
Caret,
|
||||
Percent,
|
||||
Amp,
|
||||
Eq,
|
||||
Neq,
|
||||
Lt,
|
||||
Gt,
|
||||
Le,
|
||||
Ge,
|
||||
LParen,
|
||||
RParen,
|
||||
Eof,
|
||||
Invalid,
|
||||
};
|
||||
|
||||
struct Token {
|
||||
TokenKind kind = TokenKind::Invalid;
|
||||
std::string text;
|
||||
size_t start = 0;
|
||||
size_t end = 0;
|
||||
bool had_space_before = false;
|
||||
double num_val = 0.0;
|
||||
bool bool_val = false;
|
||||
ErrorCode err_val = ErrorCode::Value;
|
||||
CellRef ref_val;
|
||||
};
|
||||
|
||||
class Lexer {
|
||||
public:
|
||||
static std::vector<Token> tokenize(std::string_view input, bool skip_leading_equals = true);
|
||||
};
|
||||
|
||||
} // namespace htab
|
||||
Reference in new issue
Block a user