On Oct 10, 2011, at 7:47 PM, Aaron Ballman wrote:
> On Sun, Oct 9, 2011 at 12:35 PM, Douglas Gregor <[email protected]> wrote:
>>>> I'd prefer that we keep the open/close source locations within
>>>> BalancedDelimiterTracker, which would simplify the interface a bit, since
>>>> *every* user of BalancedDelimiterTracker needs to track this information
>>>> anyway.
>>>
>>> I've implemented this change as well -- it was a good point, and it
>>> does make things cleaner. I had to update the signature for
>>> ParseInnerNamespace though, since that was the one use case that
>>> needed the opening brace to be passed in manually.
>>
>> I see that you're holding on to the opening source location (which is good),
>> but it doesn't look like you've simplified the interface at all. Why bother
>> to still pass in the "open" and "close" addresses in these functions:
>
> I've completed these changes as discussed, and I think the code has
> turned out to be better for them. Thanks for the clarification
> earlier today!
>
> I did have to modify a few parser signatures to pass around a
> BalancedDelimiterTracker, but it ended up simplifying the interfaces
> in those cases as well.
Very nice. I've committed this as r141782, with a few tiny tweaks:
+ unsigned& get(tok::TokenKind t) {
+ switch (t) {
+ default: assert(false && "Unexpected balanced token"); return ThrowAway;
+ case tok::l_brace: return Brace;
+ case tok::l_paren: return Paren;
+ case tok::l_square: return Square;
+ case tok::less: return Less;
+ case tok::lesslessless: return LLLess;
+ }
+ }
There's no need to behave well in the case where this class is abused, so I
removed ThrowAway.
I also added some documentation to the new classes, so people know how to use
them, and updated the "How to add an expression" section of the internals
manual.
Thanks!
- Doug
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits