Lines Matching refs:node
888 string_node_t *node;
890 node = linear_alloc_child(parser->linalloc, sizeof(string_node_t));
891 node->str = linear_strdup(parser->linalloc, str);
893 node->next = NULL;
896 list->head = node;
898 list->tail->next = node;
901 list->tail = node;
907 string_node_t *node;
913 for (i = 0, node = list->head; node; i++, node = node->next) {
914 if (strcmp (node->str, member) == 0) {
928 string_node_t *node, *dup;
933 for (node = list->head; node; node = node->next) {
934 for (dup = node->next; dup; dup = dup->next) {
935 if (strcmp (node->str, dup->str) == 0)
936 return node->str;
947 string_node_t *node;
952 for (node = list->head; node; node = node->next)
999 argument_node_t *node;
1001 node = linear_alloc_child(parser->linalloc, sizeof(argument_node_t));
1002 node->argument = argument;
1004 node->next = NULL;
1007 list->head = node;
1009 list->tail->next = node;
1012 list->tail = node;
1019 argument_node_t *node;
1024 for (node = list->head; node; node = node->next)
1033 argument_node_t *node;
1039 node = list->head;
1041 node = node->next;
1042 if (node == NULL)
1046 if (node)
1047 return node->argument;
1094 token_node_t *node;
1096 node = linear_alloc_child(parser->linalloc, sizeof(token_node_t));
1097 node->token = token;
1098 node->next = NULL;
1101 list->head = node;
1103 list->tail->next = node;
1106 list->tail = node;
1108 list->non_space_tail = node;
1131 token_node_t *node;
1137 for (node = other->head; node; node = node->next) {
1139 *new_token = *node->token;
1439 token_node_t *node;
1444 for (node = list->head; node; node = node->next)
1445 _token_print(parser->output, node->token);
1544 * When called, 'node' should be the opening-parenthesis token, (or
1546 * be the last consumed node, (corresponding to the closing right
1566 argument_list_t *arguments, token_node_t *node,
1572 node = node->next;
1575 while (node && node->token->type == SPACE)
1576 node = node->next;
1578 if (node == NULL || node->token->type != '(')
1581 node = node->next;
1586 for (paren_count = 1; node; node = node->next) {
1587 if (node->token->type == '(') {
1589 } else if (node->token->type == ')') {
1595 if (node->token->type == ',' && paren_count == 1) {
1602 if (node->token->type == SPACE)
1605 _token_list_append(parser, argument, node->token);
1612 *last = node;
1621 token_t *node;
1624 node = _token_create_ival(parser, type, ival);
1625 _token_list_append(parser, list, node);
1642 /* Evaluate a DEFINED token node (based on subsequent tokens in the list).
1644 * Note: This function must only be called when "node" is a DEFINED token,
1647 * If "node" is followed, (ignoring any SPACE tokens), by an IDENTIFIER token
1655 * In either case, *last will be updated to the last node in the list
1659 * In all other cases, (such as "node is the final node of the list", or
1664 _glcpp_parser_evaluate_defined(glcpp_parser_t *parser, token_node_t *node,
1667 token_node_t *argument, *defined = node;
1669 assert(node->token->type == DEFINED);
1671 node = node->next;
1674 while (node && node->token->type == SPACE)
1675 node = node->next;
1677 if (node == NULL)
1680 if (node->token->type == IDENTIFIER || node->token->type == OTHER) {
1681 argument = node;
1682 } else if (node->token->type == '(') {
1683 node = node->next;
1686 while (node && node->token->type == SPACE)
1687 node = node->next;
1689 if (node == NULL || (node->token->type != IDENTIFIER &&
1690 node->token->type != OTHER)) {
1694 argument = node;
1696 node = node->next;
1699 while (node && node->token->type == SPACE)
1700 node = node->next;
1702 if (node == NULL || node->token->type != ')')
1708 *last = node;
1725 token_node_t *node, *node_prev, *replacement, *last = NULL;
1732 node = list->head;
1734 while (node) {
1736 if (node->token->type != DEFINED)
1739 value = _glcpp_parser_evaluate_defined (parser, node, &last);
1746 /* Splice replacement node into list, replacing from "node"
1756 node = replacement;
1759 node_prev = node;
1760 node = node->next;
1790 token_node_t *node;
1792 node = list->head;
1793 while (node) {
1797 next_non_space = node->next;
1805 node = next_non_space;
1815 yyerror(&node->token->location, parser, "'##' cannot appear at either end of a macro expansion\n");
1819 node->token = _token_paste(parser, node->token, next_non_space->token);
1820 node->next = next_non_space->next;
1822 list->tail = node;
1832 * Returns NULL if node is a simple token with no expansion, (that is,
1833 * although 'node' corresponds to an identifier defined as a
1837 * Compute the complete expansion of node (which is a function-like
1841 * *last to the last node in the list that was consumed by the
1849 _glcpp_parser_expand_function(glcpp_parser_t *parser, token_node_t *node,
1860 identifier = node->token->value.str;
1868 status = _arguments_parse(parser, arguments, node, last);
1876 glcpp_error(&node->token->location, parser, "Macro %s call has unbalanced parentheses\n", identifier);
1890 glcpp_error(&node->token->location, parser,
1900 for (node = macro->replacements->head; node; node = node->next) {
1901 if (node->token->type == IDENTIFIER &&
1902 _string_list_contains(macro->parameters, node->token->value.str,
1921 _token_list_append(parser, substituted, node->token);
1935 /* Compute the complete expansion of node, (and subsequent nodes after
1936 * 'node' in the case that 'node' is a function-like macro and
1939 * Returns NULL if node is a simple token with no expansion.
1942 * and sets *last to the last node in the list that was consumed by
1945 * As 'node' in the case of object-like macro expansion.
1954 _glcpp_parser_expand_node(glcpp_parser_t *parser, token_node_t *node,
1958 token_t *token = node->token;
1972 *last = node;
1983 node->token->location.source);
2023 return _glcpp_parser_expand_function(parser, node, last, mode);
2028 * Here, 'marker' is the token node that appears in the list after the
2030 * examining 'marker', then it is time to pop this node from the
2037 active_list_t *node;
2039 node = linear_alloc_child(parser->linalloc, sizeof(active_list_t));
2040 node->identifier = linear_strdup(parser->linalloc, identifier);
2041 node->marker = marker;
2042 node->next = parser->active;
2044 parser->active = node;
2050 active_list_t *node = parser->active;
2052 if (node == NULL) {
2057 node = parser->active->next;
2058 parser->active = node;
2064 active_list_t *node;
2069 for (node = parser->active; node; node = node->next)
2070 if (strcmp(node->identifier, identifier) == 0)
2102 token_node_t *node, *last = NULL;
2115 node = list->head;
2120 while (node) {
2122 while (parser->active && parser->active->marker == node)
2125 expansion = _glcpp_parser_expand_node (parser, node, &last, mode, line);
2133 for (n = node; n != last->next; n = n->next)
2138 _parser_active_list_push(parser, node->token->value.str, last->next);
2160 node_prev = node;
2162 node = node_prev ? node_prev->next : list->head;
2305 token_node_t *node;
2357 node = parser->lex_from_node;
2359 if (node == NULL) {
2364 *yylval = node->token->value;
2365 ret = node->token->type;
2367 parser->lex_from_node = node->next;
2375 token_node_t *node;
2382 for (node = list->head; node; node = node->next) {
2383 if (node->token->type == SPACE)
2385 _token_list_append (parser, parser->lex_from_list, node->token);
2401 skip_node_t *node;
2406 node = linear_alloc_child(parser->linalloc, sizeof(skip_node_t));
2407 node->loc = *loc;
2411 node->type = SKIP_NO_SKIP;
2413 node->type = SKIP_TO_ELSE;
2415 node->type = SKIP_TO_ENDIF;
2418 node->has_else = false;
2419 node->next = parser->skip_stack;
2420 parser->skip_stack = node;
2443 skip_node_t *node;
2450 node = parser->skip_stack;
2451 parser->skip_stack = node->next;