vkdb
A time series database engine in C++.
Loading...
Searching...
No Matches
vq.h
1#ifndef QUERY_VQ_H
2#define QUERY_VQ_H
3
4#include <vkdb/token.h>
5#include <filesystem>
6#include <cstdint>
7
8namespace vkdb {
9class Database;
10class Interpreter;
11class RuntimeError;
12
17class VQ {
18public:
19 using size_type = uint64_t;
20
25 VQ() = default;
26
31 VQ(VQ&&) noexcept = default;
32
37 VQ& operator=(VQ&&) noexcept = default;
38
43 VQ(const VQ&) noexcept = default;
44
49 VQ& operator=(const VQ&) noexcept = default;
50
55 ~VQ() noexcept = default;
56
62 static void runFile(const std::filesystem::path path) noexcept;
63
69 static void runPrompt() noexcept;
70
76 static void run(const std::string& source) noexcept;
77
85 static void error(Token token, const std::string& message) noexcept;
86
93 static void runtimeError(const RuntimeError& error) noexcept;
94
95private:
103 static void report(
104 size_type line,
105 const std::string& where,
106 const std::string& message
107 ) noexcept;
108
113 static bool had_error_;
114
119 static bool had_runtime_error_;
120
125 static Database database_;
126
131 static const Interpreter interpreter_;
132};
133} // namespace vkdb
134
135#endif // QUERY_VQ_H
Represents a database in vkdb.
Definition database.h:20
Interpreter for vq.
Runtime error.
Represents a token.
Definition token.h:81
Standalone vq interpreter.
Definition vq.h:17
static void error(Token token, const std::string &message) noexcept
Handle an error.
Definition vq.cpp:58
static void run(const std::string &source) noexcept
Run a source string.
Definition vq.cpp:44
VQ(VQ &&) noexcept=default
Move-construct a VQ object.
static void runFile(const std::filesystem::path path) noexcept
Run a file.
Definition vq.cpp:13
static void runPrompt() noexcept
Run the prompt.
Definition vq.cpp:30
VQ()=default
Deleted default constructor.
static void runtimeError(const RuntimeError &error) noexcept
Handle a runtime error.
Definition vq.cpp:66
STL namespace.