Skip to content

Commit

Permalink
fixed version number, line number bugs, and updated error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Yogurt committed Dec 2, 2022
1 parent 642b7c7 commit da7c6b4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
Empty file removed cate/test.cate
Empty file.
9 changes: 6 additions & 3 deletions include/Util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "inc.hpp"
#define CATE_VERSION "v2.7 (Development)"
#ifdef MODS
#define CATE_VERSION "v2.6 (Development Modded)"
#define CATE_VERSION "v2.7 (Development Modded)"
#endif // MODS

#ifdef __WIN32
Expand Down Expand Up @@ -36,7 +36,7 @@ namespace Util
": " << problem << "\n";
}

inline string remove_extension(string& s) {return s = s.substr(0, s.find_last_of("."));}
inline string remove_extension(string& s) {return s = s.substr(0, s.find_last_of('.'));}

//there are two of these because i'm lazy.
void replace_all(string& s, string_view toReplace, string_view replaceWith);
Expand All @@ -56,11 +56,14 @@ namespace Util
/// @brief Like std::system, but exits if the command returns anything other than 0.
/// @param command The command to execute.
void system(string_view command);
/// @brief The system() command the user can execute
/// @param line The line it's in
/// @param command The command to execute.
void user_system(int32_t line, string_view command);

bool ends_with(string_view value, string_view ending); //written by tshepang from stackoverflow

void check_root();
//void check_root();

void add_cate_ending(std::string& s);
} // namespace Util
Expand Down
4 changes: 2 additions & 2 deletions src/Class/ClassMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ void Parser::object_method()
}
else
{
fatal(string("Unknown member function \"" YELLOW) +
child.c_str() + "()" COLOR_RESET "\"");
fatal(string("\"" YELLOW) +
child.c_str() + "()" COLOR_RESET "\" is not a valid member function");
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/Parser/ParserExpect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void Parser::expect_string_recursive_array()
current = next();

if (current.type == END)
fatal("Unexpected end of file");
fatal_error(tokens[index-1].line, "Unexpected end of file");

if (current.type != STRING_LITERAL && current.type != RECURSIVE && current.type != COMMA && current.type != RCURLY)
{
Expand All @@ -98,7 +98,7 @@ void Parser::expect(ParserTokenKind type, ParserTokenKind type2, ParserTokenKind
current = next();

if (current.type == END)
fatal("Unexpected end of file");
fatal_error(tokens[index-1].line, "Unexpected end of file");

if (current.type != type && current.type != type2 && current.type != type3 && current.type != type4)
{
Expand Down Expand Up @@ -138,7 +138,7 @@ ParserToken Parser::string_function()
ParserToken to_return = current;
if (tokens[index+1].type != RPAREN)
{
warn(tokens[index+1].line, "Missing ')'");
warn(current.line, "Missing ')'");
current = tokens[index -= 1]; //go back one
}

Expand Down

0 comments on commit da7c6b4

Please sign in to comment.