Commit Graph

5 Commits

Author SHA1 Message Date
Olly Betts 3f4ed82945 Improve parsing of expressions related to functions calls
For example, the following no longer give parse errors:  `g().d()`,
`g().D`, `(f(1) < g(2))`, `sizeof f(a,b)`

Partly addresses #3197
2025-06-17 14:59:54 +12:00
Olly Betts 6dbf867d23 Fix handling of corner cases by previous change
Don't collapse runs of whitespace to a single space, instead replace
each whitespace with one space.

Leave the expression as-is if it contains one or more double quotes
as we don't want to change the value of string literals, and any
expression containing double quotes won't currently work in the context
where we need to replace newlines anyway.

Fixes #3127 better
2025-03-03 11:22:37 +13:00
Olly Betts 57ed628035 Improve parsing of sizeof(X)
Support parsing `sizeof(X)` for any expression or type X by skipping
balanced parentheses.  We don't need to actually parse X since the type
of sizeof is always size_t.

Fixes #2919
2024-06-06 10:36:12 +12:00
Olly Betts d506235a6d Fix testcase addition in previous commit 2023-11-19 21:15:46 +13:00
Olly Betts 967dd4e5c1 Fix dropping of parentheses around < and > expressions
We were dropping parentheses in these cases, which can change the value
of the expression.
2023-11-19 16:28:13 +13:00