summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@gnu.org>2019-02-08 15:28:04 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2019-02-08 15:28:04 (GMT)
commitb64ca53d3f65ea7d51afa977e9d4bed808f494f7 (patch) (side-by-side diff)
treeec7e7d1b184c25b716a4a49844fad3cf41cc36e7 /src
parentb0cc5efa1a1c8145981846cfa8e80cc67d12ebf6 (diff)
downloadcflow-b64ca53d3f65ea7d51afa977e9d4bed808f494f7.tar.gz
cflow-b64ca53d3f65ea7d51afa977e9d4bed808f494f7.tar.bz2
Fix https://savannah.gnu.org/bugs/index.php?47110
* src/parser.c (expression): Fix parsing of type casts. * tests/memberof.at: New test case. * tests/testsuite.at: Add new test. * tests/Makefile.am: Add new test.
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/parser.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/parser.c b/src/parser.c
index 2b173c2..391fe33 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -605,9 +605,17 @@ expression()
parens_lev++;
} else {
reference(name, line);
+
+ /* MEMBER_OF can be preceded by a closing paren, as in
+ (*a)->b
+ */
+ while (parens_lev > 0 && tok.type == ')') {
+ parens_lev--;
+ nexttoken();
+ }
+
if (tok.type == MEMBER_OF) {
- while (tok.type == MEMBER_OF)
- nexttoken();
+ nexttoken();
} else {
putback();
}
@@ -615,7 +623,7 @@ expression()
break;
case '(':
/* maybe typecast */
- if (nexttoken() == TYPE)
+ if (nexttoken() == TYPE || tok.type == STRUCT)
skip_to(')');
else {
putback();
@@ -625,6 +633,9 @@ expression()
case ')':
parens_lev--;
break;
+ case MEMBER_OF:
+ nexttoken();
+ break;
}
nexttoken();
}

Return to:

Send suggestions and report system problems to the System administrator.