[cfe-dev] Lookahead vs. Tentative Parsing
John McCall
rjmccall at apple.com
Tue Jul 5 21:33:12 PDT 2011
On Jul 5, 2011, at 9:22 PM, David Blaikie wrote:
> Since C++ lambda expressions and Objective-C message expressions can
> each start with the same two tokens (l_square followed by identifier),
> it can take a lookahead of three tokens to differentiate the two cases.
>
> I'm playing around with implementing this myself. But why would you need a lookahead when these only appear in distinct languages? Currently there's a "if objective C, start parsing a message" I was just going to add an "if C++, start parsing a lambda" after that.
Objective-C++ exists and is important to a lot of our developers; any implementation of lambdas in Clang will eventually need to handle both.
John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110705/86a2c362/attachment.html>
More information about the cfe-dev
mailing list