/** Promote the types in a FOO OP BAR comparison.
*
*/
-int fr_cond_promote_types(fr_cond_t *c, fr_sbuff_t *in, fr_sbuff_marker_t *m_lhs, fr_sbuff_marker_t *m_rhs, bool flag)
+int fr_cond_promote_types(fr_cond_t *c, fr_sbuff_t *in, fr_sbuff_marker_t *m_lhs, fr_sbuff_marker_t *m_rhs, bool simple_parse)
{
fr_type_t lhs_type, rhs_type;
fr_type_t cast_type;
/*
* Skip casting.
*/
- if (flag) return 0;
+ if (simple_parse) return 0;
/*
* Cast both sides to the promoted type.
static ssize_t cond_tokenize_operand(fr_cond_t *c, tmpl_t **out,
fr_sbuff_marker_t *opd_start, fr_sbuff_t *in,
- tmpl_rules_t const *t_rules)
+ tmpl_rules_t const *t_rules, bool simple_parse)
{
fr_sbuff_term_t const bareword_terminals =
FR_SBUFF_TERMS(
* the flags. Try to compile the
* regex.
*/
- if (tmpl_is_regex_uncompiled(vpt)) {
+ if (!simple_parse && tmpl_is_regex_uncompiled(vpt)) {
slen = tmpl_regex_compile(vpt, true);
if (slen <= 0) {
fr_sbuff_set(&our_in, &m); /* Reset to start of expression */
* @param[in] in the start of the string to process. Should be "(..."
* @param[in] brace look for a closing brace (how many deep we are)
* @param[in] t_rules for attribute parsing
- * @param[in] flag temporary hack
+ * @param[in] simple_parse temporary hack
* @return
* - Length of the string skipped.
* - < 0 (the offset to the offending error) on error.
*/
static ssize_t cond_tokenize(TALLOC_CTX *ctx, fr_cond_t **out,
CONF_SECTION *cs, fr_sbuff_t *in, int brace,
- tmpl_rules_t const *t_rules, bool flag)
+ tmpl_rules_t const *t_rules, bool simple_parse)
{
fr_sbuff_t our_in = FR_SBUFF(in);
ssize_t slen;
/*
* Children are allocated from the parent.
*/
- slen = cond_tokenize(c, &c->data.child, cs, &our_in, brace + 1, t_rules, flag);
+ slen = cond_tokenize(c, &c->data.child, cs, &our_in, brace + 1, t_rules, simple_parse);
if (slen <= 0) {
fr_sbuff_advance(&our_in, slen * -1);
goto error;
* Grab the LHS
*/
fr_sbuff_marker(&m_lhs_cast, &our_in);
- slen = cond_tokenize_operand(c, &lhs, &m_lhs, &our_in, t_rules);
+ slen = cond_tokenize_operand(c, &lhs, &m_lhs, &our_in, t_rules, simple_parse);
if (!lhs) {
fr_sbuff_advance(&our_in, slen * -1);
goto error;
* Grab the RHS
*/
fr_sbuff_marker(&m_rhs_cast, &our_in);
- slen = cond_tokenize_operand(c, &rhs, &m_rhs, &our_in, t_rules);
+ slen = cond_tokenize_operand(c, &rhs, &m_rhs, &our_in, t_rules, simple_parse);
if (!rhs) {
fr_sbuff_advance(&our_in, slen * -1);
goto error;
* Promote the data types to the appropriate
* values.
*/
- if (fr_cond_promote_types(c, &our_in, &m_lhs, &m_rhs, flag) < 0) {
+ if (fr_cond_promote_types(c, &our_in, &m_lhs, &m_rhs, simple_parse) < 0) {
goto error;
}
} /* parse OP RHS */
* siblings are allocated from their older
* siblings.
*/
- slen = cond_tokenize(child, &child->next, cs, &our_in, brace, t_rules, flag);
+ slen = cond_tokenize(child, &child->next, cs, &our_in, brace, t_rules, simple_parse);
if (slen <= 0) {
fr_sbuff_advance(&our_in, slen * -1);
goto error;
* siblings are allocated from their older
* siblings.
*/
- slen = cond_tokenize(c, &c->next, cs, &our_in, brace, t_rules, flag);
+ slen = cond_tokenize(c, &c->next, cs, &our_in, brace, t_rules, simple_parse);
if (slen <= 0) {
fr_sbuff_advance(&our_in, slen * -1);
goto error;
* @param[out] head the parsed condition structure
* @param[in] rules for parsing operands.
* @param[in] in the start of the string to process.
- * @param[in] flag temporary hack
+ * @param[in] simple_parse temporary hack
* @return
* - Length of the string skipped.
* - < 0 (the offset to the offending error) on error.
*/
-ssize_t fr_cond_tokenize(CONF_SECTION *cs, fr_cond_t **head, tmpl_rules_t const *rules, fr_sbuff_t *in, bool flag)
+ssize_t fr_cond_tokenize(CONF_SECTION *cs, fr_cond_t **head, tmpl_rules_t const *rules, fr_sbuff_t *in, bool simple_parse)
{
ssize_t slen;
fr_sbuff_t our_in = FR_SBUFF(in);
*head = NULL;
- slen = cond_tokenize(cs, head, cs, &our_in, 0, rules, flag);
+ slen = cond_tokenize(cs, head, cs, &our_in, 0, rules, simple_parse);
if (slen <= 0) return slen;
/*