]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: cfgcond: start to split the condition parser to introduce terms
authorWilly Tarreau <w@1wt.eu>
Fri, 16 Jul 2021 10:12:00 +0000 (12:12 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 16 Jul 2021 17:18:41 +0000 (19:18 +0200)
commitf869095df90b18964cc2f7e47e9a137f9febf577
treecf136ecba942dd53e1657de65907a91d76cde04d
parent66243b4273a9ce103d0c80ceb8614ca65eedfd5e
MINOR: cfgcond: start to split the condition parser to introduce terms

The purpose is to build a descendent parser that will split conditions
into expressions made of terms. There are two phases, a parsing phase
and an evaluation phase. Strictly speaking it's not required to cut
that in two right now, but it's likely that in the future we won't want
certain predicates to be evaluated during the parsing (e.g. file system
checks or execution of some external commands).

The cfg_eval_condition() function is now much simpler, it just tries to
parse a single term, and if OK evaluates it, then returns the result.
Errors are unchanged and may still be reported during parsing or
evaluation.

It's worth noting that some invalid expressions such as streq(a,b)zzz
continue to parse correctly for now (what remains after the parenthesis
is simply ignored as not necessary).
include/haproxy/cfgcond-t.h
include/haproxy/cfgcond.h
src/cfgcond.c