Fix create functions not setting node type.

This commit is contained in:
Danila Fedorin 2017-01-21 21:18:34 -08:00
parent 19ca43d8e4
commit 16832e98a9

View File

@ -22,6 +22,7 @@ liblex_result _pattern_node_create_clear(pattern_node** into){
liblex_result _pattern_node_create_value(pattern_node** into, int id, char value, pattern_node* next){ liblex_result _pattern_node_create_value(pattern_node** into, int id, char value, pattern_node* next){
liblex_result result = _pattern_node_create_clear(into); liblex_result result = _pattern_node_create_clear(into);
if(result == LIBLEX_SUCCESS){ if(result == LIBLEX_SUCCESS){
(*into)->type = PNODE_VALUE;
(*into)->id = id; (*into)->id = id;
(*into)->data_u.value_s.value = value; (*into)->data_u.value_s.value = value;
(*into)->data_u.value_s.next = next; (*into)->data_u.value_s.next = next;
@ -32,6 +33,7 @@ liblex_result _pattern_node_create_value(pattern_node** into, int id, char value
liblex_result _pattern_node_create_range(pattern_node** into, int id, char from, char to, pattern_node* next){ liblex_result _pattern_node_create_range(pattern_node** into, int id, char from, char to, pattern_node* next){
liblex_result result = _pattern_node_create_clear(into); liblex_result result = _pattern_node_create_clear(into);
if(result == LIBLEX_SUCCESS){ if(result == LIBLEX_SUCCESS){
(*into)->type = PNODE_RANGE;
(*into)->id = id; (*into)->id = id;
(*into)->data_u.range_s.from = from; (*into)->data_u.range_s.from = from;
(*into)->data_u.range_s.to = to; (*into)->data_u.range_s.to = to;
@ -43,6 +45,7 @@ liblex_result _pattern_node_create_range(pattern_node** into, int id, char from,
liblex_result _pattern_node_create_any(pattern_node** into, int id, pattern_node* next){ liblex_result _pattern_node_create_any(pattern_node** into, int id, pattern_node* next){
liblex_result result = _pattern_node_create_clear(into); liblex_result result = _pattern_node_create_clear(into);
if(result == LIBLEX_SUCCESS){ if(result == LIBLEX_SUCCESS){
(*into)->type = PNODE_ANY;
(*into)->id = id; (*into)->id = id;
(*into)->data_u.any_s.next = next; (*into)->data_u.any_s.next = next;
} }
@ -52,6 +55,7 @@ liblex_result _pattern_node_create_any(pattern_node** into, int id, pattern_node
liblex_result _pattern_node_create_connect(pattern_node** into, int id, pattern_node* next){ liblex_result _pattern_node_create_connect(pattern_node** into, int id, pattern_node* next){
liblex_result result = _pattern_node_create_clear(into); liblex_result result = _pattern_node_create_clear(into);
if(result == LIBLEX_SUCCESS){ if(result == LIBLEX_SUCCESS){
(*into)->type = PNODE_CONNECT;
(*into)->id = id; (*into)->id = id;
(*into)->data_u.connect_s.next = next; (*into)->data_u.connect_s.next = next;
} }
@ -61,6 +65,7 @@ liblex_result _pattern_node_create_connect(pattern_node** into, int id, pattern_
liblex_result _pattern_node_create_fork(pattern_node** into, int id, pattern_node* left, pattern_node* right){ liblex_result _pattern_node_create_fork(pattern_node** into, int id, pattern_node* left, pattern_node* right){
liblex_result result = _pattern_node_create_clear(into); liblex_result result = _pattern_node_create_clear(into);
if(result == LIBLEX_SUCCESS){ if(result == LIBLEX_SUCCESS){
(*into)->type = PNODE_FORK;
(*into)->id = id; (*into)->id = id;
(*into)->data_u.fork_s.left = left; (*into)->data_u.fork_s.left = left;
(*into)->data_u.fork_s.right = right; (*into)->data_u.fork_s.right = right;
@ -71,6 +76,7 @@ liblex_result _pattern_node_create_fork(pattern_node** into, int id, pattern_nod
liblex_result _pattern_node_create_end(pattern_node** into, int id, int pattern_id){ liblex_result _pattern_node_create_end(pattern_node** into, int id, int pattern_id){
liblex_result result = _pattern_node_create_clear(into); liblex_result result = _pattern_node_create_clear(into);
if(result == LIBLEX_SUCCESS){ if(result == LIBLEX_SUCCESS){
(*into)->type = PNODE_END;
(*into)->id = id; (*into)->id = id;
(*into)->data_u.end_s.pattern_id = pattern_id; (*into)->data_u.end_s.pattern_id = pattern_id;
} }