aboutsummaryrefslogtreecommitdiff
path: root/ast.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-07-01 11:12:00 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-07-01 11:12:00 -0400
commitf391c929e5b286a8c45b1b0bf1385c5c4b339088 (patch)
treeab5efa4072251712a6a0500f2d4ec845c2db60fe /ast.c
parent8724dcd82164921e8fba0641989bc88b8ce02ec6 (diff)
Add math metamethods (__add, __sub, etc.)
Diffstat (limited to 'ast.c')
-rw-r--r--ast.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ast.c b/ast.c
index 6745ab6c..2d5d8a8c 100644
--- a/ast.c
+++ b/ast.c
@@ -17,6 +17,13 @@ static const char *OP_NAMES[] = {
[BINOP_AND]="and", [BINOP_OR]="or", [BINOP_XOR]="xor",
};
+const char *binop_method_names[BINOP_XOR+1] = {
+ [BINOP_POWER]="__pow", [BINOP_MULT]="__mul", [BINOP_DIVIDE]="__div",
+ [BINOP_MOD]="__mod", [BINOP_MOD1]="__mod1", [BINOP_PLUS]="__add", [BINOP_MINUS]="__sub",
+ [BINOP_CONCAT]="__concat", [BINOP_LSHIFT]="__lshift", [BINOP_RSHIFT]="__rshift",
+ [BINOP_AND]="__and", [BINOP_OR]="__or", [BINOP_XOR]="__xor",
+};
+
static CORD ast_list_to_xml(ast_list_t *asts);
static CORD arg_list_to_xml(arg_ast_t *args);
static CORD when_clauses_to_xml(when_clause_t *clauses);