Yes, I neglected
to include the defn of lifetimes.
It looks to me
like the current compiler allows trailing commas after lifetimes, but
not after type parameters (sigh). I'm assuming that's not the best
solution. What should it be?
John
I'm just fixing a few
bugs, and trying to make sure I understand the grammar of generics.
Here's what I've got. Can someone correct me, if I'm wrong? I've lifted
comments from a couple of functions, so you can ignore the words
"matches" and "where". Also, the definition of 'ty' is not provided :).
I'm assuming a hopefully-obvious BNF syntax.
John
// matches generics = ( ) | ( < > ) | ( < typaramseq > )
| ( < lifetimes > ) | ( < lifetimes , typaramseq > )
// where typaramseq = ( typaram ) | ( typaram , typaramseq )
// matches typaram = IDENT optbounds
// matches optbounds
= ( ( : ( boundseq )? )? )
// where boundseq = ( bound +
boundseq ) | ( bound )
// and bound = ( & STATIC ) | (
ty )
_______________________________________________
Rust-dev
mailing list
[email protected]https://mail.mozilla.org/listinfo/rust-dev