From f9c67088c31c4e211e4ea9655c231d0b908a6290 Mon Sep 17 00:00:00 2001 From: Etienne Bergeron Date: Tue, 2 Apr 2013 19:24:22 -0400 Subject: [PATCH] Fix: add semantic check in grammar Signed-off-by: Etienne Bergeron Signed-off-by: Mathieu Desnoyers --- formats/ctf/metadata/ctf-parser.y | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/formats/ctf/metadata/ctf-parser.y b/formats/ctf/metadata/ctf-parser.y index 188f8cd4..58ea245b 100644 --- a/formats/ctf/metadata/ctf-parser.y +++ b/formats/ctf/metadata/ctf-parser.y @@ -1225,7 +1225,13 @@ unary_expression: postfix_expression { $$ = $1; } | PLUS postfix_expression - { $$ = $2; } + { + $$ = $2; + if ($$->u.unary_expression.type != UNARY_UNSIGNED_CONSTANT + && $$->u.unary_expression.type != UNARY_SIGNED_CONSTANT) { + reparent_error(scanner, "expecting numeric constant"); + } + } | MINUS postfix_expression { $$ = $2; -- 2.34.1