Store the operator type in the corresponding table entry.
This commit is contained in:
parent
ff630c2ce4
commit
6b438dbc6d
|
@ -29,6 +29,12 @@ struct libab_behavior_s {
|
||||||
* registered with libabacus.
|
* registered with libabacus.
|
||||||
*/
|
*/
|
||||||
struct libab_operator_s {
|
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.
|
* The precedence of the operator.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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.behavior.type = NULL;
|
||||||
new_entry->data_u.op.precedence = precedence;
|
new_entry->data_u.op.precedence = precedence;
|
||||||
new_entry->data_u.op.associativity = associativity;
|
new_entry->data_u.op.associativity = associativity;
|
||||||
|
new_entry->data_u.op.type = token_type;
|
||||||
} else {
|
} else {
|
||||||
result = LIBAB_MALLOC;
|
result = LIBAB_MALLOC;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user