summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/lexer.c4
-rw-r--r--src/utils/log.c10
2 files changed, 8 insertions, 6 deletions
diff --git a/src/compiler/lexer.c b/src/compiler/lexer.c
index 273f40a..fa96203 100644
--- a/src/compiler/lexer.c
+++ b/src/compiler/lexer.c
@@ -467,9 +467,11 @@ bool isCompleteSymbol(char *str, size_t str_size) {
bool isSpace(char c) {
switch (c) {
case ' ':
- case '\n':
case '\t':
+ case '\n':
case '\v':
+ case '\f':
+ case '\r':
return true;
default:
return false;
diff --git a/src/utils/log.c b/src/utils/log.c
index e8eb047..898517d 100644
--- a/src/utils/log.c
+++ b/src/utils/log.c
@@ -33,13 +33,13 @@ void _printErrorWarningBack(const char *file, int line, char *begin, char *end,
}
}
- const char firstColor[] = "\e[0;36m";
+ static const char FIRST_COLOR[] = "\e[0;36m";
const char *secondColor = isError ? "\e[0;31m" : "\e[0;33m";
if (isError) {
- fprintf(stderr, "%sError: %s at compiler %s:%d\e[0m\n", firstColor,
+ fprintf(stderr, "%sError: %s at compiler %s:%d\e[0m\n", FIRST_COLOR,
errorStr, file, line);
} else {
- fprintf(stderr, "%sWarning: %s at compiler %s:%d\e[0m\n", firstColor,
+ fprintf(stderr, "%sWarning: %s at compiler %s:%d\e[0m\n", FIRST_COLOR,
errorStr, file, line);
}
free(errorStr);
@@ -65,14 +65,14 @@ void _printErrorWarningBack(const char *file, int line, char *begin, char *end,
}
}
- fprintf(stderr, "\e%sAt %s:%ld\n", firstColor, fileCodes_names[file_index],
+ fprintf(stderr, "\e%sAt %s:%ld\n", FIRST_COLOR, fileCodes_names[file_index],
file_line);
for (char *iter = file_line_begin; iter < file_line_end; ++iter) {
if (iter == begin) {
fprintf(stderr, "%s", secondColor);
} else if (iter == end) {
- fprintf(stderr, "%s", firstColor);
+ fprintf(stderr, "%s", FIRST_COLOR);
}
fprintf(stderr, "%c", *iter);
}