fix: replace NO_LOCATION with location_t::NONE

This commit is contained in:
TopchetoEU 2022-10-03 17:23:29 +03:00
parent e4efdbd5d5
commit 7a4d81f5f8
2 changed files with 8 additions and 8 deletions

View File

@ -128,32 +128,32 @@ namespace ppc::comp::tree::tok {
bool is_identifier(std::string &&val) { return is_identifier() && identifier() == val; } bool is_identifier(std::string &&val) { return is_identifier() && identifier() == val; }
token_t() { kind = NONE; } 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; kind = IDENTIFIER;
data.identifier = new std::string { identifier }; data.identifier = new std::string { identifier };
location = loc; 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; kind = OPERATOR;
data._operator = op; data._operator = op;
location = loc; 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; kind = INT;
data.int_literal = val; data.int_literal = val;
location = loc; location = loc;
} }
token_t(double val, location_t loc = NO_LOCATION) { token_t(double val, location_t loc = location_t::NONE) {
kind = FLOAT; kind = FLOAT;
data.float_literal = val; data.float_literal = val;
location = loc; location = loc;
} }
token_t(char c, location_t loc = NO_LOCATION) { token_t(char c, location_t loc = location_t::NONE) {
kind = CHAR; kind = CHAR;
data.char_literal = c; data.char_literal = c;
location = loc; 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; kind = STRING;
data.string_literal = new std::vector<char> { val }; data.string_literal = new std::vector<char> { val };
location = loc; 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)", .description = "Prints a 'what?' type of message (you'll see)",
.match_type = options::MATCH_PREFIX, .match_type = options::MATCH_PREFIX,
.execute = [](options::parser_t &parser, const std::string &option, ppc::messages::msg_stack_t &global_stack) { .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."));
} }
}); });
} }