/**
* Adds all children that are reachable by one parser hop to the given list.
- * NUL_TKN, SELECTOR_TKN, and OPTION_TKN nodes are treated as transparent.
+ * special tokens except END_TKN are treated as transparent.
*
* @param[in] list to add the nexthops to
* @param[in] node to start calculating nexthops from
if (j != stackpos)
continue;
}
- switch (token->type)
+ if (token->type >= SPECIAL_TKN && token->type != END_TKN)
{
- case OPTION_TKN:
- case SELECTOR_TKN:
- case NUL_TKN:
- added += add_nexthops (list, child, stack, stackpos);
- break;
- default:
- if (stack)
- {
- nextstack = XMALLOC (MTYPE_CMD_MATCHSTACK,
- (stackpos + 1) * sizeof(struct graph_node *));
- nextstack[0] = child;
- memcpy(nextstack + 1, stack, stackpos * sizeof(struct graph_node *));
+ added += add_nexthops (list, child, stack, stackpos);
+ }
+ else
+ {
+ if (stack)
+ {
+ nextstack = XMALLOC (MTYPE_CMD_MATCHSTACK,
+ (stackpos + 1) * sizeof(struct graph_node *));
+ nextstack[0] = child;
+ memcpy(nextstack + 1, stack, stackpos * sizeof(struct graph_node *));
- listnode_add (list, nextstack);
- }
- else
- listnode_add (list, child);
- added++;
+ listnode_add (list, nextstack);
+ }
+ else
+ listnode_add (list, child);
+ added++;
}
}