diff --git a/examples/a.glx b/examples/a.glx index cbf556f..92c50ba 100644 --- a/examples/a.glx +++ b/examples/a.glx @@ -1 +1 @@ -int oi := 3; \ No newline at end of file +string oi := makonha == 3 ? "true" : "false"; \ No newline at end of file diff --git a/src/frontend/parser/expressions/binary_operations/parse_additive_expr.c b/src/frontend/parser/expressions/binary_operations/parse_additive_expr.c index 23f1da5..9c8c544 100644 --- a/src/frontend/parser/expressions/binary_operations/parse_additive_expr.c +++ b/src/frontend/parser/expressions/binary_operations/parse_additive_expr.c @@ -32,8 +32,8 @@ AstNode *parse_additive_expr(Parser *parser) { AstNode *left = parse_multiplicative_expr(parser); while (at(parser).type == TOKEN_PLUS || at(parser).type == TOKEN_MINUS) { - char *operator = strdup(at(parser).lexeme); - eat(parser); + char *operator = strdup(eat(parser).lexeme); + AstNode *right = parse_multiplicative_expr(parser); column_end = at(parser).column_end - 1; diff --git a/src/frontend/parser/expressions/binary_operations/parse_bitwise_expr.c b/src/frontend/parser/expressions/binary_operations/parse_bitwise_expr.c index 065da50..2b8c5c5 100644 --- a/src/frontend/parser/expressions/binary_operations/parse_bitwise_expr.c +++ b/src/frontend/parser/expressions/binary_operations/parse_bitwise_expr.c @@ -26,8 +26,7 @@ AstNode *parse_bitwise_expr(Parser *parser){ || at(parser).type == TOKEN_SHIFT_LEFT || at(parser).type == TOKEN_SHIFT_RIGHT ) { - char *operator= strdup(at(parser).lexeme); - eat(parser); + char *operator = strdup(eat(parser).lexeme); AstNode *right = parse_additive_expr(parser); diff --git a/src/frontend/parser/expressions/binary_operations/parse_equality_expr.c b/src/frontend/parser/expressions/binary_operations/parse_equality_expr.c index c881cfb..033afd5 100644 --- a/src/frontend/parser/expressions/binary_operations/parse_equality_expr.c +++ b/src/frontend/parser/expressions/binary_operations/parse_equality_expr.c @@ -18,8 +18,7 @@ AstNode *parse_equality_expr(Parser *parser) { AstNode *left = parse_relational_expr(parser); while(at(parser).type == TOKEN_EQUAL || at(parser).type == TOKEN_NEQUAL) { - char *operator = strdup(at(parser).lexeme); - eat(parser); + char *operator = strdup(eat(parser).lexeme); AstNode *right = parse_relational_expr(parser); diff --git a/src/frontend/parser/expressions/binary_operations/parse_exponential_expr.c b/src/frontend/parser/expressions/binary_operations/parse_exponential_expr.c index ce98da7..9b1fe06 100644 --- a/src/frontend/parser/expressions/binary_operations/parse_exponential_expr.c +++ b/src/frontend/parser/expressions/binary_operations/parse_exponential_expr.c @@ -29,9 +29,8 @@ AstNode *parse_exponential_expr(Parser *parser) { AstNode *left = parse_call_member_expr(parser, NULL); while(at(parser).type == TOKEN_POWER) { - char *operator = strdup(at(parser).lexeme); - - eat(parser); + char *operator = strdup(eat(parser).lexeme); + AstNode *right = parse_call_member_expr(parser, NULL); column_end = at(parser).column_end - 1; diff --git a/src/frontend/parser/expressions/binary_operations/parse_logical_expr.c b/src/frontend/parser/expressions/binary_operations/parse_logical_expr.c index aee8ff7..166dc31 100644 --- a/src/frontend/parser/expressions/binary_operations/parse_logical_expr.c +++ b/src/frontend/parser/expressions/binary_operations/parse_logical_expr.c @@ -17,8 +17,7 @@ AstNode *parse_logical_expr(Parser *parser) { AstNode *left = parse_equality_expr(parser); while(at(parser).type == TOKEN_AND || at(parser).type == TOKEN_OR) { - char *operator = strdup(at(parser).lexeme); - eat(parser); + char *operator = strdup(eat(parser).lexeme); AstNode *right = parse_equality_expr(parser); diff --git a/src/frontend/parser/expressions/binary_operations/parse_multiplicative_expr.c b/src/frontend/parser/expressions/binary_operations/parse_multiplicative_expr.c index 5f1397f..6c56692 100644 --- a/src/frontend/parser/expressions/binary_operations/parse_multiplicative_expr.c +++ b/src/frontend/parser/expressions/binary_operations/parse_multiplicative_expr.c @@ -35,8 +35,7 @@ AstNode *parse_multiplicative_expr(Parser *parser) { AstNode *left = parse_exponential_expr(parser); while (at(parser).type == TOKEN_MUL || at(parser).type == TOKEN_DIV || at(parser).type == TOKEN_MODULUS) { - char *operator = strdup(at(parser).lexeme); - eat(parser); + char *operator = strdup(eat(parser).lexeme); AstNode *right = parse_exponential_expr(parser); diff --git a/src/frontend/parser/expressions/binary_operations/parse_relational_expr.c b/src/frontend/parser/expressions/binary_operations/parse_relational_expr.c index 860ee5b..442969d 100644 --- a/src/frontend/parser/expressions/binary_operations/parse_relational_expr.c +++ b/src/frontend/parser/expressions/binary_operations/parse_relational_expr.c @@ -21,8 +21,7 @@ AstNode *parse_relational_expr(Parser *parser) { || at(parser).type == TOKEN_LT || at(parser).type == TOKEN_LEQUAL ) { - char *operator = strdup(at(parser).lexeme); - eat(parser); + char *operator = strdup(eat(parser).lexeme); AstNode *right = parse_logical_not_expr(parser); diff --git a/src/frontend/parser/expressions/binary_operations/parse_logical_not_expr.c b/src/frontend/parser/expressions/parse_logical_not_expr.c similarity index 100% rename from src/frontend/parser/expressions/binary_operations/parse_logical_not_expr.c rename to src/frontend/parser/expressions/parse_logical_not_expr.c