Reduce number of range and slice operators #239

Replace .. and ... with : and ..
This commit is contained in:
gingerBill
2018-08-01 21:34:59 +01:00
parent a6fe656f21
commit 0718f14774
31 changed files with 204 additions and 219 deletions
+11 -7
View File
@@ -76,8 +76,7 @@ TOKEN_KIND(Token__ComparisonEnd, ""), \
TOKEN_KIND(Token_Semicolon, ";"), \
TOKEN_KIND(Token_Period, "."), \
TOKEN_KIND(Token_Comma, ","), \
TOKEN_KIND(Token_Ellipsis, "..."), \
TOKEN_KIND(Token_HalfClosed, ".."), \
TOKEN_KIND(Token_Ellipsis, ".."), \
TOKEN_KIND(Token_BackSlash, "\\"), \
TOKEN_KIND(Token__OperatorEnd, ""), \
\
@@ -226,6 +225,9 @@ void error_va(Token token, char *fmt, va_list va) {
gb_bprintf_va(fmt, va));
}
gb_mutex_unlock(&global_error_collector.mutex);
if (global_error_collector.count > 20) {
gb_exit(1);
}
}
void error_no_newline_va(Token token, char *fmt, va_list va) {
@@ -241,6 +243,9 @@ void error_no_newline_va(Token token, char *fmt, va_list va) {
gb_bprintf_va(fmt, va));
}
gb_mutex_unlock(&global_error_collector.mutex);
if (global_error_collector.count > 20) {
gb_exit(1);
}
}
@@ -258,6 +263,9 @@ void syntax_error_va(Token token, char *fmt, va_list va) {
}
gb_mutex_unlock(&global_error_collector.mutex);
if (global_error_collector.count > 20) {
gb_exit(1);
}
}
void syntax_warning_va(Token token, char *fmt, va_list va) {
@@ -936,11 +944,7 @@ Token tokenizer_get_token(Tokenizer *t) {
case '.':
if (t->curr_rune == '.') { // Could be an ellipsis
advance_to_next_rune(t);
token.kind = Token_HalfClosed;
if (t->curr_rune == '.') {
advance_to_next_rune(t);
token.kind = Token_Ellipsis;
}
token.kind = Token_Ellipsis;
} else if ('0' <= t->curr_rune && t->curr_rune <= '9') {
token = scan_number_to_token(t, true);
} else {