IS their a way I can declare two classes that depend on each other? I tried to see if you could forward declare classes and their members but I didn't see anything that would help. Here is the code
class lexer_c {
public:
std::string src; // Src, a buffer that stores a string copy of the input file.
size_t line; // Line, holds the current line the parser is reading from.
size_t pos; // Pos, the position on the line the parser is reading at.
size_t ptr; // Ptr, the current index in the input buffer.
size_t len; // Len, the length of the input buffer.
lexer_c(std::string file_name);
token_c lexer_c::next_token(); // DEPENDS ON TOKEN_C BELOW
};
class token_c {
public:
tk_type type; // Type of the token.
size_t line; // The line number the token was recorded at.
size_t pos; // The position of the start of the token.
union { // Union:
char* str; // String, for tokens that need to store a string value.
double flt; // Flt, for tokens(_flt_rep) that will store a float value.
unsigned int num; // Interger, for tokens(_int_rep) that need to store integer types.
};
token_c(lexer_c* lexer, tk_type t); // DEPENDS ON LEXER_C AOVE
void token_c::print(token_c token);
};