Re: Grammar for Union Types

Le mercredi 04 janvier 2012 à 13:56 +1100, Cameron McCormack a écrit :
> OK, here's what I'll replace the grammar with then:
> 
> Type → SingleType
>          | UnionType
> 
> SingleType → NonAnyType TypeSuffix
>                | "any" TypeSuffixStartingWithArray
> 
> NonAnyType → PrimitiveType TypeSuffix
>                | "DOMString" TypeSuffix
>                | identifier TypeSuffix
>                | "sequence" "<" Type ">" Null
>                | "object" TypeSuffix
>                | "Date" TypeSuffix
> 
> UnionType → "(" UnionMemberType "or" UnionMemberType UnionMemberTypes 
> ")" TypeSuffix
> 
> UnionMemberType → NonAnyType
>                     | "any" "[" "]" TypeSuffix
> 
> UnionMemberTypes → "or" UnionMemberType UnionMemberTypes
>                      | ε
> Can you verify this is correct?

Looks good to me; I find having parenthesis around union types cleaner,
too. Thanks,

Dom

Received on Wednesday, 4 January 2012 09:27:30 UTC