MCPcopy Create free account
hub / github.com/apache/httpd / ap_expr_parse

Function ap_expr_parse

server/util_expr_eval.c:379–426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377}
378
379AP_DECLARE(const char *) ap_expr_parse(apr_pool_t *pool, apr_pool_t *ptemp,
380 ap_expr_info_t *info, const char *expr,
381 ap_expr_lookup_fn_t *lookup_fn)
382{
383 ap_expr_parse_ctx_t ctx;
384 int rc;
385
386 ctx.pool = pool;
387 ctx.ptemp = ptemp;
388 ctx.inputbuf = expr;
389 ctx.inputlen = strlen(expr);
390 ctx.inputptr = ctx.inputbuf;
391 ctx.expr = NULL;
392 ctx.error = NULL; /* generic bison error message (XXX: usually not very useful, should be axed) */
393 ctx.error2 = NULL; /* additional error message */
394 ctx.flags = info->flags;
395 ctx.scan_del = '\0';
396 ctx.scan_buf[0] = '\0';
397 ctx.scan_ptr = ctx.scan_buf;
398 ctx.lookup_fn = lookup_fn ? lookup_fn : ap_expr_lookup_default;
399 ctx.at_start = 1;
400
401 ap_expr_yylex_init(&ctx.scanner);
402 ap_expr_yyset_extra(&ctx, ctx.scanner);
403 rc = ap_expr_yyparse(&ctx);
404 ap_expr_yylex_destroy(ctx.scanner);
405 if (ctx.error) {
406 if (ctx.error2)
407 return apr_psprintf(pool, "%s: %s", ctx.error, ctx.error2);
408 else
409 return ctx.error;
410 }
411 else if (ctx.error2) {
412 return ctx.error2;
413 }
414
415 if (rc) /* XXX can this happen? */
416 return "syntax error";
417
418#ifdef AP_EXPR_DEBUG
419 if (ctx.expr)
420 expr_dump_tree(ctx.expr, NULL, APLOG_NOTICE, 2);
421#endif
422
423 info->root_node = ctx.expr;
424
425 return NULL;
426}
427
428AP_DECLARE(ap_expr_info_t*) ap_expr_parse_cmd_mi(const cmd_parms *cmd,
429 const char *expr,

Callers 4

ssl_cmd_SSLRequireFunction · 0.85
parse_ap_exprFunction · 0.85
lua_ap_exprFunction · 0.85
ap_expr_parse_cmd_miFunction · 0.85

Calls 4

ap_expr_yylex_initFunction · 0.85
ap_expr_yyset_extraFunction · 0.85
ap_expr_yylex_destroyFunction · 0.85
expr_dump_treeFunction · 0.85

Tested by

no test coverage detected