Make operators simply aliases to functions.
This commit is contained in:
@@ -61,10 +61,6 @@ struct libab_operator_s {
|
||||
* each operator.
|
||||
*/
|
||||
enum libab_operator_variant_e variant;
|
||||
/**
|
||||
* The type of this operator.
|
||||
*/
|
||||
libab_ref type;
|
||||
/**
|
||||
* The precedence of the operator.
|
||||
*/
|
||||
@@ -74,9 +70,9 @@ struct libab_operator_s {
|
||||
*/
|
||||
int associativity;
|
||||
/**
|
||||
* The behavior of this operator.
|
||||
* The function called by this operator.
|
||||
*/
|
||||
struct libab_behavior_s behavior;
|
||||
const char* function;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -132,12 +128,10 @@ void libab_behavior_free(libab_behavior* behavior);
|
||||
* @param precedence the precedence of the operator.
|
||||
* @param associativity the associativity (left = -1, right = 1) of the
|
||||
* operator.
|
||||
* @param type the type of the operator.
|
||||
* @param func the function used to implement the operator.
|
||||
* @param function the function this operator represents.
|
||||
*/
|
||||
void libab_operator_init(libab_operator* op, libab_operator_variant variant,
|
||||
int precedence, int associativity, libab_ref* type,
|
||||
libab_function_ptr func);
|
||||
int precedence, int associativity, const char* function);
|
||||
/**
|
||||
* Frees the given operator.
|
||||
* @param op the operator to free.
|
||||
|
||||
@@ -78,38 +78,32 @@ libab_result libab_init(libab* ab, void* (*parse_function)(const char*),
|
||||
* @param op the operator string to register.
|
||||
* @param precedence the precedence of the operator.
|
||||
* @param associativity the associativity of the operator.
|
||||
* @param type the type of this operator.
|
||||
* @param func the function that describes the functionality of the operator.
|
||||
* @param function the function this operator calls.
|
||||
* @return the result of the initialization.
|
||||
*/
|
||||
libab_result libab_register_operator_infix(libab* ab, const char* op,
|
||||
int precedence, int associativity,
|
||||
libab_ref* type,
|
||||
libab_function_ptr func);
|
||||
const char* function);
|
||||
/**
|
||||
* Registers an operation with libabacus that appears
|
||||
* before its operand.
|
||||
* @param ab the libabacus instance to register the operator with.
|
||||
* @param op the operator string to register.
|
||||
* @param type the type of this operator.
|
||||
* @param func the function that describes the functionality of the operator.
|
||||
* @param function the function this operator calls.
|
||||
* @return the result of the registration.
|
||||
*/
|
||||
libab_result libab_register_operator_prefix(libab* ab, const char* op,
|
||||
libab_ref* type,
|
||||
libab_function_ptr func);
|
||||
const char* function);
|
||||
/**
|
||||
* Registers an operation with libabacus that appears
|
||||
* after its operand.
|
||||
* @param ab the libabacus instance to register the operator with.
|
||||
* @param op the operator string to register.
|
||||
* @param type the type of this operator.
|
||||
* @param func the function that describes the functionality of the operator.
|
||||
* @param function the function this operator calls.
|
||||
* @return the result of the registration.
|
||||
*/
|
||||
libab_result libab_register_operator_postfix(libab* ab, const char* op,
|
||||
libab_ref* type,
|
||||
libab_function_ptr func);
|
||||
const char* function);
|
||||
|
||||
/**
|
||||
* Registers a function with libabacus.
|
||||
|
||||
Reference in New Issue
Block a user