From 9ba6e5283efd2fe454d3bc92eca960b3ebd91294 Mon Sep 17 00:00:00 2001 From: Serguey Parkhomovsky Date: Mon, 30 Nov 2015 19:27:32 -0500 Subject: [PATCH] Error on unbalanced parentheses in rules section. --- src/scan.l | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/scan.l b/src/scan.l index 1a0dc8d..bc316be 100644 --- a/src/scan.l +++ b/src/scan.l @@ -738,7 +738,13 @@ nmstr[yyleng - 2 - end_is_ws] = '\0'; /* chop trailing brace */ return '('; } "(" sf_push(); return '('; - ")" sf_pop(); return ')'; + ")" { + if (_sf_top_ix > 0) { + sf_pop(); + return ')'; + } else + synerr(_("unbalanced parenthesis")); + } [/|*+?.(){}] return (unsigned char) yytext[0]; . RETURNCHAR; -- 2.40.0