Can call the compiler from command line with argument
This commit is contained in:
@@ -5,12 +5,12 @@ parsing_error(Token *token, const char *str, ...){
|
||||
STRING_FMT(scratch, str, string);
|
||||
|
||||
// @Note(Krzosa): Print nice error message
|
||||
printf("\nError: %s", string.str);
|
||||
printf("\nError :: %s", string.str);
|
||||
if(token){
|
||||
if(token->kind == TK_Error){
|
||||
printf("Token Error: %.*s", (int)token->error_val.len, token->error_val.str);
|
||||
}
|
||||
printf(" %s:%d\n", token->file.str, (S32)token->line + 1);
|
||||
printf(" :: %s:%d\n", token->file.str, (S32)token->line + 1);
|
||||
|
||||
// @Note(Krzosa): Print error line
|
||||
{
|
||||
@@ -409,7 +409,11 @@ parse_expr(S64 min_bp){
|
||||
case TK_Decrement : left = ast_expr_unary(token, TK_Decrement, parse_expr(prefix_bp.right)); break;
|
||||
|
||||
case TK_OpenBracket: {
|
||||
Ast_Array *result = ast_array(token, parse_expr(0));
|
||||
Ast_Expr *expr = 0;
|
||||
if(!token_is(TK_CloseBracket))
|
||||
expr = parse_expr(0);
|
||||
|
||||
Ast_Array *result = ast_array(token, expr);
|
||||
token_expect(TK_CloseBracket);
|
||||
result->base = parse_expr(prefix_bp.right);
|
||||
left = result;
|
||||
|
||||
Reference in New Issue
Block a user