<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jul 5, 2011, at 9:22 PM, David Blaikie wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: collapse; font-family: arial, sans-serif; font-size: 13px; "><div class="im" style="color: rgb(80, 0, 80); "><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
Since C++ lambda expressions and Objective-C message expressions can<br>each start with the same two tokens (l_square followed by identifier),<br>it can take a lookahead of three tokens to differentiate the two cases.<br>
</blockquote><div><br></div></div><div>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.</div></span></blockquote><div><br></div>Objective-C++ exists and is important to a lot of our developers; any implementation of lambdas in Clang will eventually need to handle both.</div><div><br></div><div>John.</div></body></html>