ra4_draw  4bd0201e3d922d42bd545d4b045ed44db33454a4
token.hpp
Go to the documentation of this file.
1 #ifndef H_TOKEN
2 #define H_TOKEN
3 
4 #include <string>
5 #include <ostream>
6 
7 #include "core/named_func.hpp"
8 
9 struct Token{
11  number, variable_name, //2-3
14  multiply, divide, modulus, //10-12
17  open_paren, close_paren, //22-23
18  open_square, close_square, //24-25
19  unknown};//26
20 
21  Token(const std::string &function_string="", Type type = Type::unknown);
22  Token(const NamedFunc &function);
23  Token(const Token &) = default;
24  Token & operator=(const Token &) = default;
25  Token(Token &&) = default;
26  Token & operator=(Token &&) = default;
27  ~Token() = default;
28 
29  static Type GetType(char x);
30  static Type GetType(const std::string &x);
31 
33  std::string string_rep_;
35 };
36 
37 std::ostream & operator << (std::ostream &stream, const Token &token);
38 
39 #endif
Combines a callable function taking a Baby and returning a scalar or vector with its string represent...
Definition: named_func.hpp:13
static Type GetType(char x)
std::string string_rep_
Definition: token.hpp:33
Type type_
Definition: token.hpp:34
Token & operator=(const Token &)=default
std::ostream & operator<<(std::ostream &stream, const Token &token)
Definition: token.cpp:59
Type
Definition: token.hpp:10
NamedFunc function_
Definition: token.hpp:32
Definition: token.hpp:9
~Token()=default
Token(const std::string &function_string="", Type type=Type::unknown)
Definition: token.cpp:5