9e060ce2b64e4fe77817c0af71fe76e150be308a
2 * filter-visitor-ir-validate-string.c
4 * LTTng filter IR validate string
6 * Copyright 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 * SPDX-License-Identifier: LGPL-2.1-only
18 #include <common/macros.hpp>
19 #include <common/compat/errno.hpp>
21 #include "filter-ast.hpp"
22 #include "filter-parser.hpp"
23 #include "filter-ir.hpp"
25 enum parse_char_result
{
26 PARSE_CHAR_UNKNOWN
= -2,
27 PARSE_CHAR_WILDCARD
= -1,
28 PARSE_CHAR_NORMAL
= 0,
32 enum parse_char_result
parse_char(const char **p
)
40 return PARSE_CHAR_NORMAL
;
42 return PARSE_CHAR_UNKNOWN
;
45 return PARSE_CHAR_WILDCARD
;
47 return PARSE_CHAR_NORMAL
;
52 int validate_string(struct ir_op
*node
)
57 fprintf(stderr
, "[error] %s: unknown op type\n", __func__
);
61 return validate_string(node
->u
.root
.child
);
66 if (node
->data_type
== IR_DATA_STRING
) {
69 LTTNG_ASSERT(node
->u
.load
.u
.string
.value
);
70 str
= node
->u
.load
.u
.string
.value
;
73 enum parse_char_result res
;
79 res
= parse_char(&str
);
83 case PARSE_CHAR_UNKNOWN
:
86 "Unsupported escape character detected.\n");
88 case PARSE_CHAR_NORMAL
:
98 return validate_string(node
->u
.unary
.child
);
101 int ret
= validate_string(node
->u
.binary
.left
);
105 return validate_string(node
->u
.binary
.right
);
111 ret
= validate_string(node
->u
.logical
.left
);
114 return validate_string(node
->u
.logical
.right
);
119 int filter_visitor_ir_validate_string(struct filter_parser_ctx
*ctx
)
121 return validate_string(ctx
->ir_root
);
This page took 0.031898 seconds and 3 git commands to generate.