• Home
  • Raw
  • Download

Lines Matching refs:unit

117 static void _jqp_unit_push(yycontext *yy, JQPUNIT *unit) {  in _jqp_unit_push()  argument
120 stack->unit = unit; in _jqp_unit_push()
129 return stack.unit; in _jqp_unit_pop()
156 JQPUNIT *unit = _jqp_unit(yy); in _jqp_string() local
157 unit->type = JQP_STRING_TYPE; in _jqp_string()
158 unit->string.flavour |= flavour; in _jqp_string()
159 unit->string.value = _jqp_strdup(yy, text); in _jqp_string()
160 return unit; in _jqp_string()
164 JQPUNIT *unit = _jqp_unit(yy); in _jqp_number() local
172 unit->type = JQP_DOUBLE_TYPE; in _jqp_number()
173 unit->dblval.value = strtod(text, &eptr); in _jqp_number()
178 unit->dblval.flavour |= flavour; in _jqp_number()
180 unit->type = JQP_INTEGER_TYPE; in _jqp_number()
181 unit->intval.value = ival; in _jqp_number()
182 unit->intval.flavour |= flavour; in _jqp_number()
184 return unit; in _jqp_number()
188 JQPUNIT *unit = _jqp_unit(yy); in _jqp_json_number() local
190 unit->type = JQP_JSON_TYPE; in _jqp_json_number()
197 unit->json.jn.type = JBV_F64; in _jqp_json_number()
198 unit->json.jn.vf64 = strtod(text, &eptr); in _jqp_json_number()
204 unit->json.jn.type = JBV_I64; in _jqp_json_number()
205 unit->json.jn.vi64 = ival; in _jqp_json_number()
207 return unit; in _jqp_json_number()
212 JQPUNIT *unit = _jqp_unit(yy); in _jqp_placeholder() local
213 unit->type = JQP_STRING_TYPE; in _jqp_placeholder()
214 unit->string.flavour |= JQP_STR_PLACEHOLDER; in _jqp_placeholder()
220 unit->string.value = _jqp_strdup(yy, nbuf); in _jqp_placeholder()
222 unit->string.value = _jqp_strdup(yy, text); in _jqp_placeholder()
225 aux->start_placeholder = &unit->string; in _jqp_placeholder()
228 aux->end_placeholder->placeholder_next = &unit->string; in _jqp_placeholder()
231 return unit; in _jqp_placeholder()
350 JQPUNIT *unit = _jqp_unit(yy); in _jqp_unescaped_string() local
351 unit->type = JQP_STRING_TYPE; in _jqp_unescaped_string()
352 unit->string.flavour |= flv; in _jqp_unescaped_string()
366 unit->string.value = dest; in _jqp_unescaped_string()
367 return unit; in _jqp_unescaped_string()
372 JQPUNIT *unit = _jqp_unit(yy); in _jqp_json_string() local
373 unit->type = JQP_JSON_TYPE; in _jqp_json_string()
374 unit->json.jn.type = JBV_STR; in _jqp_json_string()
388 unit->json.jn.vptr = dest; in _jqp_json_string()
389 unit->json.jn.vsize = len; in _jqp_json_string()
390 return unit; in _jqp_json_string()
410 JQPUNIT *unit = aux->stack->unit; in _jqp_json_collect() local
411 if (unit == until) { in _jqp_json_collect()
415 if (unit->type != JQP_JSON_TYPE) { in _jqp_json_collect()
416 iwlog_error("Unexpected type: %d", unit->type); in _jqp_json_collect()
419 JBL_NODE ju = &unit->json.jn; in _jqp_json_collect()
434 JQPUNIT *unit = _jqp_unit(yy); in _jqp_json_true_false_null() local
435 unit->type = JQP_JSON_TYPE; in _jqp_json_true_false_null()
438 unit->json.jn.type = JBV_NULL; in _jqp_json_true_false_null()
440 unit->json.jn.type = JBV_BOOL; in _jqp_json_true_false_null()
441 unit->json.jn.vbool = true; in _jqp_json_true_false_null()
443 unit->json.jn.type = JBV_BOOL; in _jqp_json_true_false_null()
444 unit->json.jn.vbool = false; in _jqp_json_true_false_null()
449 return unit; in _jqp_json_true_false_null()
462 JQPUNIT *unit = _jqp_unit(yy); in _jqp_unit_op() local
463 unit->type = JQP_OP_TYPE; in _jqp_unit_op()
464 unit->op.negate = aux->negate; in _jqp_unit_op()
467 unit->op.value = JQP_OP_EQ; in _jqp_unit_op()
469 unit->op.value = JQP_OP_GT; in _jqp_unit_op()
471 unit->op.value = JQP_OP_GTE; in _jqp_unit_op()
473 unit->op.value = JQP_OP_LT; in _jqp_unit_op()
475 unit->op.value = JQP_OP_LTE; in _jqp_unit_op()
477 unit->op.value = JQP_OP_IN; in _jqp_unit_op()
479 unit->op.value = JQP_OP_NI; in _jqp_unit_op()
481 unit->op.value = JQP_OP_RE; in _jqp_unit_op()
483 unit->op.value = JQP_OP_PREFIX; in _jqp_unit_op()
489 aux->start_op = &unit->op; in _jqp_unit_op()
492 aux->end_op->next = &unit->op; in _jqp_unit_op()
495 return unit; in _jqp_unit_op()
500 JQPUNIT *unit = _jqp_unit(yy); in _jqp_unit_join() local
501 unit->type = JQP_JOIN_TYPE; in _jqp_unit_join()
502 unit->join.negate = aux->negate; in _jqp_unit_join()
505 unit->join.value = JQP_JOIN_AND; in _jqp_unit_join()
507 unit->join.value = JQP_JOIN_OR; in _jqp_unit_join()
509 return unit; in _jqp_unit_join()
521 JQPUNIT *unit = _jqp_unit(yy); in _jqp_expr() local
522 unit->type = JQP_EXPR_TYPE; in _jqp_expr()
523 unit->expr.left = left; in _jqp_expr()
524 unit->expr.op = &op->op; in _jqp_expr()
525 unit->expr.right = right; in _jqp_expr()
526 return unit; in _jqp_expr()
533 JQPUNIT *unit = aux->stack->unit; in _jqp_pop_expr_chain() local
534 if (unit->type == JQP_EXPR_TYPE) { in _jqp_pop_expr_chain()
536 unit->expr.next = &expr->expr; in _jqp_pop_expr_chain()
538 expr = unit; in _jqp_pop_expr_chain()
539 } else if ((unit->type == JQP_JOIN_TYPE) && expr) { in _jqp_pop_expr_chain()
540 expr->expr.join = &unit->join; in _jqp_pop_expr_chain()
542 iwlog_error("Unexpected type: %d", unit->type); in _jqp_pop_expr_chain()
546 if (unit == until) { in _jqp_pop_expr_chain()
558 JQPUNIT *unit = _jqp_unit(yy); in _jqp_projection() local
559 unit->type = JQP_PROJECTION_TYPE; in _jqp_projection()
560 unit->projection.value = &value->string; in _jqp_projection()
561 unit->projection.flags |= flags; in _jqp_projection()
562 return unit; in _jqp_projection()
571 JQPUNIT *unit = aux->stack->unit; in _jqp_pop_projection_nodes() local
572 if (unit->type != JQP_STRING_TYPE) { in _jqp_pop_projection_nodes()
573 iwlog_error("Unexpected type: %d", unit->type); in _jqp_pop_projection_nodes()
577 unit->string.next = &first->string; in _jqp_pop_projection_nodes()
578 } else if (unit->string.flavour & JQP_STR_PROJFIELD) { in _jqp_pop_projection_nodes()
579 for (JQP_STRING *s = &unit->string; s; s = s->subnext) { in _jqp_pop_projection_nodes()
586 } else if (strchr(unit->string.value, '<')) { // JOIN Projection? in _jqp_pop_projection_nodes()
587 unit->string.flavour |= JQP_STR_PROJOIN; in _jqp_pop_projection_nodes()
590 first = unit; in _jqp_pop_projection_nodes()
592 if (unit == until) { in _jqp_pop_projection_nodes()
621 JQPUNIT *unit = aux->stack->unit; in _jqp_pop_joined_projections() local
622 if (unit->type != JQP_PROJECTION_TYPE) { in _jqp_pop_joined_projections()
623 iwlog_error("Unexpected type: %d", unit->type); in _jqp_pop_joined_projections()
627 unit->projection.next = &first->projection; in _jqp_pop_joined_projections()
629 first = unit; in _jqp_pop_joined_projections()
631 if (unit == until) { in _jqp_pop_joined_projections()
642 JQPUNIT *unit = aux->stack->unit; in _jqp_pop_projfields_chain() local
643 if (unit->type != JQP_STRING_TYPE) { in _jqp_pop_projfields_chain()
644 iwlog_error("Unexpected type: %d", unit->type); in _jqp_pop_projfields_chain()
647 unit->string.flavour |= JQP_STR_PROJFIELD; in _jqp_pop_projfields_chain()
649 unit->string.subnext = &field->string; in _jqp_pop_projfields_chain()
651 if (strchr(unit->string.value, '<')) { // JOIN Projection? in _jqp_pop_projfields_chain()
652 unit->string.flavour |= JQP_STR_PROJOIN; in _jqp_pop_projfields_chain()
654 field = unit; in _jqp_pop_projfields_chain()
656 if (unit == until) { in _jqp_pop_projfields_chain()
667 JQPUNIT *unit = aux->stack->unit; in _jqp_pop_ordernodes() local
668 if (unit->type != JQP_STRING_TYPE) { in _jqp_pop_ordernodes()
669 iwlog_error("Unexpected type: %d", unit->type); in _jqp_pop_ordernodes()
673 unit->string.subnext = &first->string; in _jqp_pop_ordernodes()
675 first = unit; in _jqp_pop_ordernodes()
677 if (unit == until) { in _jqp_pop_ordernodes()
685 JQPUNIT *unit = _jqp_unit(yy); in _jqp_node() local
686 unit->type = JQP_NODE_TYPE; in _jqp_node()
687 unit->node.value = value; in _jqp_node()
689 unit->node.ntype = JQP_NODE_EXPR; in _jqp_node()
694 unit->node.ntype = JQP_NODE_ANY; in _jqp_node()
696 unit->node.ntype = JQP_NODE_ANYS; in _jqp_node()
698 unit->node.ntype = JQP_NODE_FIELD; in _jqp_node()
704 return unit; in _jqp_node()
711 JQPUNIT *unit = aux->stack->unit; in _jqp_pop_node_chain() local
712 if (unit->type != JQP_NODE_TYPE) { in _jqp_pop_node_chain()
713 iwlog_error("Unexpected type: %d", unit->type); in _jqp_pop_node_chain()
717 unit->node.next = &first->node; in _jqp_pop_node_chain()
719 first = unit; in _jqp_pop_node_chain()
721 if (unit == until) { in _jqp_pop_node_chain()
734 && (aux->stack->unit->type == JQP_STRING_TYPE) in _jqp_pop_node_chain()
735 && (aux->stack->unit->string.flavour & JQP_STR_ANCHOR)) { in _jqp_pop_node_chain()
749 JQPUNIT *unit = aux->stack->unit; in _jqp_pop_filter_factor_chain() local
750 if (unit->type == JQP_JOIN_TYPE) { in _jqp_pop_filter_factor_chain()
751 factor->join = &unit->join; // -V522 in _jqp_pop_filter_factor_chain()
752 } else if ((unit->type == JQP_EXPR_NODE_TYPE) || (unit->type == JQP_FILTER_TYPE)) { in _jqp_pop_filter_factor_chain()
753 JQP_EXPR_NODE *node = (JQP_EXPR_NODE*) unit; in _jqp_pop_filter_factor_chain()
759 iwlog_error("Unexpected type: %d", unit->type); in _jqp_pop_filter_factor_chain()
763 if (unit == until) { in _jqp_pop_filter_factor_chain()
791 && (aux->stack->unit->type == JQP_STRING_TYPE) in _jqp_create_filterexpr_pk()
792 && (aux->stack->unit->string.flavour & JQP_STR_ANCHOR)) { in _jqp_create_filterexpr_pk()
798 JQPUNIT *unit = _jqp_unit(yy); in _jqp_create_filterexpr_pk() local
799 unit->type = JQP_EXPR_NODE_TYPE; in _jqp_create_filterexpr_pk()
800 JQP_EXPR_NODE_PK *exprnode_pk = &unit->exprnode_pk; in _jqp_create_filterexpr_pk()
804 return unit; in _jqp_create_filterexpr_pk()
807 static void _jqp_set_apply(yycontext *yy, JQPUNIT *unit) { in _jqp_set_apply() argument
809 if (!unit || !aux->query) { in _jqp_set_apply()
813 if (unit->type == JQP_JSON_TYPE) { in _jqp_set_apply()
814 aux->apply = &unit->json.jn; in _jqp_set_apply()
816 } else if ((unit->type == JQP_STRING_TYPE) && (unit->string.flavour & JQP_STR_PLACEHOLDER)) { in _jqp_set_apply()
817 aux->apply_placeholder = unit->string.value; in _jqp_set_apply()
820 iwlog_error("Unexpected type: %d", unit->type); in _jqp_set_apply()
830 static void _jqp_set_apply_upsert(yycontext *yy, JQPUNIT *unit) { in _jqp_set_apply_upsert() argument
833 _jqp_set_apply(yy, unit); in _jqp_set_apply_upsert()
836 static void _jqp_add_orderby(yycontext *yy, JQPUNIT *unit) { in _jqp_add_orderby() argument
838 if (unit->type != JQP_STRING_TYPE) { in _jqp_add_orderby()
839 iwlog_error("Unexpected type for order by: %d", unit->type); in _jqp_add_orderby()
843 aux->orderby = &unit->string; in _jqp_add_orderby()
845 aux->orderby->next = &unit->string; in _jqp_add_orderby()
849 static void _jqp_set_skip(yycontext *yy, JQPUNIT *unit) { in _jqp_set_skip() argument
851 if ((unit->type != JQP_INTEGER_TYPE) && !( (unit->type == JQP_STRING_TYPE) in _jqp_set_skip()
852 && (unit->string.flavour & JQP_STR_PLACEHOLDER))) { in _jqp_set_skip()
853 iwlog_error("Unexpected type for skip: %d", unit->type); in _jqp_set_skip()
859 aux->skip = unit; in _jqp_set_skip()
862 static void _jqp_set_limit(yycontext *yy, JQPUNIT *unit) { in _jqp_set_limit() argument
864 if ((unit->type != JQP_INTEGER_TYPE) && !( (unit->type == JQP_STRING_TYPE) in _jqp_set_limit()
865 && (unit->string.flavour & JQP_STR_PLACEHOLDER))) { in _jqp_set_limit()
866 iwlog_error("Unexpected type for limit: %d", unit->type); in _jqp_set_limit()
872 aux->limit = unit; in _jqp_set_limit()
891 static void _jqp_set_projection(yycontext *yy, JQPUNIT *unit) { in _jqp_set_projection() argument
893 if (!unit || !aux->query) { in _jqp_set_projection()
897 if (unit->type == JQP_PROJECTION_TYPE) { in _jqp_set_projection()
898 JQP_PROJECTION *proj = &unit->projection; in _jqp_set_projection()
913 iwlog_error("Unexpected type: %d", unit->type); in _jqp_set_projection()