Allow not_in as keyword over notin, but still allow notin to work

This commit is contained in:
gingerBill
2020-01-16 10:00:14 +00:00
parent 527b39ce2b
commit 159150c6d9
9 changed files with 31 additions and 30 deletions
+2 -2
View File
@@ -1196,7 +1196,7 @@ bool is_token_range(Token tok) {
Token expect_operator(AstFile *f) {
Token prev = f->curr_token;
if ((prev.kind == Token_in || prev.kind == Token_notin) && (f->expr_level >= 0 || f->allow_in_expr)) {
if ((prev.kind == Token_in || prev.kind == Token_not_in) && (f->expr_level >= 0 || f->allow_in_expr)) {
// okay
} else if (!gb_is_between(prev.kind, Token__OperatorBegin+1, Token__OperatorEnd-1)) {
syntax_error(f->curr_token, "Expected an operator, got '%.*s'",
@@ -2515,7 +2515,7 @@ i32 token_precedence(AstFile *f, TokenKind t) {
return 5;
case Token_in:
case Token_notin:
case Token_not_in:
if (f->expr_level < 0 && !f->allow_in_expr) {
return 0;
}