documentation for Lexer
This commit is contained in:
parent
d6daa8e5b3
commit
073a97c7b6
@ -5,7 +5,9 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
|
/* Let's redefine TokenStream, as if it wasn't already defined in Token.h*/
|
||||||
typedef std::vector<Token> TokenStream;
|
typedef std::vector<Token> TokenStream;
|
||||||
|
/* The number of data types currently in Sapphire. */
|
||||||
#define TYPE_COUNT 14
|
#define TYPE_COUNT 14
|
||||||
|
|
||||||
class Lexer
|
class Lexer
|
||||||
@ -34,12 +36,17 @@ private:
|
|||||||
|
|
||||||
bool is_in_string(const std::string& string, const char& character);
|
bool is_in_string(const std::string& string, const char& character);
|
||||||
public:
|
public:
|
||||||
|
/* An array containing Sapphire's current data types. */
|
||||||
static const std::array<std::string,TYPE_COUNT> types;
|
static const std::array<std::string,TYPE_COUNT> types;
|
||||||
|
|
||||||
~Lexer();
|
~Lexer();
|
||||||
|
|
||||||
|
/* Lex the given text, turning it into a stream of tokens. */
|
||||||
TokenStream lex(const std::string& text);
|
TokenStream lex(const std::string& text);
|
||||||
|
|
||||||
|
/* Create a new Lexer and return a pointer to it. */
|
||||||
static std::shared_ptr<Lexer> make_lexer(const std::string& fname);
|
static std::shared_ptr<Lexer> 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>& lexer, const std::shared_ptr<Location>& loc);
|
static void assign_parent_location(std::shared_ptr<Lexer>& lexer, const std::shared_ptr<Location>& loc);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user