From 1d379a5cf34475f66f2ab9359f77dac162c0a40e Mon Sep 17 00:00:00 2001 From: Dylan Date: Sat, 6 Jun 2026 19:36:41 +1200 Subject: feat: JSON reading - Implemented a tokenizer for json - Implemented a method which will read json from a string using the tokenizer --- src/tokenizer.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/tokenizer.h (limited to 'src/tokenizer.h') diff --git a/src/tokenizer.h b/src/tokenizer.h new file mode 100644 index 0000000..3322553 --- /dev/null +++ b/src/tokenizer.h @@ -0,0 +1,36 @@ +#pragma once + +#include +#include + +namespace TehJSON +{ + enum struct TokenType + { + LBrace, + RBrace, + Colon, + Comma, + StringLit, + IntLit, + FloatLit, + }; + + std::string getTokenName(TokenType t); + + struct Token + { + TokenType type; + std::string content; + }; + + class Tokenizer + { + public: + void appendInput(std::string s); + std::vector tokenize(); + std::string getInput(); + private: + std::string input = ""; + }; +} -- cgit v1.2.3