1 use crate::argument::ArgumentList;
2 use crate::attribute::ExtendedAttributeList;
3 use crate::common::{Identifier, Parenthesized};
4 use crate::types::{AttributedType, ReturnType};
6 /// Parses namespace members declaration
7 pub type NamespaceMembers<'a> = Vec<NamespaceMember<'a>>;
10 /// Parses namespace member declaration
11 enum NamespaceMember<'a> {
12 /// Parses `[attributes]? returntype identifier? (( args ));`
14 /// (( )) means ( ) chars
15 Operation(struct OperationNamespaceMember<'a> {
16 attributes: Option<ExtendedAttributeList<'a>>,
17 return_type: ReturnType<'a>,
18 identifier: Option<Identifier<'a>>,
19 args: Parenthesized<ArgumentList<'a>>,
22 /// Parses `[attribute]? readonly attributetype type identifier;`
23 Attribute(struct AttributeNamespaceMember<'a> {
24 attributes: Option<ExtendedAttributeList<'a>>,
25 readonly: term!(readonly),
26 attribute: term!(attribute),
27 type_: AttributedType<'a>,
28 identifier: Identifier<'a>,
39 test!(should_parse_attribute_namespace_member { "readonly attribute short name;" =>
41 AttributeNamespaceMember;
43 identifier.0 == "name";
46 test!(should_parse_operation_namespace_member { "short (long a, long b);" =>
48 OperationNamespaceMember;