From 1f78aa8783eba223427509834d64f8f5214f1a98 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 25 Aug 2025 14:00:30 -0400 Subject: Improved formatting --- src/ast.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/ast.h') diff --git a/src/ast.h b/src/ast.h index 3fdff98c..43972371 100644 --- a/src/ast.h +++ b/src/ast.h @@ -65,6 +65,8 @@ typedef struct ast_list_s { } ast_list_t; typedef struct arg_ast_s { + file_t *file; + const char *start, *end; const char *name; type_ast_t *type; ast_t *value; -- cgit v1.2.3 From 6c134dd340e24e6247a9ca5a03a7c47c27c3d34f Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 25 Aug 2025 14:36:51 -0400 Subject: More formatter functionality --- src/ast.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ast.h') diff --git a/src/ast.h b/src/ast.h index 43972371..8facc202 100644 --- a/src/ast.h +++ b/src/ast.h @@ -90,6 +90,7 @@ typedef enum { } type_ast_e; typedef struct tag_ast_s { + const char *start, *end; const char *name; arg_ast_t *fields; struct tag_ast_s *next; -- cgit v1.2.3 From 247043eae0ad88b1833d6a64e7ded130605dd83a Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 25 Aug 2025 19:11:17 -0400 Subject: Better support for binops in formatter --- src/ast.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/ast.h') diff --git a/src/ast.h b/src/ast.h index 8facc202..30c413ca 100644 --- a/src/ast.h +++ b/src/ast.h @@ -274,6 +274,7 @@ typedef enum { Extend, ExplicitlyTyped, } ast_e; +#define NUM_AST_TAGS (ExplicitlyTyped + 1) struct ast_s { ast_e tag; @@ -473,6 +474,8 @@ struct ast_s { } __data; }; +extern const int op_tightness[NUM_AST_TAGS]; + const char *ast_source(ast_t *ast); Text_t ast_to_sexp(ast_t *ast); -- cgit v1.2.3 From 180a48ed733bf0ee1e296e3afe5a9be2d1deebcf Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 26 Aug 2025 02:36:59 -0400 Subject: Add missing cases --- src/ast.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/ast.h') diff --git a/src/ast.h b/src/ast.h index 30c413ca..bdccb704 100644 --- a/src/ast.h +++ b/src/ast.h @@ -163,7 +163,12 @@ struct type_ast_s { case MinusUpdate: \ case ConcatUpdate: \ case LeftShiftUpdate: \ - case UnsignedLeftShiftUpdate + case UnsignedLeftShiftUpdate: \ + case RightShiftUpdate: \ + case UnsignedRightShiftUpdate: \ + case AndUpdate: \ + case OrUpdate: \ + case XorUpdate #define UPDATE_CASES \ PowerUpdate: \ case MultiplyUpdate: \ -- cgit v1.2.3 From d25d5642392f93623d1eb4d11156d293fe6df546 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 26 Aug 2025 14:39:11 -0400 Subject: Formatting for min/max and cleanup for ints/nums --- src/ast.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ast.h') diff --git a/src/ast.h b/src/ast.h index bdccb704..3ac24635 100644 --- a/src/ast.h +++ b/src/ast.h @@ -481,7 +481,7 @@ struct ast_s { extern const int op_tightness[NUM_AST_TAGS]; -const char *ast_source(ast_t *ast); +OptionalText_t ast_source(ast_t *ast); Text_t ast_to_sexp(ast_t *ast); const char *ast_to_sexp_str(ast_t *ast); -- cgit v1.2.3 From cdb326a6e74e80bea9bffbeaaff1c5d1f4c9e733 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 6 Sep 2025 14:34:38 -0400 Subject: Code cleanup --- src/ast.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/ast.h') diff --git a/src/ast.h b/src/ast.h index 02c5ad74..7396555e 100644 --- a/src/ast.h +++ b/src/ast.h @@ -481,6 +481,13 @@ struct ast_s { extern const int op_tightness[NUM_AST_TAGS]; +typedef struct { + const char *method_name; + const char *operator; +} binop_info_t; + +extern const binop_info_t binop_info[NUM_AST_TAGS]; + OptionalText_t ast_source(ast_t *ast); Text_t ast_to_sexp(ast_t *ast); @@ -490,7 +497,5 @@ Text_t type_ast_to_sexp(type_ast_t *ast); PUREFUNC bool is_idempotent(ast_t *ast); void visit_topologically(ast_list_t *ast, Closure_t fn); CONSTFUNC bool is_update_assignment(ast_t *ast); -CONSTFUNC const char *binop_method_name(ast_e tag); -CONSTFUNC const char *binop_operator(ast_e tag); CONSTFUNC ast_e binop_tag(ast_e tag); CONSTFUNC bool is_binary_operation(ast_t *ast); -- cgit v1.2.3