X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Ffilter%2Ffilter-parser.y;h=3f301340dbb4ccff7150d9ce79d4d86046d07563;hp=3b77528a6a27061a8242e5055299334a23f15336;hb=586dc72f727912b4aa381789c418e062bce89d08;hpb=d00c599e39ae45ec7c8e12e6bac6b5e58f08f817 diff --git a/src/lib/lttng-ctl/filter/filter-parser.y b/src/lib/lttng-ctl/filter/filter-parser.y index 3b77528a6..3f301340d 100644 --- a/src/lib/lttng-ctl/filter/filter-parser.y +++ b/src/lib/lttng-ctl/filter/filter-parser.y @@ -32,20 +32,22 @@ #include "filter-ast.h" #include "filter-parser.h" -__attribute__((visibility("hidden"))) +#include + +LTTNG_HIDDEN int yydebug; -__attribute__((visibility("hidden"))) +LTTNG_HIDDEN int filter_parser_debug = 0; -__attribute__((visibility("hidden"))) +LTTNG_HIDDEN int yyparse(struct filter_parser_ctx *parser_ctx); -__attribute__((visibility("hidden"))) +LTTNG_HIDDEN int yylex(union YYSTYPE *yyval, struct filter_parser_ctx *parser_ctx); -__attribute__((visibility("hidden"))) +LTTNG_HIDDEN int yylex_init_extra(struct filter_parser_ctx *parser_ctx, yyscan_t * ptr_yy_globals); -__attribute__((visibility("hidden"))) +LTTNG_HIDDEN int yylex_destroy(yyscan_t yyparser_ctx); -__attribute__((visibility("hidden"))) +LTTNG_HIDDEN void yyrestart(FILE * in_str, yyscan_t parser_ctx); struct gc_string { @@ -62,7 +64,7 @@ static const char *node_type_to_str[] = { [ NODE_UNARY_OP ] = "NODE_UNARY_OP", }; -__attribute__((visibility("hidden"))) +LTTNG_HIDDEN const char *node_type(struct filter_node *node) { if (node->type < NR_NODE_TYPES) @@ -93,7 +95,7 @@ static struct gc_string *gc_string_alloc(struct filter_parser_ctx *parser_ctx, * gsrc will be garbage collected immediately, and gstr might be. * Should only be used to append characters to a string literal or constant. */ -__attribute__((visibility("hidden"))) +LTTNG_HIDDEN struct gc_string *gc_string_append(struct filter_parser_ctx *parser_ctx, struct gc_string *gstr, struct gc_string *gsrc) @@ -123,7 +125,7 @@ struct gc_string *gc_string_append(struct filter_parser_ctx *parser_ctx, return gstr; } -__attribute__((visibility("hidden"))) +LTTNG_HIDDEN void setstring(struct filter_parser_ctx *parser_ctx, YYSTYPE *lvalp, const char *src) { lvalp->gs = gc_string_alloc(parser_ctx, strlen(src) + 1); @@ -185,13 +187,13 @@ static struct filter_node *make_op_node(struct filter_parser_ctx *scanner, return node; } -__attribute__((visibility("hidden"))) +LTTNG_HIDDEN void yyerror(struct filter_parser_ctx *parser_ctx, const char *str) { fprintf(stderr, "error %s\n", str); } -__attribute__((visibility("hidden"))) +LTTNG_HIDDEN int yywrap(void) { return 1; @@ -230,15 +232,16 @@ static void filter_ast_free(struct filter_ast *ast) cds_list_for_each_entry_safe(node, tmp, &ast->allocated_nodes, gc) free(node); + free(ast); } -__attribute__((visibility("hidden"))) +LTTNG_HIDDEN int filter_parser_ctx_append_ast(struct filter_parser_ctx *parser_ctx) { return yyparse(parser_ctx); } -__attribute__((visibility("hidden"))) +LTTNG_HIDDEN struct filter_parser_ctx *filter_parser_ctx_alloc(FILE *input) { struct filter_parser_ctx *parser_ctx; @@ -280,7 +283,7 @@ cleanup_parser_ctx: return NULL; } -__attribute__((visibility("hidden"))) +LTTNG_HIDDEN void filter_parser_ctx_free(struct filter_parser_ctx *parser_ctx) { int ret; @@ -310,7 +313,7 @@ void filter_parser_ctx_free(struct filter_parser_ctx *parser_ctx) %token ASSIGN COLON SEMICOLON DOTDOTDOT DOT EQUAL COMMA %token XOR_BIN AND_BIN OR_BIN NOT_BIN -%token IDENTIFIER +%token IDENTIFIER GLOBAL_IDENTIFIER %token ERROR %union { @@ -384,6 +387,13 @@ primary_expression $$->u.expression.type = AST_EXP_IDENTIFIER; $$->u.expression.u.identifier = yylval.gs->s; } + | GLOBAL_IDENTIFIER + { + $$ = make_node(parser_ctx, NODE_EXPRESSION); + $$->u.expression.type = AST_EXP_GLOBAL_IDENTIFIER; + $$->u.expression.u.identifier = yylval.gs->s; + } + | DECIMAL_CONSTANT { $$ = make_node(parser_ctx, NODE_EXPRESSION);