From 073a97c7b664f964e5779f7a6d75473f29d7f557 Mon Sep 17 00:00:00 2001 From: apio Date: Wed, 8 Jun 2022 20:05:28 +0200 Subject: [PATCH] documentation for Lexer --- src/Lexer.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Lexer.h b/src/Lexer.h index 2323b95..37afd1f 100644 --- a/src/Lexer.h +++ b/src/Lexer.h @@ -5,7 +5,9 @@ #include #include +/* Let's redefine TokenStream, as if it wasn't already defined in Token.h*/ typedef std::vector TokenStream; +/* The number of data types currently in Sapphire. */ #define TYPE_COUNT 14 class Lexer @@ -34,12 +36,17 @@ private: bool is_in_string(const std::string& string, const char& character); public: + /* An array containing Sapphire's current data types. */ static const std::array types; + ~Lexer(); + /* Lex the given text, turning it into a stream of tokens. */ TokenStream lex(const std::string& text); + /* Create a new Lexer and return a pointer to it. */ static std::shared_ptr make_lexer(const std::string& fname); + /* If the Lexer is lexing an impòrted file, give it the location in the parent file at which it was imported. */ static void assign_parent_location(std::shared_ptr& lexer, const std::shared_ptr& loc); };