Store the operator type in the corresponding table entry.

This commit is contained in:
Danila Fedorin 2018-03-17 17:38:13 -07:00
parent ff630c2ce4
commit 6b438dbc6d
2 changed files with 7 additions and 0 deletions

View File

@ -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.
*/

View File

@ -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;
}