X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Ffilter%2Ffilter-ast.h;h=926d8dd644a94004ccef75ce35028d290901666c;hp=176716474c850b297a6858d31aded176422f8e55;hb=d44f9a1878031bfdb6ceee49d817430b11f0a58b;hpb=d00c599e39ae45ec7c8e12e6bac6b5e58f08f817 diff --git a/src/lib/lttng-ctl/filter/filter-ast.h b/src/lib/lttng-ctl/filter/filter-ast.h index 176716474..926d8dd64 100644 --- a/src/lib/lttng-ctl/filter/filter-ast.h +++ b/src/lib/lttng-ctl/filter/filter-ast.h @@ -6,20 +6,10 @@ * * LTTng filter AST * - * Copyright 2012 - Mathieu Desnoyers + * Copyright 2012 Mathieu Desnoyers * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License, version 2.1 only, - * as published by the Free Software Foundation. + * SPDX-License-Identifier: LGPL-2.1-only * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* @@ -39,9 +29,6 @@ // data is a pointer to a 'SParserParam' structure //#define YYPARSE_PARAM parser_ctx -// the argument for the 'yylex' function -#define YYLEX_PARAM ((struct filter_parser_ctx *) parser_ctx)->scanner - #ifndef YY_TYPEDEF_YY_SCANNER_T #define YY_TYPEDEF_YY_SCANNER_T typedef void* yyscan_t; @@ -70,13 +57,13 @@ enum op_type { AST_OP_MOD, AST_OP_PLUS, AST_OP_MINUS, - AST_OP_RSHIFT, - AST_OP_LSHIFT, + AST_OP_BIT_RSHIFT, + AST_OP_BIT_LSHIFT, AST_OP_AND, AST_OP_OR, - AST_OP_BIN_AND, - AST_OP_BIN_OR, - AST_OP_BIN_XOR, + AST_OP_BIT_AND, + AST_OP_BIT_OR, + AST_OP_BIT_XOR, AST_OP_EQ, AST_OP_NE, @@ -91,13 +78,14 @@ enum unary_op_type { AST_UNARY_PLUS, AST_UNARY_MINUS, AST_UNARY_NOT, - AST_UNARY_BIN_NOT, + AST_UNARY_BIT_NOT, }; enum ast_link_type { AST_LINK_UNKNOWN = 0, AST_LINK_DOT, AST_LINK_RARROW, + AST_LINK_BRACKET, }; struct filter_node { @@ -121,23 +109,27 @@ struct filter_node { AST_EXP_CONSTANT, AST_EXP_FLOAT_CONSTANT, AST_EXP_IDENTIFIER, + AST_EXP_GLOBAL_IDENTIFIER, AST_EXP_NESTED, } type; enum ast_link_type post_op; /* reverse */ enum ast_link_type pre_op; /* forward */ union { - char *string; + const char *string; uint64_t constant; double float_constant; - char *identifier; + const char *identifier; /* * child can be nested. */ struct filter_node *child; } u; - /* linked dot/arrow chain */ + /* prev: backward dot/arrow chain (postfix expression) */ struct filter_node *prev; + /* next: forward dot/arrow chain, generated by a visitor. */ struct filter_node *next; + /* next_bracket: linked bracket chain (prefix expression) */ + struct filter_node *next_bracket; } expression; struct { enum op_type type; @@ -179,7 +171,6 @@ struct filter_ast *filter_parser_get_ast(struct filter_parser_ctx *parser_ctx) return parser_ctx->ast; } -int filter_visitor_set_parent(struct filter_parser_ctx *ctx); int filter_visitor_print_xml(struct filter_parser_ctx *ctx, FILE *stream, int indent); int filter_visitor_ir_generate(struct filter_parser_ctx *ctx); @@ -188,5 +179,8 @@ int filter_visitor_bytecode_generate(struct filter_parser_ctx *ctx); void filter_bytecode_free(struct filter_parser_ctx *ctx); int filter_visitor_ir_check_binary_op_nesting(struct filter_parser_ctx *ctx); int filter_visitor_ir_check_binary_comparator(struct filter_parser_ctx *ctx); +int filter_visitor_ir_validate_string(struct filter_parser_ctx *ctx); +int filter_visitor_ir_normalize_glob_patterns(struct filter_parser_ctx *ctx); +int filter_visitor_ir_validate_globbing(struct filter_parser_ctx *ctx); #endif /* _FILTER_AST_H */