flex
flex copied to clipboard
Flex 2.6.4 does not always recognize opening caret and disable implicit grouping
The Flex manual warns that an opening caret (^) disables implicit grouping. This is fine. The goal is to protect the opening caret. For example,
SIG_HEAD <<
is implicitly rewritten as
SIG_HEAD (<<)
but
SIG_HEAD ^<<
is not rewritten. The problem is, Flex does not recognize that the definition below has an opening caret:
SIGNATURE {SIG_HEAD}{SIG_BODY}{SIG_FOOT}
and rewrites it as
SIGNATURE (^<< ... expansion of SIG_BODY and SIG_FOOT ... )
Then, because Flex has rewritten the expression so the caret is no longer an opening caret, it throws an error. It trips over its own feet, which is exactly the outcome that the exception is trying to prevent. Flex should recognize the opening caret in this case too, and disable implicit grouping.