diff --git a/include/custom.h b/include/custom.h index f58e0db..d719da9 100644 --- a/include/custom.h +++ b/include/custom.h @@ -29,6 +29,12 @@ struct libab_behavior_s { * registered with libabacus. */ struct libab_operator_s { + /** + * The type of the operator (infix, prefix, postfix). + * Corresponds to token types associated with + * each operator. + */ + int type; /** * The precedence of the operator. */ diff --git a/src/libabacus.c b/src/libabacus.c index 5446da5..8431b0a 100644 --- a/src/libabacus.c +++ b/src/libabacus.c @@ -58,6 +58,7 @@ libab_result _register_operator(libab* ab, const char* op, int token_type, int p new_entry->data_u.op.behavior.type = NULL; new_entry->data_u.op.precedence = precedence; new_entry->data_u.op.associativity = associativity; + new_entry->data_u.op.type = token_type; } else { result = LIBAB_MALLOC; }