AST building #2

Merged
TopchetoEU merged 74 commits from TopchetoEU/ast-building into master 2022-10-28 11:58:03 +00:00
2 changed files with 8 additions and 8 deletions
Showing only changes of commit 7a4d81f5f8 - Show all commits

View File

@ -128,32 +128,32 @@ namespace ppc::comp::tree::tok {
bool is_identifier(std::string &&val) { return is_identifier() && identifier() == val; }
token_t() { kind = NONE; }
token_t(const std::string &identifier, location_t loc = NO_LOCATION) {
token_t(const std::string &identifier, location_t loc = location_t::NONE) {
kind = IDENTIFIER;
data.identifier = new std::string { identifier };
location = loc;
}
token_t(operator_t op, location_t loc = NO_LOCATION) {
token_t(operator_t op, location_t loc = location_t::NONE) {
kind = OPERATOR;
data._operator = op;
location = loc;
}
token_t(std::uint64_t val, location_t loc = NO_LOCATION) {
token_t(std::uint64_t val, location_t loc = location_t::NONE) {
kind = INT;
data.int_literal = val;
location = loc;
}
token_t(double val, location_t loc = NO_LOCATION) {
token_t(double val, location_t loc = location_t::NONE) {
kind = FLOAT;
data.float_literal = val;
location = loc;
}
token_t(char c, location_t loc = NO_LOCATION) {
token_t(char c, location_t loc = location_t::NONE) {
kind = CHAR;
data.char_literal = c;
location = loc;
}
token_t(const std::vector<char> &val, location_t loc = NO_LOCATION) {
token_t(const std::vector<char> &val, location_t loc = location_t::NONE) {
kind = STRING;
data.string_literal = new std::vector<char> { val };
location = loc;

View File

@ -120,7 +120,7 @@ void add_flags(options::parser_t &parser) {
.description = "Prints a 'what?' type of message (you'll see)",
.match_type = options::MATCH_PREFIX,
.execute = [](options::parser_t &parser, const std::string &option, ppc::messages::msg_stack_t &global_stack) {
global_stack.push({ (messages::message_t::level_t)69, NO_LOCATION, "IDK LOL." });
global_stack.push(messages::message_t((messages::message_t::level_t)69, "IDK LOL."));
}
});
}
@ -172,4 +172,4 @@ int main(int argc, const char *argv[]) {
msg_stack.print(std::cout, messages::message_t::DEBUG, true);
return 0;
}
}