9 * Copyright 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
11 * SPDX-License-Identifier: LGPL-2.1-only
15 #include "filter-ast.h"
17 enum ir_op_signedness
{
21 IR_SIGN_DYN
, /* signedness determined dynamically */
27 IR_DATA_NUMERIC
, /* numeric and boolean */
30 IR_DATA_GET_CONTEXT_REF
,
35 const char *ir_data_type_str(enum ir_data_type type
)
39 return "IR_DATA_UNKNOWN";
41 return "IR_DATA_STRING";
43 return "IR_DATA_NUMERIC";
45 return "IR_DATA_FLOAT";
46 case IR_DATA_FIELD_REF
:
47 return "IR_DATA_FIELD_REF";
48 case IR_DATA_GET_CONTEXT_REF
:
49 return "IR_DATA_GET_CONTEXT_REF";
50 case IR_DATA_EXPRESSION
:
51 return "IR_DATA_EXPRESSION";
67 const char *ir_op_type_str(enum ir_op_type type
)
71 return "IR_OP_UNKNOWN";
79 return "IR_OP_BINARY";
81 return "IR_OP_LOGICAL";
87 /* left or right child */
94 enum ir_load_string_type
{
95 /* Plain, no globbing at all: `hello world`. */
96 IR_LOAD_STRING_TYPE_PLAIN
= 0,
98 /* Star at the end only: `hello *`. */
99 IR_LOAD_STRING_TYPE_GLOB_STAR_END
,
101 /* At least one star, anywhere, but not at the end only: `he*wor*`. */
102 IR_LOAD_STRING_TYPE_GLOB_STAR
,
109 enum ir_load_expression_type
{
110 IR_LOAD_EXPRESSION_GET_CONTEXT_ROOT
,
111 IR_LOAD_EXPRESSION_GET_APP_CONTEXT_ROOT
,
112 IR_LOAD_EXPRESSION_GET_PAYLOAD_ROOT
,
113 IR_LOAD_EXPRESSION_GET_SYMBOL
,
114 IR_LOAD_EXPRESSION_GET_INDEX
,
115 IR_LOAD_EXPRESSION_LOAD_FIELD
,
119 const char *ir_load_expression_type_str(enum ir_load_expression_type type
)
122 case IR_LOAD_EXPRESSION_GET_CONTEXT_ROOT
:
123 return "IR_LOAD_EXPRESSION_GET_CONTEXT_ROOT";
124 case IR_LOAD_EXPRESSION_GET_APP_CONTEXT_ROOT
:
125 return "IR_LOAD_EXPRESSION_GET_APP_CONTEXT_ROOT";
126 case IR_LOAD_EXPRESSION_GET_PAYLOAD_ROOT
:
127 return "IR_LOAD_EXPRESSION_GET_PAYLOAD_ROOT";
128 case IR_LOAD_EXPRESSION_GET_SYMBOL
:
129 return "IR_LOAD_EXPRESSION_GET_SYMBOL";
130 case IR_LOAD_EXPRESSION_GET_INDEX
:
131 return "IR_LOAD_EXPRESSION_GET_INDEX";
132 case IR_LOAD_EXPRESSION_LOAD_FIELD
:
133 return "IR_LOAD_EXPRESSION_LOAD_FIELD";
139 struct ir_load_expression_op
{
140 struct ir_load_expression_op
*next
;
141 enum ir_load_expression_type type
;
148 struct ir_load_expression
{
149 struct ir_load_expression_op
*child
;
155 enum ir_load_string_type type
;
161 struct ir_load_expression
*expression
;
166 enum unary_op_type type
;
170 struct ir_op_binary
{
176 struct ir_op_logical
{
183 /* common to all ops */
185 enum ir_data_type data_type
;
186 enum ir_op_signedness signedness
;
190 struct ir_op_root root
;
191 struct ir_op_load load
;
192 struct ir_op_unary unary
;
193 struct ir_op_binary binary
;
194 struct ir_op_logical logical
;
198 #endif /* _FILTER_IR_H */